Repository navigation
fix(tui): route picker cancellation through shared input - #133151
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 2, 2026, 6:20 PM ET / 22:20 UTC. ClawSweeper reviewWhat this changesRoutes model, agent, context, and session picker cancellation through Pi TUI’s shared Input component, adds modern Ctrl+C PTY coverage, and documents picker behavior. Merge readiness⛔ Blocked before merge - 2 items remain This PR remains necessary: current main still handles picker cancellation only as Escape or raw ETX. The proposed owner-boundary refactor is coherent and covered by component and native-PTY paths; merge should wait for direct verification of the locked Pi TUI callback contract, which this read-only checkout could not inspect. Priority: P2 Review scores
Verification
How this fits togetherTerminal keystrokes enter the TUI picker components, which either clear a session filter or call the shared overlay-cancellation callback. Closing the overlay returns control to the chat editor. flowchart LR
A[Terminal keyboard input] --> B[Shared terminal input]
B --> C[Model and agent pickers]
B --> D[Session picker]
C --> E[Close overlay]
D --> F[Clear filter or close overlay]
E --> G[Chat editor]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -11, Tests +102, Docs +2. Total +93 across 8 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cancellation decoding in Pi TUI’s shared input owner, after verifying the locked 0.84.2 callback contract against its source and retaining the focused PTY coverage. Do we have a high-confidence way to reproduce the issue? Yes, source reproducibly shows current main only cancels on Escape or raw ETX; the added PTY test defines the affected model and session flows, though this reviewer did not execute it. Is this the best way to solve the issue? Yes, conditionally: delegating decoding to the shared Input owner removes duplicate state and preserves the distinct session clear-first behavior, provided the pinned callback contract is verified. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 55a60de5e7db. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
74d393f to
20f9155
Compare
Preserve clear-first session search and return encoded Ctrl+C to the active picker cancellation owner. Co-authored-by: Aniruddha Adak <[email protected]>
79673f3 to
2b165ed
Compare
|
@clawsweeper re-review The existing PR now uses the canonical Input cancellation owner, deletes duplicate search state, and includes fresh native encoding/selection proof plus inspected synthetic PTY renderings. The prior release-event question is addressed with direct installed dependency dispatch inspection in the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
Co-authored-by: Aniruddha Adak <[email protected]>
|
Merged via squash.
|
…3151) * fix(tui): route picker cancellation through shared input Preserve clear-first session search and return encoded Ctrl+C to the active picker cancellation owner. Co-authored-by: Aniruddha Adak <[email protected]> * ci: refresh checks against current main --------- Co-authored-by: Aniruddha Adak <[email protected]>
Summary
Fixes #133128. Preserves contributor credit from the overlapping #136239.
Encoded Ctrl+C could leave a model or session picker open, sending subsequent typing into its search box. Both wrappers handled only raw U+0003 while their existing Pi Input already understood terminal cancellation bindings. The wrappers now connect Input.onEscape; the duplicate branches and FilterableSelectList's second copy of the search text are removed.
Session cancellation still clears a nonempty filter first and closes an empty picker. Model, agent and context cancellation remains immediate. Main-editor clear-input/double-exit behavior stays with its existing owner. Production +13 / −24 = −11 LOC; tests/support +130 / −28; docs +2. No configuration, schema, dependency or public API change.
Validation
The pre-edit native runTui proof reproduces two Kitty Ctrl+C failures alongside four passing Escape/raw-Ctrl+C controls. The final native matrix passes all eight model/session flows across Escape, raw Ctrl+C, Kitty and xterm modifyOtherKeys. Each flow returns to chat, sends the next prompt, observes its assistant reply, exits and cleans up. The session flow also clears, types a fresh query, clears again, then closes. The xterm run is after-proof; no new xterm before-run is claimed.
Direct installed Pi TUI 0.84.2 inspection resolves the previous release-event question: Input.handleInput dispatches tui.select.cancel through onEscape, keybindings defines Escape/Ctrl+C, keys.js:513 and :915 decode modifyOtherKeys/Kitty, and tui.js:614–624 drops release events before dispatch to components that do not request them. These selectors do not opt in. The canonical input owner therefore handles the keyboard contract without a new release filter.
This is actual runTui in native PTYs with a synthetic TuiBackend; it does not claim Gateway transport, live-provider execution or persistence.
Recorded terminal behavior
The images below are labeled renderings of actual captured PTY frames. They contain synthetic fixtures only.
The existing PR is updated in place with the canonical owner refactor and fresh proof. The overlapping contributor PR remains open until this fix is merged. Release-note context and Aniruddha Adak's contribution are preserved here and in the commit.
Current-main integration proof
Integrated main
3175ac4a2a068f62abacffc337c21f21b488d1a1, preserving both the landed hyperlinks PTY and picker-cancellation PTY entries in the shard inventory and expected list. Inventory tests, both complete native PTY files and the full eight-file changed gate pass. Production bytes are unchanged from the preceding reviewed candidate. One independent cumulative Codex review of the exact merged tree is clean through P2.Final dependency review
The latest ClawSweeper review has no code or security finding; both pre-merge items and its Rank-up move request direct inspection of Pi TUI 0.84.2. I inspected the installed locked dependency:
dist/components/input.js:67-70dispatchestui.select.canceltoonEscape;dist/keybindings.js:86-88maps Escape and Ctrl+C;dist/keys.jsdecodes Kitty CSI-u and modifyOtherKeys;dist/tui.js:614-624filters key-release events before the focused input. The eight native model/session PTY cases exercise all four encodings throughrunTui, then complete a subsequent chat turn. Agent/context picker coverage shares the inspected searchable component; no Gateway transport or provider claim is made.This completes the requested dependency verification. Input owns cancellation decoding; sessions retain clear-first behavior, and overlay callbacks return control to the existing chat editor.
The required CI gate passes on
4d31ec802a65ebd1930ae316039ca5d2c9bf66f7, with no pending or failed checks in the final snapshot. Both dependency-verification items and the Rank-up move are addressed. Contributor credit remains with Aniruddha Adak.