Include claude attach in claude_builtin_command_name - #10117
Conversation
…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>
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>
|
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 (2)
📝 WalkthroughWalkthroughThe change adds regression coverage for hidden ChangesClaude attach passthrough
Estimated code review effort: 1 (Trivial) | ~5 minutes Mergeability Score: ⚪ Minimal · up to The PR makes the hidden attach command bypass wrapper-only session setup and adds regression coverage; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
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 |
claude attach in claude_builtin_command_name
|
small fix @lawrencecchen PTAL, ty! |
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.Supersedes #10115 (same change, reopened from the right account).
🤖 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 attaches work inside cmux surfaces. Previously the wrapper injected--session-id/--settings, the CLI treated "attach" as the prompt, and created a new session; now argv is forwarded unchanged and no hook orNODE_OPTIONSinjection occurs.Review notes
attachto the builtin command list inclaude_builtin_command_name, matching other pass-through subcommands.test_hidden_attach_subcommand_bypasses_hook_injectionto assert raw argv and absence of injected flags.attachbecause they run in the existing background writer process.Written for commit 8157248. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
claude attach <id>command so it runs without unintended hook settings, session identifiers, orNODE_OPTIONSchanges.Tests