Repository navigation
fix(server): switching the Claude model no longer blocks a later provider switch - #11
Merged
Merged
Conversation
…ider switch The Claude CLI answers setModel with a replayed local-command user frame. It arrives before the next turn attaches, so the adapter buffered it as the start of a wake. Nothing drains that buffer on a user turn, so the session reported background work until the process exited and every provider switch was refused. Drop that echo when no turn is active. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After changing the Claude model in a thread, every send to another provider is refused:
Nothing is running and there is no Stop button. Only Force stop clears it.
T3 changes the model on the running CLI. The CLI answers with an echo,
<local-command-stdout>Set model to …</local-command-stdout>, before the next turn starts. T3 kept that echo as the start of a background wake, and nothing cleared it.flowchart TD A["Send with a new Claude model"] --> B["T3 calls setModel on the running CLI"] B --> C["CLI echoes: Set model to …"] C --> D["Before: kept as a background wake<br/>Now: dropped"] D --> E["Turn runs and ends"] E --> F["Send to another provider<br/>Before: refused<br/>Now: hand-off starts"] classDef changed fill:#fef3c7,stroke:#d97706,color:#78350f class D,F changedsetModel, no turn activeExisting upstream fixes
The symptom is upstream issue
pingdotgg/t3code#32296. This cause is not reported there. None of the open fixes removes the echo:#33859resultin the same check#32508MikaMcFlurry:mika/queue-busy-switchresultFrom reading their code, not from running those branches.
Change
In
ClaudeAdapterV2.ts, a replayed local-command echo that arrives while no turn is active is dropped instead of buffered. Frames inside a turn are handled as before.Other providers
Only Claude is affected. The others start a wake on an explicit turn-start event, not on any frame that arrives between turns:
userecho frameuser,assistantorresultframeconfig_option_updateorcurrent_mode_updateuser_message, staterunningresponseagent_startturn/startedFrom reading each adapter, not from running the providers.
Scope and approval
One bug, one adapter. Fork fix on
main. The other stale-state cases inpingdotgg/t3code#32296are not addressed.Verification
Before is
ClaudeAdapterV2.tsfrommainwith this PR's test:The test answers
setModelwith the echo, as the CLI does, and runs a turn on the new model. It also checks that a rootuserframe that is not an echo still counts; widening the fix to anyuserframe fails that assertion.From the incident (
0.1.7-nightly.20261106.30, Windows, Claude Code 2.1.316, UTC):The log has no task or subagent frames. All 6 live model switches in local logs produced this echo, each just before the CLI confirmed the switch.
vp run check:changedpassed, including the fullClaudeAdapterV2file (350 tests). The app with a real Claude turn, the full suites and the build were not run. Node 24.4.1, not the pinned 26.12.1.Written with Claude Fable 5.2 in T3 Code.
🤖 Generated with Claude Code