fix(updater): write models to settings.availableModels — v2.1.114+ removed CLAUDE_CUSTOM_MODELS env var

Root cause of "/model picker shows only 5 models": Anthropic removed
the CLAUDE_CUSTOM_MODELS env var sometime around v2.1.114. The picker
now reads exclusively from settings.json `availableModels` (a Zod-typed
allowlist field). We were:
  - Writing CLAUDE_CUSTOM_MODELS into env.* (no longer read)
  - Calling data.pop("availableModels", None) — actively REMOVING the
    field that the picker now needs

So the picker fell back to built-in models + the two ANTHROPIC_DEFAULT_*
models, giving exactly 4 entries. Confirmed via strings on the v2.1.119
SEA binary: zero hits for "CLAUDE_CUSTOM_MODELS", but Zod schema
defines availableModels as the model allowlist.

Fix:
- patch_user() writes config['models'] into data['availableModels']
  (still also sets the env var for backward-compat with side-by-side
  older binaries)
- Verification block in install.sh + updater.py now reports both:
    availableModels: N models  (env.CLAUDE_CUSTOM_MODELS legacy: N)

Tested locally on v2.1.119 SEA install → settings.json now contains
availableModels with all 19 models. Restart claude → /model should show
the full list.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-04-26 07:56:31 +00:00
parent 0c2b9f056a
commit 4e36a774be
2 changed files with 28 additions and 7 deletions

View File

@@ -179,13 +179,20 @@ try:
s = json.load(open(sys.argv[1]))
env = s.get("env", {})
ccm = env.get("CLAUDE_CUSTOM_MODELS", "")
n = len(ccm.split(",")) if ccm else 0
n_env = len(ccm.split(",")) if ccm else 0
am = s.get("availableModels") or []
n_am = len(am) if isinstance(am, list) else 0
print(f" base_url: {env.get('ANTHROPIC_BASE_URL','-')}")
auth = env.get("ANTHROPIC_AUTH_TOKEN", "")
print(f" auth_token: {auth[:8]}{'...' if auth else ' (NOT SET — auth will fail!)'}")
print(f" custom_models: {n} models {'⚠ ZERO — /model will show built-ins only' if n==0 else 'OK'}")
if n > 0:
print(f" sample: {','.join(ccm.split(',')[:3])}...")
# SEA v2.1.114+ reads from settings.availableModels (settings.json),
# not env.CLAUDE_CUSTOM_MODELS. We log both: availableModels is the
# source of truth for the /model picker now.
status = "OK" if n_am > 0 else "WARN ZERO — /model will show built-ins only"
print(f" availableModels: {n_am} models {status}")
print(f" env.CLAUDE_CUSTOM_MODELS (legacy): {n_env} models")
if n_am > 0:
print(f" sample: {','.join(am[:3])}...")
except Exception as e:
print(f" ERROR reading settings.json: {e}")
PYEOF