fix(plugins): retry transient Claude marketplace update failures
On Windows the Claude CLI swaps in a fresh marketplace clone by renaming it, which fails with EPERM while antivirus, indexers, or open sessions briefly hold the folder. Retry the update up to three times with a short backoff on EPERM, EBUSY, EACCES, or "try again" errors; other failures still stop at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5664fec100
commit
870cad66ac
2 files changed
+32
-2
No files matched your search
@@ -203,8 +203,27 @@ class ManagedExtensionTests(unittest.TestCase):
|
||||
with self.assertRaisesRegex(ValueError, 'refresh failed'):
|
||||
self.manager().sync([plugin()], ['claude'], {'Example'})
|
||||
self.assertEqual(['claude', 'plugin', 'marketplace', 'update', 'test'], command.call_args.args[0])
|
||||
self.assertEqual(1, command.call_count)
|
||||
self.assertEqual([], self.manager().state['resources'])
|
||||
|
||||
def test_claude_marketplace_refresh_retries_transient_lock(self):
|
||||
failures = [ValueError("EPERM: operation not permitted, rename 'caveman..clone'")] * 2
|
||||
def command(args, summary, home=None):
|
||||
if args[2:4] == ['marketplace', 'update'] and failures:
|
||||
raise failures.pop()
|
||||
return self.command(args, summary, home)
|
||||
with patch.object(extensions, 'run_command', side_effect=command), patch.object(extensions.time, 'sleep') as sleep:
|
||||
self.manager().sync([plugin()], ['claude'], {'Example'})
|
||||
self.assertEqual(2, sleep.call_count)
|
||||
self.assertEqual(['claude', 'plugin', 'install', 'example@test', '--scope', 'user'], self.commands[-1])
|
||||
self.assertEqual(['Example'], [r['name'] for r in self.manager().state['resources']])
|
||||
|
||||
def test_claude_marketplace_refresh_gives_up_after_three_transient_failures(self):
|
||||
with patch.object(extensions, 'run_command', side_effect=ValueError('EBUSY')) as command, patch.object(extensions.time, 'sleep'):
|
||||
with self.assertRaisesRegex(ValueError, 'EBUSY'):
|
||||
self.manager().sync([plugin()], ['claude'], {'Example'})
|
||||
self.assertEqual(3, command.call_count)
|
||||
|
||||
@unittest.skipUnless(os.name == 'nt', 'Windows hook compatibility')
|
||||
def test_owned_caveman_hook_repair_runs_in_powershell_and_is_idempotent(self):
|
||||
entry = dict(plugin('Caveman'), codex_plugin='caveman@thinkhome-caveman')
|
||||
|
||||
Reference in new issue
Block a user