Skip to content

[Bug]: Claude wake turns keep the old model after the thread's model selection changes #45785

Done

Description

@sercada

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server (orchestration-v2, ClaudeAdapterV2)

Steps to reproduce

  1. Start a thread on the Claude provider with model A, for example claude-fable-5-2, effort high.
  2. In that thread, have the agent start a background subagent (Claude Code Agent with run_in_background) or a background command. Then let its turn end while that work runs.
  3. Change the thread's model to model B, for example claude-opus-5-5 / xhigh, before the background work finishes. We did it with t3_thread_configure through T3's MCP, called by the thread's own agent during its turn; the composer picker takes the same path.
  4. Let the background work finish. T3 starts a wake turn by itself (orchestration-v2.claude-wake-turn-detected in the server log), without any message.
  5. Read the thread (t3_thread_read) and compare recentRuns[].model with recentRuns[].executedModel.

Expected behavior

The model selection that T3 accepted applies to the next turn, wake turns included. If a wake turn cannot switch the live process, T3 should not record it as running on model B.

Actual behavior

Every wake turn records model: claude-opus-5-5 (B) but reports executedModel: claude-fable-5-2 (A). The live Claude Code process keeps model A, and so does its effort. It goes on that way through every following wake turn until a turn starts from a message. Then openQuery reaches the setModel / applyFlagSettings path and B applies.

In our case one thread ran 18 consecutive wake turns over about 3 hours on model A after switching to B. The thread's model (sidebar, t3_thread_list) showed B the whole time. The first run started by a message then ran on B.

Root cause, in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, openQuery (main at 531c977e5, line ~14210):

// Continuations drain existing output without prompting; retain the live process regardless of selection.
if (
  existing !== null &&
  existing.nativeThreadId === nativeThreadId &&
  !existing.stopping &&
  isClaudeProviderContinuationTurn(turnInput)
) {
  return existing;
}

isClaudeProviderContinuationTurn is message.createdBy === "agent" && message.creationSource === "provider", which is every wake turn that ProviderContinuationService dispatches. That service dispatches with no modelSelection, so the run takes the thread's (new) selection. The early return skips the live-selection update just below, the one that calls live.query.setModel(compiledSelection.apiModelId) when canApplyClaudeSelectionLive allows it.

Possible fixes, in order of preference:

  • In a continuation turn, apply a changed selection to the live query when canApplyClaudeSelectionLive(existing.selection, compiledSelection) holds: same setModel / applyFlagSettings as for a normal turn, still without restarting the process or prompting.
  • Otherwise, record the run with the live process's selection rather than the thread's, and surface that a model change is pending until the next message, so model and executedModel do not silently disagree.

Impact

A model change does not take effect for as long as the thread keeps waking by itself, which can be hours in a thread that orchestrates subagents. In our case a "plan on the expensive model, execute on the cheaper one" switch kept running on the expensive model, which costs about twice as much and has its own weekly limit. Nothing in the UI shows it; only executedModel in the MCP read does.

Workaround: send the thread any message after changing its model.

Version or commit

Observed on 0.1.9. The same early return is in the 0.1.10 binary, in tag v0.1.13 and on main at 531c977e5.

Environment

Linux server, t3 serve (orchestration-v2), Claude provider through the Claude Code CLI (stream-json, --resume). The models are from the steps above. The thread runs full-access in a worktree.

Logs or stack traces

Runs of the affected thread (t3_thread_read, recentRuns, trimmed). Run 3 is where the thread changed its own model mid-turn. Runs 4–21 are all wake turns.

ordinal 1  model claude-fable-5-2  executedModel claude-fable-5-2
ordinal 3  model claude-fable-5-2  executedModel claude-fable-5-2   (configure → claude-opus-5-5 / xhigh during this run)
ordinal 4  model claude-opus-5-5   executedModel claude-fable-5-2   (wake turn)
...        (same for 5–21, all wake turns)
ordinal 21 model claude-opus-5-5   executedModel claude-fable-5-2   (wake turn)
ordinal 22 model claude-opus-5-5   executedModel claude-opus-5-5    (first run started by a message)

Server log for each of runs 2–21: orchestration-v2.claude-wake-turn-detected with the thread's provider session. The live process kept its original argv (--model=claude-fable-5-2 --effort=high), as expected for a warm process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions