Skip to content

fix: refresh stale model ids on upgrade + surface rejected API keys#217

Merged
nullxnothing merged 7 commits into
mainfrom
growth/loop5-model-ids
Jul 4, 2026
Merged

fix: refresh stale model ids on upgrade + surface rejected API keys#217
nullxnothing merged 7 commits into
mainfrom
growth/loop5-model-ids

Conversation

@nullxnothing

Copy link
Copy Markdown
Owner

Two reliability fixes found during the first-run work, plus a shared-constant cleanup.

  • Upgraded installs kept agent rows pinned to superseded dated model ids (claude-sonnet-4-20250514 / claude-opus-4-20250514), and the same dated ids were hardcoded in packages/shared. Forward-only migrations (V59 agents, V60 agent_station_configs) remap only those two exact ids to the current aliases; a still-valid deliberate pick is never touched. All model ids now derive from one CLAUDE_MODEL_IDS constant.
  • A disabled-org ANTHROPIC_API_KEY inherited from the shell silently degraded ARIA to a tool-less CLI. Auth rejections (401/403, disabled org, invalid key) now raise an amber transcript banner naming which credential failed and how to fix it; rate limits and network errors keep their original message. Key values never logged.

New pure module electron/services/providers/claudeAuth.ts (source resolution + auth-error classifier). Suite 1027 to 1063 (+36, none skipped), including real-SQL full-chain migration tests. Typecheck, build, lint:styles green.

Fresh installs seed current model aliases, but upgraded DBs kept agent rows
pointing at claude-sonnet-4-20250514 / claude-opus-4-20250514 from old seeds,
and the shared MODEL_MAP still hardcoded the same dated ids. V59 rewrites only
those exact known-stale ids to the current aliases (a valid model the user
picked on purpose is never touched) and the shared shorthand maps now resolve
to claude-sonnet-4-6 / claude-opus-4-8.
A disabled or invalid ANTHROPIC_API_KEY inherited from the shell made the
operator loop throw, and the catch quietly fell back to the tool-less CLI
answer — ARIA lost every tool with no explanation. The fallback now detects
auth rejections (401/403/authentication_error), names which credential failed
(stored key vs shell env, mirroring the loop's stored-first precedence), and
prepends an actionable notice to the degraded reply. Key values never appear
in messages or logs.
CLAUDE_MODEL_IDS in packages/shared is now the canonical id set; MODEL_MAP,
resolveModelName, the desktop provider maps (ClaudeRouter/ClaudeProvider),
ClaudeAgentService defaults, and the Agent Launcher / Agent Station pickers
all derive from it, so a model bump is a one-line change. Station picker
drops the superseded claude-sonnet-4-5 option.
V60 companion to the V59 agent refresh: agent_station_configs rows only ever
hold values the station picker offered, so claude-opus-4-20250514 and
claude-sonnet-4-5 there are DAEMON-originated and safe to remap to the current
aliases. Non-Claude rows (gpt-*) pass through untouched. Migration targets now
reference CLAUDE_MODEL_IDS so they cannot drift from the canonical set.
Follow-up to the rejected-key notice: instead of prepending the warning to the
reply text, emit a dedicated 'notice' transcript event rendered as an
amber-lined banner (5px dot language) above the turn, persist it in message
metadata so it survives history reloads, and log only the key SOURCE (stored
vs shell env) — key values never reach logs or the transcript.
MigrationRunner drives the FULL runMigrations chain against node:sqlite (real
SQL engine, no Electron-ABI binding needed): fresh installs seed only
sanctioned model IDs, a simulated pre-V59 install gets its agent and station
rows remapped, re-running is a no-op, and every refresh-map target is proven
to be a canonical CLAUDE_MODEL_IDS value. AriaAuthNotice exercises sendMessage
end to end with the real claudeAuth classifier: warn banner names the failing
key source, reply text stays clean, metadata survives reloads, GLM turns and
network errors never blame the Anthropic key.
@nullxnothing nullxnothing enabled auto-merge (squash) July 3, 2026 23:35
@nullxnothing nullxnothing merged commit 552d4d5 into main Jul 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant