Repository navigation
fix(claude): keep a numbered list above a question from hiding its card - #170
Luke-Norland wants to merge 1 commit into
Conversation
The Claude question parser scanned up to 64 lines above the "Enter to select" hint and required every numbered row in that window to run 1..N. When the assistant's reply above the question ended in a numbered list, those items were read as rows too (37., 38., ... ahead of the real 1.), the check failed, and a short question that fits the screen got no card. Take only the current run of rows: the contiguous run that ends at the last row above the hint and counts back down to 1. Numbered lines above that 1. are ignored. The question text and the answer path are unchanged. The transcript-ask parser already finds the real rows: it slides a window that must number 1..N, match the transcript's labels in order and end in "Type something." and "Chat about this", so a list above the frame cannot complete a match. A test pins that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughClaude question parsing now isolates the final consecutive numbered option run. Regression tests use captured prompts with numbered lists above question cards. ChangesClaude question parsing
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change has no identified issue that needs resolution before merge; complete normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (8 skipped: 8 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Bug
parseClaudeQuestionintmux-interactive-prompt.service.tsscans up to 64 lines above theEnter to select · ↑/↓ to navigate · Esc to cancelhint withparseNumberedRows, andsequentialRowsthen requires every numbered row it found to run1..N.When the assistant's reply just above the question ends in a numbered list, the list's items fall inside that window and are read as rows too:
37.,38.,39.,40.ahead of the question's real1.–4.. The sequence check fails, the parser returnsnull, and the chat gets no card for a short question that fits the screen. The user has to answer in the terminal.The hardest case is a list numbered
1.–3.directly above the question frame, whose numbers do start at 1.Reproduce
AskUserQuestiononce with a short single-select question (three options).POST /api/providers/sessions/external/interactivefor the pane.On
mainthe response is{"prompt":null}while the question is on screen. This happens on both Claude renderers (default and fullscreen).Fix
The card now takes only the current run of rows: the contiguous run that ends at the last row above the hint (
Chat about this) and counts back down to1.. Numbered lines above that1.are ignored (currentClaudeRun). The question text is read as before, and the answer path is unchanged.Transcript-ask path
parseClaudeAskSelectionScreenintmux-ask-selection.service.tsalso scans 64 lines above the hint, but it is not affected. It slides a window over the numbered rows that must number1..N, match the transcript's own labels in order, and end inType something.andChat about this, with the question text visible above it. A list above the frame cannot complete such a window, so the real rows are still found. Even a1.–3.list that repeats the option labels fails the numbering at the frame's own1.. No code change there; a test pins it.Tests
New
server/modules/providers/tests/claude-question-numbered-list.test.ts, with fixtures captured from a real Claude Code TUI in a 78x73 pane (scratch paths replaced with neutral ones of the same length):s1(fullscreen),s2,list40(default): a 40-item list above the question. The card returns the real question and options, throughgetTmuxInteractivePrompton the-S -80capture and on the visible screen alone.list3: a 40-item list in scrollback and a 3-item list numbered1.–3.directly above the frame.1.–3.list repeating the option labels directly above the frame, with and without the divider.mainclaude-question-numbered-list.test.tsnull)tmux-interactive-prompt.service.test.tstmux-ask-selection.service.test.tsThe two tests that pass on
mainare the no-list control and the transcript-ask test, which pin behaviour that should not change. Restoring the unbounded scan turns the five list tests red. Restricting the transcript parser to the first rows in its window turns the transcript-ask test red.npm run typecheckandeslinton the touched files are clean.End to end
Real Claude Code 2.1.291 in a private tmux server, 78x73, and a dev server from this branch. The assistant wrote a 40-item numbered list of tmux tips, then asked "Which fruit for the picnic?" (Apple, Banana, Cherry). The card was read and answered through
POST /api/providers/sessions/external/interactiveand/respond. Each run used a fresh conversation in a fresh pane.maintool_resultprompt: null"Which fruit for the picnic?"="Banana"prompt: null"Which fruit for the picnic?"="Cherry"Both answers returned
200 {"action":"selected"}.🤖 Generated with Claude Code
Summary by CodeRabbit