feat(ui): approval focus-swap for the full-screen app#13
Merged
Conversation
The worker thread blocks on a concurrent.futures.Future while the loop thread renders the approval prompt into the pane and the dock becomes the approval input. ApprovalGate carries the three-way y/e/n + HIGH typed-run contract; [e]dit steers via steer_text re-entering the classifier; Ctrl-C/ EOF during an approval declines this action and the turn continues. Adds DESIGN section 31.16.
lavindeep
added a commit
that referenced
this pull request
Jul 2, 2026
feat(ui): approval focus-swap for the full-screen app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branch 7 of the full-screen TUI rework (UI v2, design §31.16).
What
ask_approval/ask_plan_approvalreturn a value, so they can't be marshaled fire-and-forget like the other UI calls. This adds the focus-swap handshake (cli/app_approval.py,ApprovalGate): the worker thread blocks on aconcurrent.futures.Futurewhile the loop thread renders the prompt into the pane and the dock becomes the approval input, then resolves the Future.gate.submit(...)when an approval is active (before the/exitcheck); Ctrl-C and Ctrl-D route togate.cancel().run; every other request takesy/e/n;[e]ditenters a steer phase whose text becomesApprovalReply.steer_text, re-entering the deterministic classifier; empty steer = plain decline.set_exception) instead of leaving the worker blocked — the turn ends through the existing "Turn failed" path, never a silent approve.The default (non-app) REPL is untouched.
AppUIgainsshow_approval/show_plan_approval(the samerender_diff/approval_info/approval_cwd/plan_panelsinks asTerminalUI); echoed input and the plan path are control-char sanitized.Tests
Pure parse helpers (typed-
rungate, y/e/n, plan re-prompt), the gate handshake across a real worker thread (approve / decline / edit-steer / empty-steer / cancel; plan yes / edit-revision / unrecognized-reprompt / cancel), fail-closed Future resolution on a raising sink, AppUI render content, and headless keybinding routing. Worker threads are daemon so a regression fails fast rather than wedging the suite.Phase gate green: ruff + format clean, mypy --strict clean (79 files), 1390 passed.
DESIGN.md §31.16 added.