Claude driver: explicit model slug bypasses ANTHROPIC_DEFAULT_* mapping; worktree mode not honored (sessions run in live checkout) #4149
Found while evaluating T3 Code (Alpha 0.0.28, macOS) with a Claude provider pointed at
OpenRouter per the docs (docs/providers/claude.md, "I Want To Use OpenRouter").
Three related issues:
1. Model picker stores explicit slugs, so ANTHROPIC_DEFAULT_*_MODEL mapping never applies#
The docs suggest mapping Claude Code's model roles via env vars
(ANTHROPIC_DEFAULT_SONNET_MODEL=moonshotai/kimi-k3 etc.). However, the picker persists an
explicit versioned slug — state.sqlite modelSelection shows e.g.
{"model":"claude-sonnet-4-6", ...} — which Claude Code passes through verbatim. The
DEFAULT_* vars only map aliases (sonnet), so the mapping silently never fires: our
"Kimi" provider ran a real claude-sonnet-4.6 via OpenRouter ($ on the wrong model, easy to
miss). Interestingly CLAUDE_CODE_SUBAGENT_MODEL did apply — subagent calls went to Kimi
while the main thread ran Sonnet, which makes the mixed billing extra confusing.
Workaround we found: typing the full slug (moonshotai/kimi-k3) into the model-picker
search creates a custom entry that is passed through correctly.
Suggestion: either resolve picker selections through the provider's env mapping, or update
the OpenRouter docs section to recommend custom-slug entries instead of ANTHROPIC_DEFAULT_*.
2. "Local checkout" default writes into the live repo#
Expected for the mode, but as a default it surprises: our first thread modified the real working tree (untracked files in the user's main checkout). Consider defaulting new threads to worktree mode, or a first-run hint.
3. Worktree mode selected but not honored#
With New worktree explicitly selected (branching from a chosen ref), T3 created the
worktree (~/.t3/worktrees/<repo>/t3code-<id> on the right base) — but the Claude session
still launched with cwd = the project's live checkout (provider_session_runtime shows
"cwd": "<live repo path>"). The worktree stayed empty; all edits landed in the live repo
again. Reproduced on Alpha 0.0.28 with the Claude driver.
Happy to provide state.sqlite excerpts or logs. Thanks — the UI itself is genuinely nice.
🤖 Generated with Claude Code
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Thanks for the report. One part of this is fixed on main in #11369 and #17654. Please test on the nightly built from main on 2026-10-21, or on the next stable release. One part is still open: Worktree sessions using the live checkout and the surprising local-checkout default. If that part still matters to you, please open a new issue for that part only.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Confirmed still present on
main(30c96228) — worth noting since your report was Alpha 0.0.28. I think I can add the code path, plus a repro that takes T3 out of the loop.Where the slug is emitted.
resolveClaudeApiModelId()inapps/server/src/provider/Layers/ClaudeProvider.ts:452returns the picker's stored slug verbatim:Consumers are
ClaudeAdapter.ts:3494and:3741(agent SDKmodel) andClaudeTextGeneration.ts:169(--modelon the CLI). Upstream of that,packages/contracts/src/model.ts:194-196folds alias-ish inputs into versioned slugs ("sonnet-4.6" → "claude-sonnet-4-6"), so nothing downstream ever seessonnet.Repro without T3 (claude 2.1.220) — read the served model off
modelUsage/canonicalModel:(1) reports the mapped model — or errors naming it, if your endpoint doesn't serve it, which equally proves the var was read. (2) always reports
claude-sonnet-4-6. SoANTHROPIC_DEFAULT_*_MODELis alias-only by design on the Claude Code side, and any explicit slug bypasses it. That also explains whyCLAUDE_CODE_SUBAGENT_MODELstill worked for you: T3 passes no explicit model for subagents, so Claude Code resolves that one itself.On the custom-slug workaround — it does pass through correctly, but a slug that isn't in
BUILT_IN_MODELSfalls back toDEFAULT_CLAUDE_MODEL_CAPABILITIES(ClaudeProvider.ts:46), which isoptionDescriptors: [], so those entries lose the effort / thinking / context-window controls. Worth knowing if the docs end up recommending them.If the mapping route is preferred over the docs route, the smallest version looks like: when the provider instance defines
ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU}_MODEL, emit the family alias for the matching built-in slug instead of the versioned one — the call sites already have the instance env in scope.No comment on items 2 and 3; I haven't looked at the worktree path.