Include claude attach in claude_builtin_command_names - #10115
Include claude attach in claude_builtin_command_names#10115steve-wisdom wants to merge 2 commits into
claude attach in claude_builtin_command_names#10115Conversation
…k injection `claude attach <id>` (the attach door for --bg background sessions) is a real subcommand but hidden from `claude --help`, so it's missing from the wrapper's builtin-command list. The wrapper classifies it as a session entrypoint and injects --session-id/--settings ahead of it, which makes the real CLI treat "attach" as the [prompt] positional: instead of attaching, it mints a brand-new session with "attach" pre-filled in the composer. Test-only commit (two-commit regression policy): CI should go red here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Claude wrapper now recognizes ChangesClaude attach command handling
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This narrowly changes Suggested reviewers: 🚥 Pre-merge checks | ✅ 25✅ Passed checks (25 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add `attach` to claude_builtin_command_name so the wrapper classifies `claude attach <id>` as a command invocation and execs the real CLI with argv untouched, like agents/mcp/etc. Hook settings are meaningless for attach anyway: hooks live in the already-running background writer process, and the injected fresh --session-id is exactly what turned an attach into a new session. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bddca3f to
97cbc20
Compare
claude attach to claude_builtin_command_names
claude attach to claude_builtin_command_namesclaude attach in claude_builtin_command_names
|
Superseded by #10117 — reopened from my personal account. |
Problem
claude attach <id>is a real Claude Code subcommand — the attach door printed for--bgbackground sessions — but it's hidden fromclaude --help, so it never made it intoclaude_builtin_command_nameincmux-claude-wrapper. Inside a cmux surface the wrapper therefore classifies it as a session entrypoint and execs the real CLI as:The CLI eats the injected flags and reads
attachas the[prompt]positional: instead of attaching to the running background session, it mints a brand-new session with "attach" pre-filled in the composer.Repro (any cmux surface, Claude Code ≥ 2.1.x):
claude attach <any-id>→ new session with "attach" in the prompt box, instead ofNo job matching '<any-id>'/ attaching.Fix
Add
attachto the builtin-command list so it passes through untouched, likeagents/mcp/etc. Hook injection is meaningless for attach anyway — hooks live in the already-running background writer process, and a fresh--session-idon an attach invocation is exactly the bug.Two-commit structure per the regression-test policy: commit 1 adds the failing test (
test_hidden_attach_subcommand_bypasses_hook_injectionintests/test_claude_wrapper_hooks.py), commit 2 the one-word fix. Full wrapper suite passes locally.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Passes the hidden
claude attach <id>subcommand through thecmux-claude-wrapperso attach works again in cmux surfaces. Previously the wrapper injected--session-id/--settings(andNODE_OPTIONS), so the CLI treatedattachas the prompt and started a new session; now it receivesattach <id>untouched and attaches (or errors) as expected.attachto builtin command detection inclaude_builtin_command_name, preventing--session-id,--settings, andNODE_OPTIONSinjection.test_hidden_attach_subcommand_bypasses_hook_injection.Resources/bin/cmux-claude-wrapper; no changes to other subcommands or hook behavior.claude attach <id>invocations in cmux surfaces.Written for commit 97cbc20. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
claude attachcommand so it opens an existing session without being treated as a new prompt.Tests