Skip to content

Fix: esc in the custom-prompt editor cancelled the whole jump - #5

Merged
navbytes merged 1 commit into
mainfrom
fix/esc-custom-prompt-picker
Sep 4, 2026
Merged

Fix: esc in the custom-prompt editor cancelled the whole jump#5
navbytes merged 1 commit into
mainfrom
fix/esc-custom-prompt-picker

Conversation

@navbytes

@navbytes navbytes commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • on an earlier tree row opens Pi's 3-choice picker (from Port Pi's fork-from-an-earlier-message flow whole #2); picking "Summarize with a custom prompt" opens a text-entry dialog, and esc there is documented to loop back to the 3 choices, not cancel the whole jump.
  • Manual smoke-testing for the v0.2.3 release found this was actually fully cancelling the jump instead — reproduced twice independently with pty screenshots.
  • Root cause: the host's dialog stack runs its own post-esc dismissal right after our onCancel handler returns, targeting whatever was on top when esc fired. Our handler was replacing the dialog synchronously inside that same handler, so the host's cleanup wiped the freshly-opened choices dialog straight back off, silently stranding the askJump promise (looks identical to a full cancel — nothing renders).
  • Fix: defer the reopen by one macrotask so it runs after the host finishes its own cleanup.

Test plan

  • bun run typecheck clean
  • bun test — 252 pass, 0 fail
  • New e2e regression test added (test/e2e/tui.test.ts): drives esc-in-custom-prompt via pty and asserts it lands back on the picker, not a dangling/cancelled state — confirmed to fail against the old code and pass against the fix
  • bun run build clean

… of returning to Pi's choices

The host's dialog stack runs its own post-esc dismissal right after our onCancel
handler returns, targeting whatever was on top when esc fired. Replacing the
dialog synchronously inside that handler meant the host's cleanup wiped the
freshly-opened choices dialog straight back off, silently stranding the
askJump promise. Deferring the reopen by one tick lets the host finish first.
@navbytes
navbytes merged commit 4559ec4 into main Sep 4, 2026
1 check passed
@navbytes
navbytes deleted the fix/esc-custom-prompt-picker branch September 4, 2026 06:26
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