Description
What happened
applyModelSelection in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts applies effort and fast-mode changes to a live Claude process eagerly, but returns early when the model id differs (the comment there reads "A model change still waits for the next turn, which checks it against the turn's permission mode"). So changing a thread's model while no turn is running - for example while background work is still pending - leaves the live process on the old model until the next turn starts.
This is the residual half of #45785. The wake-turn half is fixed by #45824: a continuation turn now applies the thread's changed selection live, so every wake that starts after the change runs the new model. But the response Claude Code has usually already started when a wake arrives can still run on the old model. Applying the change eagerly at picker time would close that gap too: the process would already run the new model when the wake begins.
Why it is not a one-line change
The adapter has no clean "no turn is active" signal at that point: live.lastTurn persists after a turn ends and is never reset to null, so gating the eager apply needs new state plumbing at the adapter boundary. The permission-mode check that motivates the deferral (the CLI may fall back from the requested permission mode on startup, so a model switch is only safe against a known mode) also needs an answer for the no-turn case, for example against the process's openedPermissionMode.
Reproduction
- A Claude thread with background work pending (for example two background sleeps).
- Change the thread's model in the picker while no turn is running (background work still pending).
- The first wake that arrives can still respond on the old model; later wakes and tool rounds run the new one.
Expected
A model change made while no turn is active reaches the live process immediately, so the next wake - including its first response - runs the new model.
Activity
juliusmarminge commentedon Nov 30, 2026
I tried to reproduce this on the current build and could not.
Commit: origin/main c16ad0c. I did not do a real-app run. Driving a live Claude thread with pending background work through a dev server, changing the model between turns and checking which model answers the first wake would need a custom RPC driver, and I did not build one within the budget. What I did instead: (1) Read applyModelSelection in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts (~line 15826). It returns early when
live.selection.apiModelId !== selection.apiModelId, so a model change never reaches the live query outside a turn. That limit came in with #34563 (d6e5f2e). (2) Wrote an adapter test in ClaudeAdapterV2.test.ts using the existing wake harness and the real ClaudeAdapterV2, with only the SDK query faked. The test starts an opus turn, offers a background task_started frame, finishes the turn so background work is still pending, then calls applyModelSelection with claude-sonnet-4-6. On main the live query gets no setModel call: liveSelectionChanges[0] is undefined, expected { model: 'claude-sonnet-4-6' }. Ran:vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts -t "between turns"in apps/server; 1 failed. Pushed as factory/repro-45823 (cff0ebb). Related: #45785 (wake-turn half) and PR #45824 (its fix) are both still open; this issue is the residual half that #45824 does not cover.Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.