fix(tmux): restrict 'esc to interrupt' busy detection to status bar lines#451
Open
nlenepveu wants to merge 1 commit intoasheshgoplani:mainfrom
Open
Conversation
…ines Sessions with prose output containing 'esc to interrupt' (e.g. a conductor reporting 'I is processing (esc to interrupt = running)') were incorrectly detected as busy/running. The interrupt phrase always appears in the last 1-2 lines of the pane (the Claude Code status bar), never in body output. Limit the interrupt-pattern context check to the last 3 lines of the pane instead of the full 25-line window, preventing false positives from model-generated text that happens to contain the phrase. Adds 5 regression tests: 3 true positives (real status bar variants) and 2 false positives (conductor prose output with parenthesised phrase).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Sessions were incorrectly detected as
running(busy) when their pane output contained the phraseesc to interruptanywhere in the body text — not just in Claude Code's actual status bar.A concrete example: a conductor session that had finished responding and was waiting at the
❯prompt showed asrunningbecause its own output included a line like:This caused the heartbeat to skip the conductor (only sends when status is
idleorwaiting), so heartbeats silently stopped firing.Root Cause
hasBusyIndicatorResolvedchecked for"esc to interrupt"across the last 25 lines of pane content, so prose far above the status bar could trigger the pattern.Fix
Claude Code's status bar always lives below the last horizontal separator (
────). The layout is:Two new helpers scope the check to the right region:
isHorizontalSeparator(line)— matches lines made entirely of U+2500 box-drawing dashes (─), 8+ runes wide. ASCII hyphens are intentionally excluded (they appear in prose/markdown).linesAfterLastSeparator(content)— finds the last separator and returns everything below it. If the separator is the final line (idle pane), returns lines between the last two separators. Falls back tolastNLines(content, 3)when no separator is present.The
hasInterruptBusyContextcall now receiveslinesAfterLastSeparator(content)instead oflastNLines(content, 3), making the boundary structural rather than a fixed line count. This is robust even when the status bar wraps onto 2–3 lines on narrow panes.Tests
TestEscToInterruptOnlyMatchedInStatusBar— 5 cases covering real status bar variants (busy) and conductor prose output (not busy)TestLinesAfterLastSeparator— 4 unit tests for the new helper: standard layout, separator-as-last-line, no separator fallback, trailing blank line strippingTestEscToInterruptSeparatorBased— 2 end-to-end cases using the exact pane layout reported in the bug, verified viahasBusyIndicator