Skip to content

fix: preserve prompt draft across permission prompts#21950

Open
Mayhem50 wants to merge 1 commit intoanomalyco:devfrom
Mayhem50:Mayhem50/fix-21320-permission-draft
Open

fix: preserve prompt draft across permission prompts#21950
Mayhem50 wants to merge 1 commit intoanomalyco:devfrom
Mayhem50:Mayhem50/fix-21320-permission-draft

Conversation

@Mayhem50
Copy link
Copy Markdown

Issue for this PR

Closes #21320

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This fixes a TUI regression where text typed into the main session prompt could be lost when a permission prompt temporarily replaced the prompt UI.

The root cause was that the session prompt is unmounted while a permission request is shown, but the in-progress draft only lived inside the prompt component state. This change preserves the current prompt state when the prompt unmounts and restores it when the prompt mounts again. It also includes the prompt mode in PromptRef.current so shell-mode drafts are restored correctly.

How did you verify your code works?

  • Added a TUI regression test that mounts a real session view, emits permission.asked and permission.replied, and verifies that the prompt draft is restored after the permission prompt is dismissed.
  • Ran bun test test/cli/tui/session-permission-draft.test.tsx
  • Ran bun typecheck

Screenshots / recordings

Not included. This is a TUI-only change covered by an automated regression test.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Mayhem50
Copy link
Copy Markdown
Author

The e2e (windows) failure is a pre-existing CI issue unrelated to this PR.

The job hangs for 30 minutes after service=bus type=file.watcher.updated subscribing with no output, then times out — no Playwright tests actually run. The same pattern can be observed on other unrelated branches (e.g. run 24267916738 on docs/add-opencode-quota-ecosystem).

All other jobs (unit (linux), unit (windows), e2e (linux)) pass green on this PR.

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.

[BUG] Input text typed during a pending permission prompt is lost after accepting/rejecting

1 participant