fix(cli): wrap AskUserQuestion options instead of truncating at terminal width (#4610) - #4615
Conversation
hqhq1025
left a comment
There was a problem hiding this comment.
Found one correctness issue in the resize path.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
…nal width (apache#4610) Long option rows were hard-cut at the overlay width with no wrap, no ellipsis, and no way to read the tail — users had to answer protocol compatibility questions from half a sentence. Wrap option rows (and the question title) with pi-tui's ANSI-aware wrapTextWithAnsi: continuation lines indent under the option body, and the active row's highlight band covers every wrapped line. The overlay's row budget reads terminal.rows live, and the bottom-picker overlay cap is now '100%' instead of a rows value frozen at open time: pi-tui re-resolves it against the live terminal height on every composite, so a question opened on a short terminal still shows its wrapped options, input row, and divider after the terminal grows (review on apache#4615). Generated-by: Maka (AI agent)
852dc4a to
f00cdc5
Compare
M4n5ter
left a comment
There was a problem hiding this comment.
Reviewed exact head f00cdc58e2620137bda32939ae1cc0f6346aa55a.
The resize defect is closed. The bottom overlay now uses a percentage cap that the compositor resolves against the current terminal height, while the question surface reads its row budget on every render. The small-to-large terminal regression exercises the previously failing path and preserves both the free-text row and the full option text after growth.
I found no blocking or non-blocking correctness findings on this head. The exact-head test check is green and the current-main merge result is clean.
Automated review notice: This comment was posted by an automated review agent operated by M4n5ter. It is not an independent human review and does not replace one.
…nal width (apache#4610) (apache#4615) Long option rows were hard-cut at the overlay width with no wrap, no ellipsis, and no way to read the tail — users had to answer protocol compatibility questions from half a sentence. Wrap option rows (and the question title) with pi-tui's ANSI-aware wrapTextWithAnsi: continuation lines indent under the option body, and the active row's highlight band covers every wrapped line. The overlay's row budget reads terminal.rows live, and the bottom-picker overlay cap is now '100%' instead of a rows value frozen at open time: pi-tui re-resolves it against the live terminal height on every composite, so a question opened on a short terminal still shows its wrapped options, input row, and divider after the terminal grows (review on apache#4615). Generated-by: Maka (AI agent) Generated-by: GLM-5.3-Flash (ZCode)
Summary
When the agent asks a question via
AskUserQuestion, option rows were hard-truncated at the terminal width — no wrap, no ellipsis, no way to read the tail. Users had to pick between protocol-compatibility strategies from half a sentence (see the issue screenshot).UserQuestionOverlaynow wraps option rows (and the question title) with pi-tui's ANSI-awarewrapTextWithAnsi: continuation lines indent under the option body, and the active row's highlight band covers every wrapped line. Because wrapping can outgrow the overlay'smaxHeight— pi-tui clips overflow from the bottom, which would silently drop the free-text input row — the runner passes a live row budget (terminal.rows - margin, re-read per render so resize stays correct) and the overlay degrades gracefully when over budget: title capped at two lines, each option clamped to an equal share with a visible…, so the hint, every option, the input row, and the divider always render.Fixes #4610
Verification
packages/clifull suite: 757 tests, 0 fail — including 9 new tests inpi-tui-user-question-option.test.ts(CJK wrap content preservation, continuation indent, full-band highlight via exactansi.reverseequality so it is color-level independent, SGR re-open across wrap points, ellipsis clamp, andrender()-level budget assembly) and the 175 pre-existingpi-tui-runner.test.tsscreen tests.tsc -p packages/cli/tsconfig.jsonclean;biome checkclean on changed files.Review focus
Two rounds of adversarial sub-agent review were run against this diff. First pass found the missing height budget (major) and colorless-CI-vacuous assertions (minor), both fixed. Second pass found the title-cap ellipsis was dead code on already-padded lines (fixed via
clampRowsWithEllipsis) and confirmed the remaining edge: a terminal too short for one row per option still overflows and falls back to the pre-existing pi-tui clip — never worse than before.AI use
Tool(s) and scope: Maka (AI agent) authored the full change: issue triage, design, implementation, tests, and two adversarial review rounds (also AI, with human-supervised fixes).
Checklist
Does this PR entail a change in behavior?