Skip to content

fix(tui): a paste while /factory is open no longer lands in the hidden editor - #3989

Open
snimu wants to merge 1 commit into
mainfrom
sebastian/tui-factory-paste
Open

snimu wants to merge 1 commit into
mainfrom
sebastian/tui-factory-paste

Conversation

@snimu

@snimu snimu commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

A paste while the /factory page is open no longer goes into the prompt editor hidden behind the page.

Bug

AgentView::route_paste (view.rs) routes a bracketed paste to whatever owns the frame. SessionUi::handle_paste promises that a paste never lands in the hidden editor behind an overlay. But the input-less group in route_paste was missing factory_view. So a paste with the factory page open fell through to view.editor.handle_paste. When the page closed, the text was sitting in the prompt.

Fix

Add factory_view to the input-less group in route_paste; the comment lists it too. The factory page has no text input: its handle_key only moves the selection, opens, stops and resumes. So it consumes the paste like the heartbeats picker, bash view, goal and info panels do.

Onboarding needs no change. Its pane runs its own input loop (interactive/onboarding.rs), which handles UiInput::Paste itself, and it takes view.onboarding out while it waits. SessionUi::handle_paste never runs while onboarding is shown.

Test

New headless test a_paste_on_the_factory_page_stays_out_of_the_hidden_editor in crates/pa-tui/tests/factory_command_headless.rs. It uses the file's existing page pattern:

  1. Open the page from the dock: alt+a, down ×3, Enter.
  2. Paste zq-stray-paste.
  3. Close the page with Esc.
  4. Assert that no frame contains the pasted text.

Failing output on main (main code + this test, Prime sandbox):

panicked at crates/pa-tui/tests/factory_command_headless.rs:950:5:
the paste must not reach the editor behind the page:
... Details mode (Ctrl+O to expand) > zq-stray-paste ← manage ...

Validation

All green in a Prime sandbox with toolchain 1.98.1:

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test -p pa-tui --no-fail-fast
  • cargo build -p pa-cli

Overlap

#3893 touches view.rs; #3356 touches the factory view and keys.rs. The production change here is one added condition in route_paste. A follow-up refactor (stacked on this branch) replaces the overlay Option fields with one enum.


Note

Low Risk
Single guard in paste routing plus a regression test; no auth, data, or API surface changes.

Overview
Paste routing while /factory is open no longer leaks into the prompt editor behind the overlay. AgentView::route_paste now treats an open factory_view like other input-less frame owners (heartbeats picker, bash view, etc.) and consumes the paste instead of returning false and letting handle_paste fill the hidden editor.

A headless test opens the factory page from the dock, pastes while it is visible, closes with Esc, and asserts the pasted text never appears in captured frames. The changes file records the user-facing fix.

Reviewed by Cursor Bugbot for commit a51a416. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix paste landing in hidden editor while /factory page is open

Adds the factory page to the set of input-less frame owners in AgentView.route_paste so a paste is consumed instead of falling through to the hidden prompt editor. Adds a headless test in factory_command_headless.rs that pastes on the factory page and asserts the text does not appear in captured frames. Includes a changeset entry.

Macroscope summarized a51a416.

…n editor

`AgentView::route_paste` listed every input-less frame owner except the
factory page, so a bracketed paste with the page open fell through to the
editor hidden behind it and showed up in the prompt once the page closed.
The factory page has no text input; it now consumes the paste like the
other input-less owners.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant