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
@@ -11,6 +11,7 @@ import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
@@ -267,6 +268,16 @@ class Manager:
|
||||
else:
|
||||
run_command(arguments, self.summary, self.home)
|
||||
|
||||
def refresh_marketplace(self, client, name):
|
||||
# Windows briefly locks a fresh marketplace clone (antivirus, indexers, open sessions), so the CLI's rename fails with EPERM.
|
||||
for attempt in range(3):
|
||||
try:
|
||||
return self.command([client, 'plugin', 'marketplace', 'update', name])
|
||||
except ValueError as error:
|
||||
if attempt == 2 or not re.search(r'\b(EPERM|EBUSY|EACCES)\b|try again', str(error), re.I):
|
||||
raise
|
||||
time.sleep(5 * (attempt + 1))
|
||||
|
||||
def remove(self, record):
|
||||
if self.dry_run:
|
||||
if not self.summary:
|
||||
@@ -356,7 +367,7 @@ class Manager:
|
||||
self.save()
|
||||
return
|
||||
if item is not None and client == 'claude':
|
||||
self.command([client, 'plugin', 'marketplace', 'update', selector.rsplit('@', 1)[1]])
|
||||
self.refresh_marketplace(client, selector.rsplit('@', 1)[1])
|
||||
self.command([client, 'plugin', 'update', selector])
|
||||
if item.get('enabled') is False:
|
||||
self.command([client, 'plugin', 'enable', selector])
|
||||
@@ -376,7 +387,7 @@ class Manager:
|
||||
else:
|
||||
self.command([client, 'plugin', 'marketplace', 'add', marketplace])
|
||||
if client == 'claude':
|
||||
self.command([client, 'plugin', 'marketplace', 'update', selector.rsplit('@', 1)[1]])
|
||||
self.refresh_marketplace(client, selector.rsplit('@', 1)[1])
|
||||
arguments = [client, 'plugin', 'install', selector, '--scope', 'user'] if client == 'claude' else [client, 'plugin', 'add', selector]
|
||||
self.command(arguments)
|
||||
resolved_version = None
|
||||
|
||||
Reference in new issue
Block a user