Arm queued gates' display-dependent timers only once shown - #407
Merged
TheGreatAxios merged 1 commit intoAug 8, 2026
Merged
Conversation
The permission gate's goal-mode timeout and the operator gate's own new timeout/abort safety net both used to start (or, for the operator gate, not exist at all) the moment a request was raised, even while it sat behind another overlay on the shared host. A request queued behind others could burn its entire timeout, or the run could abort, before the operator ever saw it, presenting as a hung session with commands firing but no visible response. The timeout now arms inside each gate's own open() callback, which only runs once the shared overlay host actually displays it; the abort-signal listener stays registered immediately, since a tool having already finished is true whether or not its gate is on screen. The operator gate gains the same abort/timeout/auto-cancel treatment the permission gate already had, including the goal-mode timeout and the ALS tool-budget signal, via a shared attachApprovalBudget helper used by both the permission gate and every operator-gate emission site (ask_operator, MCP TOFU). Unlike the permission gate, operator gates had no queue module to register with, so a gate still queued behind another overlay at session teardown was dropped without ever settling its awaited promise. wireGates now tracks each outstanding operator gate's teardown callback and cancels every one of them on dispose, the same guarantee permissionQueue.drain() already gives permission requests.
TheGreatAxios
added a commit
that referenced
this pull request
Aug 8, 2026
Rebasing onto main picked up #407's rewrite of gate-wire.ts (display- gated timers, onOperator safety net, attachApprovalBudget). Two of its new comments and one test fixture still said "goal-mode timeout" / "goal mode" — composed correctly with this branch's removal in substance (the timeout is generic plumbing either way) but stale in wording now that there's no goal subsystem to name. Reworded only; no logic changed.
TheGreatAxios
added a commit
that referenced
this pull request
Aug 8, 2026
Rebasing onto main picked up #407's rewrite of gate-wire.ts (display- gated timers, onOperator safety net, attachApprovalBudget). Two of its new comments and one test fixture still said "goal-mode timeout" / "goal mode" — composed correctly with this branch's removal in substance (the timeout is generic plumbing either way) but stale in wording now that there's no goal subsystem to name. Reworded only; no logic changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
open()callback, which runs only once the shared overlay host actually shows it.ask_operatorand MCP-TOFU questions previously had no timeout, no abort signal, and no auto-cancel at all, unlike the permission gate. They now get the same treatment via a sharedattachApprovalBudgethelper.permissionQueue), so a gate still queued at session teardown was dropped without ever resolving.wireGatesnow tracks each outstanding operator gate and settles it on dispose.Fixes CL-5664 items 1 and 3 (items 2 and 5 were already fixed in PRs #374 and #382).
Test plan
bun run typecheckbun run buildbun run test(full suite via lock script) — 4179 pass, 1 pre-existing unrelated fail (lsp-availability.test.ts, missingtypescript-language-serverbinary in this worktree)src/tui-opentui/gate-wire.test.ts: queued-gate timeout deferred to display (permission + operator), operator auto-cancel on timeout/abort, queued operator gate settled on run-abort, dispose settling a still-queued operator gate, exactly-one-transcript-row invariantsrc/tui/request-approval.test.tsfor the sharedattachApprovalBudgethelper