Skip to content

claude wrapper treats attach, logs, stop, rm, respawn as prompts instead of subcommands #12284

Description

@mtnjwr

Summary

cmux-claude-wrapper allowlists Claude Code subcommands in claude_builtin_command_name():

agents|auth|auto-mode|config|api-key|daemon|doctor|install|mcp|
experimental-next|plugin|plugins|project|rc|remote-control|setup-token|
ultrareview|update|upgrade

Claude Code 2.1.267 also ships these subcommands, none of which are on the list:

  • attach <id>
  • logs <id>
  • stop|kill <id>
  • rm <id>
  • respawn [id]
  • gateway
  • import

Because they miss the allowlist, should_inject_claude_hooks returns 0, the wrapper injects a fresh --session-id plus its hooks, and the real binary receives the subcommand as a prompt.

Repro

Inside a cmux terminal, with a background session running:

claude --bg            # prints e.g. 8b4d264b
claude attach 8b4d264b

Expected: the background session opens in this terminal.

Actual: a brand-new interactive session starts, with the opening prompt attach 8b4d264b. The background session is never touched.

Workaround

Bypass the shim by calling the binary directly:

~/.local/bin/claude attach 8b4d264b

This works as expected, which confirms the wrapper is the only thing in the way.

Suggested fix

Add attach|logs|stop|kill|rm|respawn|gateway|import to claude_builtin_command_name() so they take the exec_real_claude_passthrough path, same as agents does today.

Related: #4005 (same class of problem for claude agents).

Environment

  • cmux /Applications/cmux.app, wrapper at Contents/Resources/bin/cmux-claude-wrapper
  • Claude Code 2.1.267, arm64 native binary at ~/.local/bin/claude
  • macOS (Darwin 25.5.0), zsh

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions