fix: detect Claude Code panes using version-string command#14
Conversation
Recent Claude Code releases report the version string (e.g. "2.1.206") as pane_current_command instead of "claude", and set the pane title to the current task summary prefixed with a status glyph rather than "Claude Code". Neither the command nor the title hint matched, so those panes were filtered out as non-agents even though the hooks were still writing state. Add a `command:claude-version` detection signal that fires when the command is a semver-like string and the title has a leading status glyph, corroborating the two matching so arbitrary semver-named processes are not misclassified.
c7234d5 to
8dd7b48
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dd7b4846d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const hasLeadingGlyphTitle = | ||
| title.length > 0 && normalizedLowerTitle.length > 0 && normalizedLowerTitle !== lowerTitle; |
There was a problem hiding this comment.
Restrict leading-glyph matching to Claude status glyphs
This treats any leading non-alphanumeric prefix as a Claude status glyph. In tmux setups that decorate titles with prefixes like [prod] api or # build, a pane running any semver-named command will satisfy this check and then line 199 adds command:claude-version, causing discoverAgentPanesFromList to surface a non-Claude pane as Claude. Restrict this to the known Claude spinner/glyph characters, or require a stronger Claude title hint, to avoid those false positives.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch — fixed in 849cede. Replaced the broad "any leading non-alphanumeric" check with CLAUDE_STATUS_GLYPH_PATTERN, which matches only Claude's actual status glyphs (sparkle/asterisk dingbats U+2720–U+274F, braille spinner frames U+2800–U+28FF, and the idle middle dot). Added negative tests for decorated titles like [prod] api and # build with a semver command to confirm they're no longer surfaced as Claude.
Address PR review: the leading-glyph check treated any non-alphanumeric title prefix as a Claude status glyph, so decorated titles like "[prod] api" or "# build" with a semver-named command could be misclassified as Claude. Match only Claude's actual status glyphs (sparkle/asterisk dingbats U+2720-U+274F, braille spinner frames U+2800-U+28FF, and the idle middle dot) via CLAUDE_STATUS_GLYPH_PATTERN, and add negative tests for decorated titles.
Problem
Claude Code panes stopped showing up in the tmux status output. The hooks were still writing state files correctly, but the pane detector no longer recognized the panes as agents, so they were filtered out.
Recent Claude Code releases changed both signals
detectAgentPanerelied on:pane_current_commandclaude2.1.206pane_titleClaude Code✳ Set up AWS deploymentNeither
matchesCommand(command, "claude")nor theclaude/claude codetitle hint matched, soclaudeReasonsstayed empty and the pane was dropped by thedetection.agent !== nullfilter.Fix
In
src/core/tmux.ts:isClaudeVersionCommand()matching anN.N.Ncommand.hasLeadingGlyphTitle(title begins with a non-alphanumeric status glyph, as Claude's spinner UI does).command:claude-versionreason when the command is a version string and the title has a leading glyph. Gating on the glyph avoids misclassifying arbitrary semver-named processes as Claude.Once a pane is classified as
claude, the existing hook-state matching by pane id lights it up immediately — no hook changes needed.Tests
test/tmux.test.ts:✳ Claude Code+ version-command case.✳ …, braille spinner⠂ …).node repl+2.1.206→ not Claude).Verification
npm run typecheck,npm run lint,npm test(120/120) all pass.coding-agents-tmux listnow shows previously-missing Claude Code panes matched to their hook state.