fix(installer): verbose diagnostics — show CLAUDE_CUSTOM_MODELS count
User reported: after install, claude /model picker shows only 5 models
(built-ins) instead of 19 — config DID land somewhere but CLAUDE_CUSTOM_
MODELS env block in settings.json was empty/missing.
Hard to debug without seeing user's settings.json. Add verbose diagnostic:
uclaude_updater.py patch_all_users():
- Pre-check: warn if config has 0 models OR placeholder api_key
- Post-patch per user: read back the JUST-WRITTEN settings.json, count
CLAUDE_CUSTOM_MODELS entries, print:
"Patched root: /root/.claude/settings.json (env.CLAUDE_CUSTOM_MODELS=19 models)"
uclaude_install.sh — final verification block:
- Show ANTHROPIC_BASE_URL + AUTH_TOKEN prefix + custom_models count
- Loud warning if 0 models or auth_token missing
Now user can immediately see "0 models" or "19 models" without manually
inspecting settings.json. If 0 — knows config fetch failed silently.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -164,7 +164,38 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "=== Installation complete ==="
|
||||
echo " To update later: cd $INSTALL_DIR && sudo bash claude/uclaude_update.sh"
|
||||
echo ""
|
||||
|
||||
# Sanity check what landed in settings.json (helps diagnose "only 5 models
|
||||
# in /model picker" case — usually means CLAUDE_CUSTOM_MODELS missing
|
||||
# from settings.json env block).
|
||||
ME_HOME="${HOME:-/root}"
|
||||
SETTINGS="$ME_HOME/.claude/settings.json"
|
||||
if [ -f "$SETTINGS" ]; then
|
||||
echo " Verification: $SETTINGS"
|
||||
python3 - "$SETTINGS" <<'PYEOF'
|
||||
import json, sys
|
||||
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
|
||||
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])}...")
|
||||
except Exception as e:
|
||||
print(f" ERROR reading settings.json: {e}")
|
||||
PYEOF
|
||||
else
|
||||
echo " (no $SETTINGS to verify — patcher may not have run)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo " Run claude: claude # interactive"
|
||||
echo " Update later: cd $INSTALL_DIR && sudo bash claude/uclaude_update.sh"
|
||||
echo ""
|
||||
echo " To install Codex CLI separately, see README codex section:"
|
||||
echo " https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.sh"
|
||||
|
||||
@@ -876,10 +876,31 @@ def patch_all_users(config):
|
||||
eprint(f" {Y}No users found{D}")
|
||||
return
|
||||
|
||||
# Diagnostic: confirm config has the key fields BEFORE patching users.
|
||||
# If models is empty/missing, claude shows only built-in defaults
|
||||
# (user reported only 5 models in /model picker — root cause was here).
|
||||
n_models = len(config.get("models", []))
|
||||
if n_models == 0:
|
||||
eprint(f" {R}WARNING: config has 0 models — claude /model will show built-ins only{D}")
|
||||
else:
|
||||
print(f" Config has {n_models} models (sample: {','.join(config['models'][:3])}...)")
|
||||
if not config.get("api_key") or config["api_key"] in ("YOUR_API_KEY", "PLACEHOLDER", ""):
|
||||
eprint(f" {R}WARNING: api_key is placeholder/empty — claude API auth will fail{D}")
|
||||
|
||||
for user in users:
|
||||
try:
|
||||
path = patch_user(user.home, user.name, user.uid, user.gid, config)
|
||||
print(f" {G}Patched {user.name}{D}: {path}")
|
||||
# Verify what landed in settings.json
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
written = json.load(f)
|
||||
env_block = written.get("env", {})
|
||||
ccm = env_block.get("CLAUDE_CUSTOM_MODELS", "")
|
||||
ccm_count = len(ccm.split(",")) if ccm else 0
|
||||
print(f" {G}Patched {user.name}{D}: {path} "
|
||||
f"(env.CLAUDE_CUSTOM_MODELS={ccm_count} models)")
|
||||
except Exception:
|
||||
print(f" {G}Patched {user.name}{D}: {path}")
|
||||
except Exception as e:
|
||||
eprint(f" {R}Failed to patch {user.name}: {e}{D}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user