Skip to content

fix(server): Claude follow-ups no longer fail in Auto on models without Auto - #15687

Open
Gigioxx wants to merge 2 commits into
pingdotgg:mainfrom
Gigioxx:t3code/fix-issue-15650
Open

Gigioxx wants to merge 2 commits into
pingdotgg:mainfrom
Gigioxx:t3code/fix-issue-15650

Conversation

@Gigioxx

@Gigioxx Gigioxx commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A Claude thread in Auto on a model that does not support Auto (Haiku 4.5, also Sonnet 4.5, Opus 4.5) fails on every follow-up that reuses the live CLI process with "The provider could not start this turn". This is how delegated Haiku children that inherit Auto break (#15650), and a Haiku thread set to Auto by hand fails the same way.

The CLI does not reject Auto at open. It silently starts in Manual and reports permissionMode: "default" on its init frame, so the first turn works. Since #15224, a reused process is put back in the mode it was opened with when the reported mode differs, which here sends setPermissionMode("auto"). The CLI rejects that with Cannot set permission mode to auto: auto mode unavailable for this model.

Change

The mode a reused process is restored to is now the mode the CLI reported on its first init frame, not the mode T3 requested. Later init and status frames still track Claude's own mode changes (EnterPlanMode), so the #15224 plan-mode restore is unchanged. Models that support Auto report auto on init, so nothing changes for them.

Scope and approval

Fixes #15650, a triaged bug confirmed on main by the maintainer triage comment. One underlying problem in ClaudeAdapterV2.openQuery. The other directions from the triage comment (hiding Auto per model in the composer and delegate_task, naming the rejected mode in the error) are separate changes and are not included.

Verification

  • Claude CLI 2.1.289, driven by the Agent SDK with permissionMode: "auto":
    • Haiku 4.5: init reports default, and setPermissionMode("auto") fails with auto mode unavailable for this model.
    • Sonnet 5.5: init reports auto, and setPermissionMode("auto") succeeds.
  • New regression test in ClaudeAdapterV2.test.ts: Auto falls back to default on init, and the follow-up must reuse the process without calling setPermissionMode. Before the fix it failed with expected [ 'auto' ] to deeply equal []. The plan-mode restore test now also sends the init frame, so it still covers restoring to the init mode after EnterPlanMode.
  • After merging current main: ./node_modules/.bin/vp test run apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: 232 passed. Server typecheck, scoped lint, and formatting pass. The conflict resolution keeps SDK message locking and updates the regression test for the new MCP service layer and namespaced runtime policy.
  • Earlier verification: Claude orchestration-v2 testkit suites passed (207 tests).
  • Manual check against an isolated dev server (worktree .t3 state), Haiku 4.5 thread in Auto: the turn that opened the process reported auto requested and default on init. The next follow-up on the same process completed (THIRD WORKS) where it used to fail.

Not checked: the full delegate_task parent and child flow end to end. It reaches the same openQuery reuse path covered above.

Done with Claude Opus 5.5 in Claude Code (T3 Code). The implementation was delegated to GPT-6-Astra in Codex, and the Codex review found no issues.

Maintenance: GPT-6-Astra via the Codex harness in T3 Code.

…ut Auto

Restore the permission mode the CLI reported on its first init frame instead of the requested mode. Claude Code falls back from Auto on models that lack it (Haiku 4.5), so restoring the requested mode called setPermissionMode("auto") and the CLI rejected it.

Fixes pingdotgg#15650

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 4, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 4, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at f929b71

Macroscope's review found this PR approvable — This focused server bug fix records Claude’s effective initial permission mode so follow-ups do not retry an unsupported Auto mode. The behavior is covered by a regression test, with existing supported-model and plan-mode paths preserved.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a3544b4-8d75-4b4e-96d0-1d6374eaea97

📥 Commits

Reviewing files that changed from the base of the PR and between fcd3ad6 and f929b71.


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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4760a3a9-dc9f-48e0-8d8c-aeb1bcaf3532


📥 Commits

Reviewing files that changed from the base of the PR and between 4ee6bfd and fcd3ad6.



📒 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
📝 Walkthrough

Walkthrough

The Claude adapter now records the permission mode reported by its first SDK init frame, or retains the query option when the frame omits a mode. Tests cover auto-mode query reuse and init frames in the plan lifecycle.

Changes

Claude permission-mode initialization

Layer / File(s) Summary
Track the initial permission mode
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
The adapter records the first init frame’s permission mode, falling back to the query option when none is reported. Tests cover auto-mode query reuse without a permission-mode change and add init frames to plan-lifecycle test inputs.

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 fcd3a

This fixes the failed follow-up to a reused Claude process when the CLI starts in default mode instead of the requested auto mode. No merge-blocking risk remains. The full delegate_task parent-and-child flow was not checked end to end.

Security Architecture Review

Security architecture risk: 🔵 Low · up to fcd3a

The change remembers the permission mode actually used by a running session without changing permission-policy configuration or approval handling. No introduced permission bypass was established, but interruption, recovery, and overlapping-start behavior remain only partially verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The permission snapshot belongs to one live CLI query. Normal reuse checks native-thread identity, effective-policy identity, and selection identity. Existing background work is process-owned and can block replacement.

Trust Boundaries and Controls

  • observed — Provider initialization data now supplies the restoration baseline. Runtime policy and existing launch settings still construct query permissions, tool restrictions, and bypass options; the changed initialization handling does not reconstruct those controls.
  • observed — The existing tool-permission callback denies requests when there is no active turn and determines approval requirements from that turn’s runtime policy, not from the newly recorded opening-mode field.

Resilience and Maintainability Implications

  • observed — Successful opens create fresh permission snapshots. Stream termination and interruption cleanup check query identity before clearing the live-query reference, while close-timeout cleanup preserves a replacement query’s reference. These static safeguards support state ownership, but overlapping-start and interrupted-recovery ordering remain partially verified.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Issue #15650 requires a follow-up to work when a Claude process starts in default after T3 requested auto. ClaudeAdapterV2.ts records the first init frame’s permission mode and uses it as the mo…
Out of Scope Changes check Passed The source change and regression coverage in ClaudeAdapterV2.ts and ClaudeAdapterV2.test.ts directly address issue #15650. The added init frames in the plan-mode test preserve coverage of the exis…
Title check Passed The title clearly and concisely describes the fix for Claude follow-ups in Auto mode when the model does not support Auto.
Description check Passed The description includes the problem, expected behavior, root cause, implementation details, scope and approval, focused verification results, manual validation, and untested areas. It is complete and…



✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR



  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 11, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 11, 2026 06:06

Dismissing prior approval to re-evaluate fcd3ad6

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 11, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 12, 2026 02:42

Dismissing prior approval to re-evaluate f929b71

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

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:S 10-29 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]: Follow-up to a finished delegated Claude subagent fails with set_permission_mode control_request_failed when runtime mode is auto

2 participants