Skip to content

Restore permission-gate auto-deny and fix Esc leaving gate promises unresolved - #340

Merged
TheGreatAxios merged 2 commits into
release/tui-bugfixesfrom
cl-5568-5569-gate-dismiss-and-timeout
Aug 7, 2026
Merged

Restore permission-gate auto-deny and fix Esc leaving gate promises unresolved#340
TheGreatAxios merged 2 commits into
release/tui-bugfixesfrom
cl-5568-5569-gate-dismiss-and-timeout

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Import the shared PermissionGateEvent type in gate-wire.ts instead of a narrower local redeclaration that silently dropped timeoutMs, timeoutMessage, and signal
  • Wire a timer and an abort listener into onPermission so goal-mode timeouts and watchdog aborts auto-deny the gate and close the overlay, cleaning up after themselves on normal resolution
  • Add an onCancel hook to OpenPermissionsOpts/OpenOperatorOpts and thread it through openListOverlay/closeInsetOverlay so Esc on a permission or operator overlay resolves the awaited promise (deny/cancel) instead of abandoning it; update the operator "no way to answer" copy to match

Verification

  • bun run typecheck, bun run build, and bun test all run clean except three pre-existing flaky failures unrelated to this change (markdown transcript rows fence tests, ripgrep timing tests) — confirmed by rerunning and seeing a different flaky subset fail each time
  • src/tui-opentui/gate-wire.test.ts (36 tests, up from 31) covers: timeout auto-deny with the given message and overlay close, abort auto-deny while the overlay is open, no leaked timer after a normal accept, and Esc resolving both the permission gate (deny) and the operator gate (cancel)
  • Checked onOperator: its local type already matched the shared OperatorGateEvent field-for-field (no timeout/signal there), so only the type redeclaration needed fixing there, not new wiring
  • Did not touch overlays.ts rendering logic (owned by a sibling fix for CL-5560) beyond adding the onCancel option plumbing

Closes CL-5568
Closes CL-5569

@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown

CL-5568

CL-5569

@TheGreatAxios
TheGreatAxios changed the base branch from main to release/tui-bugfixes August 7, 2026 04:20
@TheGreatAxios
TheGreatAxios force-pushed the cl-5568-5569-gate-dismiss-and-timeout branch from 47f94b8 to d61373a Compare August 7, 2026 04:48
A local redeclaration of the gate event type omitted timeoutMs,
timeoutMessage, and signal, so goal-mode timeouts and watchdog
aborts were silently dropped. An unattended run could park on the
permission modal forever with nobody able to answer it.

Import the shared type instead, so the compiler catches a missing
field, and wire a timer plus an abort listener into the permission
handler that auto-deny and close the overlay. All three exit paths
(accept, timeout, abort) guard on a settled flag so none can
double-resolve, and a queued gate resolves on its own timeout
without disturbing whichever gate is currently on screen.
Esc on a permission or operator overlay called closeInsetOverlay,
which dropped the accept callback without ever invoking the caller's
awaited resolve. The run deadlocked until the process was killed.

Add an onCancel hook to the overlay opts and thread it through the
open/close paths for the promise-backed overlay kinds only, so the
gate wiring can resolve deny/cancel from it. Deliberate accept and
answer-submit paths null the hook first so closing there does not
also fire it. The operator gate also gains its own settled flag
mirroring the permission gate, so double-resolve is prevented by
construction rather than by callers remembering to null the hook.
Update the operator "no way to answer" copy now that Esc actually
settles the question.
@TheGreatAxios
TheGreatAxios force-pushed the cl-5568-5569-gate-dismiss-and-timeout branch from d61373a to dbf21e4 Compare August 7, 2026 05:11
@TheGreatAxios
TheGreatAxios merged commit b8943e7 into release/tui-bugfixes Aug 7, 2026
2 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-5568-5569-gate-dismiss-and-timeout branch August 7, 2026 06:36
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