[PR #6698] fix(tui): enable app exit via Ctrl-C/Ctrl-D during permission requests #12045

Closed
opened 2026-02-16 18:16:59 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6698

State: closed
Merged: No


Summary

Users were unable to exit the application via Ctrl-C or Ctrl-D when a permission request was displayed.

Changes

This fix implements a two-layer defense:

1. Component-level handler (permission.tsx)

  • Added request prop to Prompt component
  • Ctrl-C/Ctrl-D in the permission prompt rejects the permission request

2. Global handler (session/index.tsx)

  • Added global useKeyboard handler at the Session level
  • When permissions are pending, Ctrl-C/Ctrl-D:
    • Rejects all pending permissions via the SDK
    • Exits the application via exit()

Why two handlers?

  • Component handler: Works when user is interacting with the permission prompt
  • Global handler: Works regardless of keyboard focus (e.g., if user is typing in the command prompt while a permission is pending)

Testing

All existing permission tests pass:
bun test test/permission/next.test.ts
55 pass

Related

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6698 **State:** closed **Merged:** No --- ## Summary Users were unable to exit the application via Ctrl-C or Ctrl-D when a permission request was displayed. ## Changes This fix implements a two-layer defense: ### 1. Component-level handler (`permission.tsx`) - Added `request` prop to `Prompt` component - Ctrl-C/Ctrl-D in the permission prompt rejects the permission request ### 2. Global handler (`session/index.tsx`) - Added global `useKeyboard` handler at the Session level - When permissions are pending, Ctrl-C/Ctrl-D: - Rejects all pending permissions via the SDK - Exits the application via `exit()` ## Why two handlers? - Component handler: Works when user is interacting with the permission prompt - Global handler: Works regardless of keyboard focus (e.g., if user is typing in the command prompt while a permission is pending) ## Testing All existing permission tests pass: bun test test/permission/next.test.ts 55 pass ## Related - Issue: #6644 - Related PR: #6632 (similar fix with component-level handling only)
yindo added the pull-request label 2026-02-16 18:16:59 -05:00
yindo closed this issue 2026-02-16 18:16:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12045