Skip to content

Expire timed-out confirmation requests without executing actions - #108

Draft
ThinkOffApp wants to merge 1 commit into
mainfrom
claudemm/gate-expire-endpoint
Draft

ThinkOffApp wants to merge 1 commit into
mainfrom
claudemm/gate-expire-endpoint

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

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.

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>
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