Expire timed-out confirmation requests without executing actions - #108
Draft
ThinkOffApp wants to merge 1 commit into
Draft
ThinkOffApp wants to merge 1 commit into
ThinkOffApp wants to merge 1 commit into
Conversation
The PreToolUse gate waits IAK_GATE_TIMEOUT for a human, then proceeds under
IAK_GATE_DEFAULT=allow and POSTs /intent/<id>/expire so the request stops
sitting in the queue. The daemon has never implemented that route, so every
timed-out intent stayed `pending` for ever: on 2026-09-18 there were 31 of them,
the oldest created three minutes after the running daemon started, each one a
command that had already executed and a button that could no longer change
anything.
expireIntent is deliberately not decideIntent:
- a human approve/deny that arrived first is left untouched, and the call
reports the existing decision rather than overwriting it;
- it never runs an action. decideIntent executes an action bound to the
intent, and a timeout is not consent to do that.
waitForDecision also reported an expiry as {status:'decided', decision:null},
which is how a caller ends up believing someone approved something. It now
reports {status:'expired'}.
Tests cover: settles without deciding, leaves the pending queue, idempotent,
never overrides a human decision, releases waiters, unknown id, and the HTTP
route including its 404.
This makes the buttons honest. It does NOT address the larger point that the
gate notifies a human about commands it will allow regardless — that is a
policy decision, raised separately.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Timed-out PreToolUse gates call an expiry endpoint that the daemon did not implement, leaving completed requests visible as pending. Add explicit expiry without executing actions or overwriting existing human decisions, and return an expired result to active waiters.
Review in progress. The existing 29 confirmation tests pass independently, but review found remaining cases before rollout: mirror expiry to central action status, return immediately to waiters started after expiry, reject non-object request bodies, and prove late-click/typed-action nonexecution. The current patch's late waiter returns timeout and its mirror emits only pending; reproductions confirmed locally.
This queue lifecycle fix is separate from the user-requested dynamic team-lead approval and restricted scratch cleanup policy. No approval authority or live service configuration is changed by this PR.