Skip to content

fix(tui): keep an early menu move and wait for the selection paint (Refs #791) - #801

Merged
agenteinstinct1-max merged 11 commits into
dev-vibecodedfrom
arena/93f73757-silvercode
Nov 2, 2026
Merged

agenteinstinct1-max merged 11 commits into
dev-vibecodedfrom
arena/93f73757-silvercode

Conversation

@agenteinstinct1-max

@agenteinstinct1-max agenteinstinct1-max commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Fixes #791

This is the successor of #796: it carries that PR's eight commits unchanged (same SHAs, 95c6691 … 6c8fb8e93) plus two follow-up commits and a normal merge of origin/dev-vibecoded at 7d552b480d6878abefd9d0c3fb8863255763abcc, and #796 stays open for its own record. Nothing here is a rewrite of that branch.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The Agent effort menu now spaces its three levels with one blank row each and puts their descriptions in a fixed description column that wraps under itself, so a wrapped description keeps its alignment instead of running back under the level name. The selected row's highlight covers every wrapped line; when a selected row is as tall as the list viewport it is pinned to the top so its last line stays visible. The list is sized to the rows it paints (including on the first paint) instead of to a guess, and maxHeight stays the terminal-height cap. All of this is opt-in on the shared picker: labels, copy, chips, colors, current indicator, footer, effort semantics and every other picker's single-line rows and line math are unchanged.

The first follow-up commit closes one more way a move could be lost. While the dialog is opening it settles the cursor on the stored level on a zero-delay timer; a keyboard move pressed in that window set the cursor and then the settle pulled it back, so a level picked with two quick arrows was never revealed. moveTo now cancels that pending settle, which is the same rule the settle applies to itself when it runs. The selector's reads were also keyed on the ● marker, which belongs to the stored level and is already true when the arrows are pressed, so a read could land between a press and its repaint; navigation now waits for the marked opening frame and the highlight read waits for the selected row's own paint to hold still.

The second follow-up is test-only. It restores selectionPaint's maximum from 900 to 600 passes—the same pump budget as frameWhere, at the same 5 ms spacing. The readiness rule still requires the first painted frame plus two further identical full frames (same >= 2), and no test title, level, or assertion changed.

The base update is a normal merge commit (0690a9c64e2de2ba4b594ad465c4e7b8649d2f9f; parents 3fe6a638093ca5727bdeec2c79c0ae8e2d5fd23a and 7d552b480d6878abefd9d0c3fb8863255763abcc), not a rebase or tree rewrite. It brings in the accepted activity-block spacing update from the new base. That update changed four files, none overlapping this PR's 13 files; the effort menu's optionSpacing={1} layout and the 600-pass readiness rule are unchanged.

Two bounded checks join the suite:

  • A terminal narrower than the title column (20 columns) hides descriptions instead of wrapping them back over the level names: one row per level, one shared column, nothing spliced into a title.
  • An opt-in picker with optionSpacing={2} sizes its panel to the rows it paints, so the rows() spacer accounting is guarded for a spacing other than the effort menu's 1.

How did you verify your code works?

Validation after the normal base merge at head 0690a9c64e2de2ba4b594ad465c4e7b8649d2f9f (parents 3fe6a638093ca5727bdeec2c79c0ae8e2d5fd23a and 7d552b480d6878abefd9d0c3fb8863255763abcc, branch arena/93f73757-silvercode, base dev-vibecoded at 7d552b480d6878abefd9d0c3fb8863255763abcc):

  • Focused: cd packages/tui && bun test --timeout 30000 test/cli/tui/dialog-agent-effort.test.tsx → 38 pass, 1 skip (the opt-in asset capture), 0 fail, 235 expectations.
  • Full TUI suite: cd packages/tui && bun test --timeout 30000 --only-failures → 826 pass, 5 skip, 0 fail, 3,868 expectations; 831 tests across 108 files. The increased totals include the new base's activity-padding tests.
  • History/scope: the merge base with origin/dev-vibecoded is now 7d552b480d6878abefd9d0c3fb8863255763abcc; relative to that base, this PR still changes the same 13 files (+966/−24), with no task/prompt files.
  • Typecheck: all 17 package typecheck targets pass individually with exit 0. They were run one target at a time on this memory-limited sandbox rather than through the aggregate Turbo command; packages/opencode was run under NODE_OPTIONS=--max-old-space-size=3072.

Mechanism evidence from earlier head f64c62199371ca79d05a9aa0dc8b6ef81ca79979 remains separate from runner causality. In a deliberately delayed local harness, the previous marker-keyed wait could observe the pre-move highlight ([13,16,17,18,19,20,21,22,23,24,25,26]) where the settled selected row paints [20,21,22,23]; waiting for the selection paint itself to settle passes with the assertion unchanged. That demonstrates a locally reachable failure mode. It does not establish what happened on any CI runner.

Kilo review on #796: its cap warning is not reproducible at 6c8fb8e93 — the content-sizing test shows the panel is its rows plus chrome in 40- and 80-row terminals, so maxHeight is only a cap; its optionSpacing suggestion is now guarded for spacing 1 and 2; its narrow-terminal suggestion is the bounded 20-column check above rather than an alignment claim.

Captures are real harness output. At f64c62199371ca79d05a9aa0dc8b6ef81ca79979, TUI_CAPTURE_DIR=/tmp/captures bun test … -t "captures the normal, narrow, short and capped layout frames" regenerated four span dumps byte-identical to the committed ones, and script/render-tui-capture.py rendered them with the same captions to four PNGs byte-identical to the committed ones. The 600-pass commit and the later base merge do not change those effort-menu assets. They come from the production dialog stack, not from a screen or a private session.

CI facts, kept separate from any cause claim:

  • Before the base update, at 3fe6a638093ca5727bdeec2c79c0ae8e2d5fd23a, the five CI checks in the PR rollup—check-standards, check-compliance, typecheck, unit (linux), and unit (windows)—were successful. That result belongs to 3fe6a638093ca5727bdeec2c79c0ae8e2d5fd23a only; fresh CI and review are owed for merged head 0690a9c64e2de2ba4b594ad465c4e7b8649d2f9f, and this description does not carry the older green result forward.
  • At earlier head f64c62199371ca79d05a9aa0dc8b6ef81ca79979, run 41377636945 completed its Linux unit job (125061270200) successfully.
  • The Windows unit job (125061270430) in that run failed. Its annotation says: “The action 'Run unit tests' has timed out after 40 minutes.” The two raw failures reported from that job were running task tool preserves metadata when dispatched in the background (5,520 ms) and queued prompt finishing preparation during an in-flight cancel waits for the interrupted assistant to settle (4,002 ms), the latter with timed out waiting for active tool call.
  • Remaining gap: the raw Windows step log was not reachable from my sandbox. Local low-headroom, synthetic-delay, and disabled-model-fetch observations are correlations only; they do not prove the Windows cause and are not presented as doing so. Linux success and file locality are likewise not exoneration of this branch or of the host. The 40-minute job timeout remains unexplained. This PR does not modify the separately owned task/prompt area (fix(session): preserve prompt lineage and finish ownership #790) or raise its 2-second, 5-second, or host budgets.
  • Earlier, Windows unit at 6c8fb8e93 also failed with real test failures: the raw runner log read in the earlier audit showed 43 failing CLI/core/script tests, git exiting 66, and the bun run test process exiting -1073741502 (0xC0000142). Tests did run. That earlier job also has no proven root cause here.
  • GitHub's closingIssuesReferences for this PR currently resolves empty even though the body says Fixes #791. I have not verified why, and this description does not claim a cause for it.

The 600-pass restore and the base merge are validated locally above. Neither the later green CI at 3fe6a638093ca5727bdeec2c79c0ae8e2d5fd23a nor this merge retroactively explains the older Windows failures, and fresh CI/review remain owed at 0690a9c64e2de2ba4b594ad465c4e7b8649d2f9f.

Screenshots / recordings

Sanitized synthetic span captures rendered by the committed renderer — actual harness frames, byte-identical to the committed assets at this head.

Normal · Narrow · Short · Capped 44x20

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Arena Agent and others added 9 commits November 1, 2026 20:43
… a wrapping description column (Refs #791)

Co-authored-by: arena-agent <[email protected]>
The scrollbox painted exactly the height it was capped to, so the
titleColumn path that returned the terminal cap left the panel with 8
blank rows at 120x40, 12 with one level filtered, and 29 at 120x80. The
height now follows the rows the list actually laid out, measured from
the option renderables themselves, and keeps the terminal cap as the
upper bound. Opt-in: only the option set with a titleColumn measures
itself; every other picker keeps the static row math.

Co-authored-by: arena-agent <[email protected]>
…791)

A slow first layout could run the measuring effect before the scrollbox
existed, which left the panel on the static one-row-per-option estimate.
The ref callback now starts a measurement too, and the settle loop waits
for consecutive passes instead of a single read.

Co-authored-by: arena-agent <[email protected]>
…ther pickers exact (Refs #791)

Only an option set with a titleColumn schedules the measurement; every
other picker keeps the untouched height expression and schedules nothing.
The test settle now polls painted text (cheap) and reads the panel
geometry from a single span capture, so a loaded runner no longer spends
its test budget on captures.

Co-authored-by: arena-agent <[email protected]>
… row (Refs #791)

D3: a wrapped row has no line count to size the box from, so any estimate
made before layout clipped the last line until a later pass. The wrapping
layout now lets the scrollbox keep the content's own height with
maxHeight as a real cap (contentOptions minHeight 0), so the panel is
already content-tall on the first paint and the measurement machinery is
gone. Only pickers whose options set a titleColumn get that content
option; every other picker keeps its default sizing.

D2: centering a row as tall as the window pushed its last line out of
view forever (44x20). Such a row is now pinned to the top so all of its
lines stay on screen.

Tests: the geometry suite gains a first-paint assertion that the panel
does not resize after it appears, and a 44x20 test that the four wrapped
lines of the selected Thorough row are all visible; the plain-picker
control now asserts the untouched static height.

Co-authored-by: arena-agent <[email protected]>
…efs #791)

A keyboard move pressed while the dialog is opening was lost: the settle
queued for the current option one tick after it opens ran after the move
and pulled the cursor back, so a wrapped level selected with two quick
arrows never got revealed. moveTo now cancels that pending settle, which
is the same rule the settle itself applies when it runs.

The effort-selector reads were keyed on the `●` marker, which belongs to
the stored level and is already true when the arrows are pressed, so the
span read could land between the press and its repaint. Navigation now
waits for the marked opening frame and the highlight read waits for the
selected row's own paint to hold still. No assertion was relaxed.

Two bounded checks join the suite: a 20-column terminal hides the
description column instead of wrapping it back over the level names, and
an opt-in picker with optionSpacing 2 sizes its panel to the rows it
paints.

Co-authored-by: arena-agent <[email protected]>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kilo-code-bot

kilo-code-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/tui/src/ui/dialog-select.tsx
  • packages/tui/test/cli/tui/dialog-agent-effort.test.tsx

Reviewed by free · Input: 92.2K · Output: 1.5K · Cached: 432.6K

@agenteinstinct1-max
agenteinstinct1-max merged commit 8aa2669 into dev-vibecoded Nov 2, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant