Repository navigation
Backlog
Description
Goal
Establish a release-grade quality baseline for the complete BSH TUI, not just the reported macOS two-finger scroll defect. The TUI must remain a thin client of the standalone Runtime Host and must not change GUI behavior or the Multi-Interface architecture.
"Bug-free" cannot be proven absolutely. The engineering target is zero known P0/P1 defects, deterministic regression coverage for every confirmed defect, and passing platform + PTY + manual acceptance gates.
Current baseline
- TUI implementation:
crates/bsh/src/tui/{app,board,editor,export,menu,mod,nav,picker,prefs,shell,skin,term}.rs. - The largest concentration of state transitions is
app.rs(~21k lines); event acquisition/terminal lifecycle is interm.rs; event loop and rendering dispatch are inmod.rs. - Existing unit coverage is substantial in app/board/editor/menu/nav/picker/prefs/shell/skin/export, but
mod.rshas only a wheel-direction mapping test andterm.rstests do not currently prove fragmented terminal input at the BSH integration boundary. - PR fix(tui): preserve fragmented terminal mouse reports #457 fixed the fragmented Unix SGR input read issue by pinning a Crossterm revision and was merged. Its Ubuntu PTY gate failed before compiling BSH because Zig was missing from
.github/workflows/tui-release-gate.yml. - PR ci(tui): install Zig in PTY release gate #458 adds Zig 0.16.0 setup to that gate; CI must confirm the correction.
Audit workstreams and acceptance
P0 — Input protocol and terminal lifecycle
- SGR mouse reports fragmented at every byte boundary must never become composer text or Escape key events.
- Test rapid vertical trackpad scroll, direction reversal, top/bottom boundary reversal, horizontal wheel reports, resize interleaving, and scroll during live streaming.
- Verify mouse capture, SGR mode, bracketed paste, raw mode, alternate screen, cursor visibility and stderr redirection are restored on normal exit, setup failure, editor handover failure and panic.
- Verify standalone Escape remains responsive and is not confused with a partial CSI/SS3/OSC/DCS sequence.
- Verify keyboard press/repeat/release behavior on macOS, Linux and Windows; Ctrl/Alt/Shift combinations; Unicode; paste; focus/resize events.
P0 — Event loop and responsiveness
- No blocking Host/store/network operation on the UI thread.
- Bound event draining and rendering work; event floods must not starve paint or input.
- Test queued direction reversals, resize floods, input bursts, disconnected event channels and slow Host responses.
- Instrument event-read → dispatch → state update → frame draw latency; define p50/p95/p99 budgets.
P1 — Transcript and history
- Scroll offset remains valid after streaming updates, commits, compaction, resize, width reflow, session switching and older-page loading.
- History page merge preserves message/tool-call relationships and reader viewport anchoring.
- Test concurrent refresh + older-page fetch + session switch; stale replies must never land in the wrong session.
- Test the 512-message held-window limit and repeated attempts at the oldest page.
P1 — Composer, menu and navigation
- Cursor and selection correctness for UTF-8 grapheme clusters, combining marks, emoji/ZWJ sequences and wide characters.
- Multiline editing, word movement, home/end, delete/backspace, history recall, paste and editor round-trip.
- Slash/mention completion, popup clipping, pointer/keyboard parity, stale candidate handling and command argument parsing.
- Keymap conflicts and remapping precedence must be deterministic and visible.
P1 — Shell pane and PTY
- Reader thread termination, child reaping, writer errors, shell exit, resize races and close semantics.
- Verify shell input encoding and paste behavior across Unix PTY and Windows ConPTY.
- Ensure closing TUI or switching sessions does not leave orphan shells or reader threads.
P1 — Rendering and layout
- Narrow/tall terminal sizes, repeated resize, no out-of-bounds cursor, clipping or panic.
- Markdown, long tool output, control characters, ANSI-like/untrusted content, Unicode width and no-color terminals.
- Mouse hit targets must correspond to the exact frame painted; stale hit maps must not trigger actions after resize/state change.
P2 — Export, preferences and recovery
- Export path resolution, atomic replacement, permissions and failure reporting.
- Preference corruption, partial writes, draft persistence and session-key isolation.
- Host restart/disconnect, subscription replay, slow consumer recovery and uncertain send idempotency.
Cross-platform CI
- macOS PTY + TUI tests.
- Linux PTY + TUI tests.
- Windows compile + TUI tests.
cargo fmt --check,cargo clippy -p bsh --all-targets -- -D warnings, relevant unit tests, and deterministic PTY integration tests.- CI must install all native build prerequisites (including Zig for Ghostty) and must run when
Cargo.toml/Cargo.lockor terminal dependencies change.
Execution rules
- Every finding must include severity, reproduction, root cause evidence, affected platforms, fix, regression test and validation result.
- Do not refactor unrelated code while fixing defects.
- Do not merge a fix solely because it compiles; require the relevant regression test and platform gate.
- Keep GUI and Runtime Host contracts unchanged unless a separate ADR explicitly approves a change.
- Manual macOS Ghostty two-finger trackpad acceptance is required; CI cannot fully emulate physical gesture timing.
Initial concrete follow-ups
- Finish CI verification for merged PR fix(tui): preserve fragmented terminal mouse reports #457 and PR ci(tui): install Zig in PTY release gate #458.
- Add deterministic BSH-level terminal input regression tests around fragmented SGR mouse reports.
- Add event-loop tests for bounded draining, direction reversals and boundary clamping.
- Add lifecycle tests for terminal mode restoration and editor handover.
- Audit asynchronous load cancellation/stale response handling and PTY child/reader lifecycle.
- Produce a reviewed defect register with P0/P1/P2 classification before broad refactoring.
Metadata
Metadata
Assignees
Labels
No labels
Activity
gaobrian commentedon Dec 1, 2026
Correction to my earlier 20 ms timeout assessment
I re-checked the upstream reproduction and the merged dependency update more carefully. My earlier statement that the 20 ms deadline necessarily lets a queued continuation leak into Composer was too strong and is not supported by the reader behavior.
The relevant distinction is that the Unix readers use the parser's pending-Escape deadline while also checking for readable input; an available continuation is preferred over expiring the pending Escape. The deterministic regression in openai/codex#60814 covers a continuation queued after the deadline, plus every split position and standalone Escape. The candidate reader change is the use of
buffer_external_input()in both Unix backends.BSH's current pinned revision
37ca4a27a9424ec5dbe6451f48c339d7b45f8d63is the revision selected by merged openai/codex#62139, which advances from the older affected revisioned1cdab.... So we should not treat the 20 ms timeout itself as a confirmed remaining defect, nor add a decoded-character quarantine based on that assumption.What remains unproven is the BSH integration/manual Ghostty trackpad path. The correct next step is to bring the deterministic fragmented-input regression into the exact dependency/backend configuration BSH builds, then reproduce at the BSH PTY/terminal boundary.
gaobrian commentedon Dec 1, 2026
Follow-up: verify the patched Crossterm path at the BSH integration boundary
I re-checked the current
maindependency state:Cargo.tomlpatches crates.io Crossterm toopenai-oss-forks/crosstermrevision37ca4a27a9424ec5dbe6451f48c339d7b45f8d63.term.rs::Terminal::next_keystill returns a decodedKeyCode::Escimmediately and has no BSH-level assertion/test that a fragmented SGR report cannot surface as subsequentKeyCode::Charevents.This changes the next investigation: simply advancing the Crossterm pin again is not evidence-based. We need a deterministic BSH integration regression that drives fragmented SGR bytes through the exact event source used by
Terminal::next_key(both Unix backends where feasible), and asserts:The existing PR #458 release-gate run
46572027560is still building on macOS, Linux and Windows at the time of this note; it has not yet passed. This follow-up is intentionally a test-first investigation, not a claim that the reported trackpad issue is fixed.gaobrian commentedon Dec 1, 2026
CI result and Linux gate follow-up
The completed TUI release-gate run 46572027560 reports:
-lc++and-lxkbcommon-x11.I opened PR #460 to install the missing Ubuntu development packages (
libc++-devandlibxkbcommon-x11-dev) in the TUI release-gate workflow. This is a CI environment correction, not a runtime scroll fix.The macOS CI gate passing is useful, but it does not emulate physical two-finger trackpad timing in Ghostty. Manual acceptance and a deterministic dependency-level regression remain required before closing the original report.
gaobrian commentedon Dec 1, 2026
BSH PTY regression added — PR #461
I have added an integration test to the existing Unix PTY release gate:
This exercises the real BSH process and Crossterm reader, not a mocked key queue. It is intentionally test-first: no runtime filtering or speculative Crossterm changes were added.
PR: #461
CI is running. Passing this gate will validate the PTY integration path, but physical two-finger trackpad acceptance in Ghostty remains a separate manual check.