Skip to content

Fixed session becoming permanently unresponsive on git branch names with dots - #157

Merged
oleg68 merged 1 commit into
nbplugins:mainfrom
oleg68:bugfix/session-stuck-dotted-branch-name
Jun 27, 2026
Merged

oleg68 merged 1 commit into
nbplugins:mainfrom
oleg68:bugfix/session-stuck-dotted-branch-name

Conversation

@oleg68

@oleg68 oleg68 commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Session was permanently stuck in WORKING state when the working directory was on a git branch whose name contains dots (e.g. refactor-menu-reorder-e9.5-e9.8)
  • Claude Code embeds the branch name in the input-box top border (──── refactor-menu-reorder-e9.5-e9.8 ──); detectSessionState() failed to recognize this as a separator, mis-classified the idle screen as WORKING, and the screen-sync kept forcing READY→WORKING every 500 ms
  • Also fixed a second stuck-in-WORKING path on --continue/--resume sessions: model discovery was fired immediately when ❯ appeared on screen even while Claude was actively working ("esc to interrupt"), sending /model to a busy Claude that timed out and left the session unresponsive

Root cause

isSeparatorLine() requires the line to be made entirely of box-drawing dashes. PLAN_NAME_DASHES_PATTERN only allows [\w][\w\-]* in the label — dots/slashes cause no-match. With neither matching, detectSessionState() fell through to return WORKING.

Fix

  • Added isSeparatorLineWithLabel(): accepts any label text as long as the line starts/ends with box-drawing dashes and dashes make up ≥50% of the characters
  • Wired into both separatorAbove and separatorBelow checks in detectSessionState()
  • Added detectSessionState(lines) != WORKING guard to the model discovery condition in pollScreenState()

Test plan

  • mvn test -Dtest=ScreenContentDetectorTest — new fixture ready-named-separator-above-dotted-branch passes (previously failed with expected READY but was WORKING)
  • mvn test -Dtest=ClaudeSessionControllerTest — two new tests verify model discovery is deferred while screen shows WORKING
  • Manual: open a project on a branch with dots in the name, start Claude session, verify input becomes active after Claude finishes

🤖 Generated with Claude Code

When the working git branch name contains dots (e.g. refactor-menu-reorder-e9.5-e9.8),
Claude Code embeds it in the input-box top border:
  "──────── refactor-menu-reorder-e9.5-e9.8 ──"

ScreenContentDetector.detectSessionState() classifies the prompt area as found
only when the line above ❯ matches isSeparatorLine() (pure dashes) or
PLAN_NAME_DASHES_PATTERN (label group [\w][\w\-]* — no dots). With neither
matching, the screen was mis-classified as WORKING → the session was stuck in
WORKING state forever via the bidirectional READY↔WORKING sync.

Fix: added isSeparatorLineWithLabel() that accepts any label text as long as
the line starts/ends with box-drawing dashes and dashes make up ≥50% of its
characters. Wired into both separatorAbove and separatorBelow checks.

Also guarded model discovery against firing while the screen shows "esc to
interrupt", preventing a second stuck-in-WORKING path on --continue sessions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@oleg68
oleg68 merged commit 0ff226c into nbplugins:main Jun 27, 2026
3 checks passed
@oleg68
oleg68 deleted the bugfix/session-stuck-dotted-branch-name branch June 27, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant