Skip to content

fix(tui): route picker cancellation through shared input - #133151

Merged
steipete merged 3 commits into
mainfrom
codex/qa-20260830-tui-picker-cancel
Sep 2, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/qa-20260830-tui-picker-cancel

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • 402 primary component/command/global TUI tests and all 30 required changed-file gates pass.
  • Final encoding component matrix: 69 tests pass. Four inventory checks pass.
  • Existing real full-loop selection sibling passes: model and session selection, then a prompt/reply on the selected session.
  • Final typed lint, formatting and independent combined Codex P2 review are clean.

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.

Model picker before Model picker after
Before: encoded cancel leaves typing in model search After: cancel returns to chat and the prompt receives a reply
Session picker before Session picker after
Before: encoded cancel retains the old session search After: cancellation clears the filter before closing

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-70 dispatches tui.select.cancel to onEscape; dist/keybindings.js:86-88 maps Escape and Ctrl+C; dist/keys.js decodes Kitty CSI-u and modifyOtherKeys; dist/tui.js:614-624 filters key-release events before the focused input. The eight native model/session PTY cases exercise all four encodings through runTui, 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.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 07:11
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 2, 2026, 6:20 PM ET / 22:20 UTC.

ClawSweeper review

What this changes

Routes 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
Reviewed head: 4d31ec802a65ebd1930ae316039ca5d2c9bf66f7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative production repair with appropriate component and PTY coverage, pending independent confirmation of the dependency callback contract.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; its body nevertheless records native runTui PTY behavior for the changed input-to-overlay path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; its body nevertheless records native runTui PTY behavior for the changed input-to-overlay path.
Evidence reviewed 7 items Current main still needs the repair: Current main retains raw-ETX-only Ctrl+C branches in both picker owners; it therefore does not implement the requested modern keyboard cancellation behavior.
Introduced owner-boundary change: The PR delegates cancellation to Input.onEscape and retains the existing post-input state comparison that refreshes the filter after a clear.
Overlay caller and sibling coverage: All picker types install the same overlay-closing onCancel callback; models, agents, and context use SearchableSelectList, while sessions use FilterableSelectList.
Findings None None.
Security None None.

How this fits together

Terminal 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
Loading

Before merge

  • Resolve merge risk (P1) - The repair depends on Pi TUI 0.84.2 routing Kitty CSI-u and modifyOtherKeys cancellation through Input.onEscape; that upstream source contract was unavailable for direct inspection in this environment.
  • Complete next step (P2) - Independently verify the locked Pi TUI 0.84.2 Input.onEscape cancellation-dispatch contract before merge.
Agent review details

Security

None.

PR surface

Source -11, Tests +102, Docs +2. Total +93 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 13 24 -11
Tests 5 130 28 +102
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 145 52 +93

Review metrics

Metric Value Why it matters
Production versus test delta production −11, tests/support +102, docs +2 The bug fix removes duplicate cancellation state and branches while adding boundary-level coverage for four terminal encodings.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #133128
Summary: This PR is a candidate fix for the canonical modern-keyboard picker cancellation report; the other open PR addresses the same behavior but is not a safe supersession target.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Verify the pinned callback contract (recommended)
    Inspect Pi TUI 0.84.2 source to confirm all claimed cancellation encodings invoke Input.onEscape before merging.
  2. Accept the recorded native proof
    A maintainer may accept the PR’s recorded native-PTY evidence if independent dependency-source inspection is not available.

Technical review

Best 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.

Labels

Label justifications:

  • P2: Modern terminal Ctrl+C leaves a picker open, but Escape remains a working alternative and the impact is limited to TUI picker interaction.
  • merge-risk: 🚨 compatibility: The refactor changes cancellation handling for existing terminal keyboard encodings and relies on a pinned dependency callback contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; its body nevertheless records native runTui PTY behavior for the changed input-to-overlay path.

Evidence

What I checked:

  • Current main still needs the repair: Current main retains raw-ETX-only Ctrl+C branches in both picker owners; it therefore does not implement the requested modern keyboard cancellation behavior. (src/tui/components/filterable-select-list.ts:129, 55a60de5e7db)
  • Introduced owner-boundary change: The PR delegates cancellation to Input.onEscape and retains the existing post-input state comparison that refreshes the filter after a clear. (src/tui/components/filterable-select-list.ts:45, 4d31ec802a65)
  • Overlay caller and sibling coverage: All picker types install the same overlay-closing onCancel callback; models, agents, and context use SearchableSelectList, while sessions use FilterableSelectList. (src/tui/tui-command-handlers.ts:307, 55a60de5e7db)
  • Behavioral regression coverage: The added PTY matrix exercises model and session pickers with Escape, raw Ctrl+C, Kitty CSI-u, and modifyOtherKeys, then verifies return to chat and a subsequent message round trip; component matrices cover the shared searchable picker used by agent and context flows. (src/tui/tui-picker-cancel-pty.e2e.test.ts:15, 4d31ec802a65)
  • Pinned dependency signal: The changed picker components directly import Pi TUI Input, and the target pins @earendil-works/pi-tui at 0.84.2. (package.json:2075, 4d31ec802a65)
  • Dependency-contract limitation: No installed Pi TUI source or package-cache source was available, and GitHub/promisor reads failed DNS; the PR-body claim about Input.onEscape decoding modern Ctrl+C could not be independently verified here.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Verify from Pi TUI 0.84.2 source that Input.handleInput routes the claimed cancellation encodings to onEscape.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-30T08:01:07.319Z sha 74d393fd99798fa43bf31029ce8c8dd63992679d :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T08:23:08.364Z sha 20f9155 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T08:34:11.472Z sha 79673f3 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T08:47:48.997Z sha 79673f3 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T17:03:56.036Z sha 79673f3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T18:51:49.828Z sha 2b165ed :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T19:02:34.274Z sha 2b165ed :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T20:48:02.603Z sha af0530b :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 30, 2026
@steipete
steipete force-pushed the codex/qa-20260830-tui-picker-cancel branch from 74d393f to 20f9155 Compare August 30, 2026 08:14
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 30, 2026
Preserve clear-first session search and return encoded Ctrl+C to the active picker cancellation owner.

Co-authored-by: Aniruddha Adak <[email protected]>
@steipete
steipete force-pushed the codex/qa-20260830-tui-picker-cancel branch from 79673f3 to 2b165ed Compare September 2, 2026 18:41
@steipete steipete changed the title fix(tui): cancel pickers across terminal keyboard encodings fix(tui): route picker cancellation through shared input Sep 2, 2026
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@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.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 2, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 2, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 2, 2026
@steipete
steipete merged commit 047edf2 into main Sep 2, 2026
235 of 237 checks passed
@steipete
steipete deleted the codex/qa-20260830-tui-picker-cancel branch September 2, 2026 22:42
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ctrl+C does not cancel TUI pickers with modern keyboard input

1 participant