Skip to content

fix(session): bind a question card's cancel to its prompt - #1034

Merged
RonenMars merged 2 commits into
mainfrom
fix/permission-cancel-prompt-binding
Sep 10, 2026
Merged

fix(session): bind a question card's cancel to its prompt#1034
RonenMars merged 2 commits into
mainfrom
fix/permission-cancel-prompt-binding

Conversation

@RonenMars

Copy link
Copy Markdown
Owner

Summary

Cancel on a live question card wrote a blind Escape, so tapping it on a card whose gate had already closed interrupted the agent's current turn.
On a streamer with raw keys, a card carrying a registry promptId now sends its Escape through /raw-key bound to that prompt.
The card comes down on the server's reply instead of on the tap.
raw_key_stale takes the card down as a calm notice with nothing written, and any other refusal keeps the card up with a translated error.
Interrupting the agent and the raw keyboard's Escape are a different intent and are unchanged.

Server dependency

The binding takes effect once the streamer honours promptId on escape, tracked in RonenMars/threadbase-streamer#848.
Until then a streamer writes the escape blind and answers 200, exactly as it does today, so this is safe to merge before that lands.

Not covered

Legacy permission and question frames and PTY-scraped cards carry no promptId, so their Cancel keeps the blind Escape.
#841 stays open for the PTY-scraped cards.

Tests

  • The bound path, dismissal on the reply, stale and non-stale refusals, and the blind fallbacks are covered in the seam and view suites.
  • 5 of the new tests fail against main, and removing the clear(expectedKey) guard fails the in-flight replacement test.
  • The affected suites pass: 26 suites, 242 tests.

Refs #841

Cancel on a live question card wrote a blind Escape, so a tap on a card whose gate had already closed interrupted the agent's current turn.
On a streamer with raw keys, a card carrying a registry promptId now sends its Escape through /raw-key bound to that prompt, and comes down on the server's reply instead of on the tap.
A stale verdict takes the card down as a calm notice with nothing written, and any other refusal keeps the card up with a translated error.
Legacy permission and question frames and PTY-scraped cards carry no promptId, so they keep the blind Escape.
Interrupting the agent and the raw keyboard's Escape are a different intent and are unchanged.

Refs #841
@RonenMars
RonenMars force-pushed the fix/permission-cancel-prompt-binding branch from b57cad4 to f2069d3 Compare September 10, 2026 15:34
#841 moved the structured card's Cancel from onSendKeys plus onDismissQuestion to a single onCancelQuestion supplied by the owning view.
PromptCardSelect still rendered ThinkingBubble and TerminalOutput with only onSendKeys, so its "keeping dismiss" assertion found no Cancel button.
Both production callers already pass onCancelQuestion, so only the test's props were stale.

Refs #841
@RonenMars
RonenMars merged commit 181c867 into main Sep 10, 2026
23 checks passed
@RonenMars
RonenMars deleted the fix/permission-cancel-prompt-binding branch September 10, 2026 16:02
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