Repository navigation
fix(server): Claude Auto asks before commands Claude escalates - #40692
juliusmarminge wants to merge 2 commits into
Conversation
Repro for #15353. In Auto, the Claude adapter's canUseTool answers allow for requests Claude forwards for a person's decision (ask rules, ask hooks, classifier fallback). Auto-accept edits is the passing control. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In Auto, Claude forwards requests it wants a person to decide (ask rules, ask hooks, classifier fallback) to canUseTool, but the v2 adapter answered allow without prompting. Treat Auto like Full access: forwarded requests now become approval requests. Fixes #15353 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
The automated pipeline stopped on this pull request and will not merge it: the fix is written and reviewed, but proving it needs something no worker has:
It stays open for a person to finish or close. |
…g#36216, pingdotgg#23428 - pingdotgg#40692: Claude Auto mode asks before commands Claude escalates instead of silently allowing them (pingdotgg#15353). - pingdotgg#36216: the Claude task-output tail ignores ids that are not one path segment. - pingdotgg#23428: Codex shadow homes keep auth-like files private to each home. Temporary until each merges upstream. Claude Opus 5.5 in Claude Code
|
One thing this PR makes reachable in Auto: when the SDK sends no permission suggestions, Closed [#15360](#15360) handled it by returning no rules for Bash and Monitor in that case, so the approval only covers the current command: |
TonybynMp4
left a comment
There was a problem hiding this comment.
Tested this against a real Claude turn and it fixes #15353.
Setup: a scratch git repo with .claude/settings.json containing {"permissions": {"ask": ["Bash(touch:*)"]}}, a dev server on this branch (52ecae9), Claude Haiku 5.5 with the thread set to Auto, and the prompt "Run exactly this Bash command and nothing else: touch marker.txt".
| Before (fix reverted) | After (this PR) |
|---|---|
![]() |
![]() |
Claude ran touch without asking and marker.txt appeared. |
The command waited for approval and marker.txt stayed missing. Approve ran it. |
I restored the fix after the before run, deleted marker.txt and sent the prompt again. It asked again, and Decline left the file missing. So the before run didn't skip the prompt because of my earlier Approve.
Unit tests agree. All 475 cases in ClaudeAdapterV2.test.ts pass on this branch. With only ClaudeAdapterV2.ts reverted, the auto case fails with the command ran without asking: expected 'decision' to equal 'request', and the auto-accept-edits control passes either way.


In Auto mode, when Claude decided a tool call needed a person's approval (a
permissions.askrule, a PreToolUse hook returningask, or the classifier's fallback after repeated blocks), T3 Code approved it immediately without prompting, and Claude's transcript recorded it as a user approval. Auto now treats these escalated requests the same way Full access already does: T3 Code shows an approval request and waits for the user.Fixes #15353
Reproduction on main
Commit f9b19a7 (origin/main). Scratch git repo whose origin is a local bare repo, with one unpushed commit; project .claude/settings.json = {"permissions":{"ask":["Bash(git push:*)"]}}. Isolated dev server (T3CODE_DEV_SEED=0 vp run dev) with defaultRuntimeMode "auto" in the worktree's settings; project added with
t3 project add, thread started witht3 thread start --provider claudeAgent --model claude-haiku-5-5asking it to rungit push origin mainonce. Observed in the web client: the thread completed and showed only the push output (ca35990..c0c91d7 main -> main); no approval request appeared, and the bare remote received the commit. The stored thread has runtimeMode "auto"; Claude's session transcript shows permissionMode "auto" and the Bash tool_result records permissionDecision {"decision":"accept","source":"user_temporary","ruleSource":"projectSettings","reasonCode":"rule:projectSettings"}, i.e. Claude matched the ask rule, forwarded it to canUseTool, and T3 auto-allowed it as if the user approved. Adapter test on branch factory/repro-15353: theautocase fails with 'the command ran without asking: expected decision to equal request'; theauto-accept-editscontrol passes.Evidence
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests
vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts(apps/server): 475 passedvp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts -t escalateson base without the fix:autocase fails as reported,auto-accept-editscontrol passesvp run check:changed: format, lint, knip, typecheck (3 packages), tests (2 files, 477) all passNot in this change
Who did the work
Run by the t3code factory in T3 Code.