Skip to content

fix(server): changing Claude effort no longer re-sends the model - #22272

Open
f4llenz wants to merge 3 commits into
pingdotgg:mainfrom
f4llenz:fix/claude-live-model-alias
Open

f4llenz wants to merge 3 commits into
pingdotgg:mainfrom
f4llenz:fix/claude-live-model-alias

Conversation

@f4llenz

@f4llenz f4llenz commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Since #19341, changing only effort, Fast mode or Ultracode on a running Claude thread also sends setModel with the unchanged model. Claude Code then logs a model change every time, as in #1381. It also drops the model a custom binary path chose by rewriting --model, so later turns can run on another model while the composer still shows the original one. Reproduction and logs are in #22265.

Change

The live selection switch in ClaudeAdapterV2 sends setModel only when the resolved model id changes. This is the rule #1466 set for the earlier adapter. If the previous live change failed, it sends the model anyway, because the process's model is then unknown. Flag settings are applied as before.

Scope and approval

Fixes #22265, filed with the investigation and awaiting triage. It also qualifies as a small, focused fix for an obvious bug: one condition in the server adapter restores the rule #1466 set, that setModel is sent only for a model change. No contract, client or other product behavior changes.

Verification

  • Real Claude Code 2.1.303 through the bundled SDK 0.3.276, using control requests only, with no model calls. A launcher script stood in for a custom binary path and rewrote --model claude-opus-5-5 to claude-sonnet-5-5. The values are the applied model and effort reported by get_settings:
    before: launch          {"model":"claude-sonnet-5-5","effort":"high"}
            effort -> xhigh {"model":"claude-opus-5-5","effort":"xhigh"}    setModel + applyFlagSettings
    after:  launch          {"model":"claude-sonnet-5-5","effort":"high"}
            effort -> xhigh {"model":"claude-sonnet-5-5","effort":"xhigh"}  applyFlagSettings only
    
    Effort changes without setModel, and the launcher's model stays.
  • vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts:
    • The existing live-selection test now expects an effort and Fast change to send only applyFlagSettings. It fails on main.
    • A new test fails applyFlagSettings after a model switch, then checks that returning to the first model sends setModel again. It fails without the failed-change check.
    • 342/343 pass. The remaining failure, "moves the root's foreground subagents to the background before a steer (never answers)", times out on main too.
  • Server typecheck is clean. Targeted lint and format are clean. The one lint warning, an unused layer, predates this change.
  • Not checked: a full T3 app run against a live provider.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 20, 2026
The live selection switch sent setModel with the unchanged model on every
effort, Fast mode or Ultracode change. That logged a model change each time
and replaced the model a custom binary path chose by rewriting --model.
Send setModel only for a new model, or after a failed live change.

Closes pingdotgg#22265.
@f4llenz
f4llenz force-pushed the fix/claude-live-model-alias branch from 7f0a871 to 5dc0bb4 Compare October 20, 2026 10:42
@f4llenz
f4llenz marked this pull request as ready for review October 20, 2026 10:47
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5dc0bb4 and 147a119.

Files selected for processing: 2
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

Live Claude query updates now call setModel only when the query identity is empty or the API model changes. Flag settings continue to apply. Tests cover a flag-setting failure and verify that the next turn resends the model and settings.

Changes: Claude live selection

Layer / File(s) Summary
Conditional model update and retry
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
The adapter skips setModel when the query identity is nonempty and the API model is unchanged. Tests update the expected live-selection changes and verify that the next turn resends the model and flag settings after a flag-setting failure.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • pingdotgg/t3code#23931: Changes the condition for applying a selection to a live query, which must be reconciled with this PR’s setModel condition.
  • pingdotgg/t3code#24695: Changes the API model ID used for selections, which affects the value compared by this PR.

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 147a1

Same-model effort and flag changes retain the running process’s model, while a failed update triggers a retry on the next turn. The change is ready to merge after normal checks.

Architecture risk: Low · up to 5dc0b

The change affects 1 system.

Changed systems: apps/server

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — apps/server (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: The wake-harness options add an optional callback using the query session’s applyFlagSettings signature.
  • observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: The live-query stub now invokes the optional injected settings callback after recording the settings; previously it only recorded them.
  • observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: The expected live-selection changes remove the initial Opus model update.
  • observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: The assertion now expects three live-selection changes instead of four.
Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: effort changes no longer re-send the Claude model.
Description check Passed The description includes all required sections. It explains the problem, the implementation, scope and approval basis, focused verification, known test timeout, and unchecked full-app validation.
Linked Issues check Passed The changes satisfy the coding requirements in [#22265]. ClaudeAdapterV2 calls setModel only when the query identity is empty or the resolved API model ID changes. It still calls `applyFlagSetting…
Out of Scope Changes check Passed The pull request changes only ClaudeAdapterV2 and its focused test harness and tests. The test harness change supports failure injection for the linked behavior. No unrelated product, client, contra…
Full details: Linked Issues check

Explanation

The changes satisfy the coding requirements in [#22265]. ClaudeAdapterV2 calls setModel only when the query identity is empty or the resolved API model ID changes. It still calls applyFlagSettings for effort, Fast mode, and Ultracode changes. The empty-identity condition restores the model after a failed live update. The focused tests verify effort and flag changes without a model update and verify model resend after a failed flag update.

Full details: Out of Scope Changes check

Explanation

The pull request changes only ClaudeAdapterV2 and its focused test harness and tests. The test harness change supports failure injection for the linked behavior. No unrelated product, client, contract, or provider behavior changes are present in the reviewed diff.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

maria-rcks commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

thanks @f4llenz. your guard correctly avoids overwriting a launcher-selected model on effort-only changes, and your failure-recovery test protects the partially applied model-switch case.

i kept your commit and both regression cases, merged current main (dd5b5401e1f2), and shortened the comment and made the condition read directly as "unknown or changed model". head: 147a119341b74e1d3d3da093e99b9acab31d6730. the diff remains two server files, with no client or contract changes.

verification:

  • ci: all 28 reported checks are green on this head. the latest bot review has no actionable findings.
  • the focused regression fails against current main because it sends an extra setModel on the flag-only change.
  • blacksmith: all 237 adapter tests pass. vp run check:changed passes format, lint, both knip checks, graphql generation, typecheck and the 237 tests.
  • real claude code 2.1.310 with bundled sdk 0.3.276, control requests only: a launcher rewrites opus to sonnet. main's commands change sonnet/high to opus/xhigh; skipping the redundant model command retains sonnet/xhigh. no model calls were made.
  • two independent gpt-6.1-sol reviews found no issues on this head.

unverified: authenticated turns through a full client, desktop/mobile, and other operating systems. claude authentication is unavailable on this vm. the control probe checks the real cli protocol; the adapter tests check which commands the adapter sends.

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

head 147a119341b74e1d3d3da093e99b9acab31d6730, linux boat vm, playwright 1.60.0 with /usr/bin/google-chrome.

  • installed and ran github/main (9c6429d74b) in /home/user/main, then stopped its captured process group before installing and running the exact pr head. only one dev server ran at a time.
  • created local-folder projects through the actual web ui. real codex gpt-6.1-sol turns completed on main and the pr, returning PR22272_CODEX_OK.
  • on the pr, changed composer reasoning from low to high and sent another real turn. it returned PR22272_FOLLOWUP_OK. both responses and the high selection survived reload.
  • both running clients report claude v2.1.312 as not authenticated. claude auth status reports loggedIn: false; a direct claude prompt exits with Not logged in · Please run /login.
  • ci reports 28 successful checks, zero failing or pending. no source changes, commits or pushes were made.

these codex checks exercise neighboring client/server behavior, not the changed claude adapter. the recording shows the codex effort change and follow-up; an existing cpu-overload toast is also visible. uploaded playback and seeking were checked.

pr web client reports claude authentication unavailable

real codex effort change and follow-up turn

completed codex responses with high effort selected

short command transcript

Not verified

the pr-specific behavior is unverifiable on this vm because claude has no authenticated provider session. i could not reproduce the original bug on main or prove that same-model effort/fast/ultracode changes preserve a launcher-selected model on the pr. actual claude model changes and recovery after failed live controls are also unverified. codex authentication through the local proxy does not provide claude authentication.

no mocks, replay turns, launcher substitutes or control-only probes were used as integration proof. desktop, native ios/android, macos/windows and remote/tunnel connections were not exercised. to complete verification, use an authenticated claude provider and repeat the same live-thread changes on main and this head. passing ci does not resolve this integration gap.

This branch has not been deployed

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Changing Claude effort on a running thread re-sends the model and overrides the model the launch selected

2 participants