Skip to content

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

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

f4llenz wants to merge 1 commit 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
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8aa92e95-3274-43f8-bd7e-55a3783eb672
📥 Commits

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

📒 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; 9 remain after this review.

📝 Walkthrough

Live Claude query reuse now calls setModel only when the API model changes or the query identity is empty. It still applies flag settings. Tests cover a failed flag update and the model and settings being sent again on the next turn.

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 known and the API model is unchanged. The 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

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 5dc0b

No concrete merge-blocking issue is established. The live-provider behavior remains unverified, but the reviewed change is mergeable 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 resend the Claude model.
Description check Passed The description covers the problem, implementation, scope and approval rationale, focused verification results, known test limitation, and unverified full-app run.
Linked Issues check Passed The changes satisfy the coding requirements in [#22265]. ClaudeAdapterV2 skips setModel when the live query has a known identity and the resolved API model ID is unchanged. It still applies flag s…
Out of Scope Changes check Passed The pull request changes only the Claude adapter logic and its focused tests. The test harness extension supports failure injection for the linked behavior. No unrelated product, client, contract, or …
Full details: Linked Issues check

Explanation

The changes satisfy the coding requirements in [#22265]. ClaudeAdapterV2 skips setModel when the live query has a known identity and the resolved API model ID is unchanged. It still applies flag settings, which covers effort, Fast mode, and Ultracode changes. A changed model ID still calls setModel. The new test verifies that a failed live flag update causes the next model change to resend setModel. The updated live-selection test verifies that an effort and Fast mode change no longer records a model update.

Full details: Out of Scope Changes check

Explanation

The pull request changes only the Claude adapter logic and its focused tests. The test harness extension supports failure injection for the linked behavior. No unrelated product, client, contract, or provider behavior changes are shown.

✨ 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.

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

1 participant