Add typed action approval executor#15
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0133e918e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| throw new Error(`action nonce already exists: ${nonce}`); | ||
| } | ||
| const prompt = actionPrompt(normalized); | ||
| const intentId = await createIntent({ |
There was a problem hiding this comment.
Register actions before announcing approval
When the announcement publishes an actionable approval message, createIntent waits for announce before this function inserts the action into actions. If the user taps Approve while the announcement is still in flight, decideIntent finds no action for that intent and only marks the intent decided; after this call resumes, the action is stored as pending and the executor never runs, so GET /actions/{nonce} stays pending until expiry. Register the action before exposing the approval, or reconcile immediately if the intent was already decided.
Useful? React with 👍 / 👎.
|
|
||
| function expireAction(nonce, { receiptsPath } = {}) { | ||
| const action = actions.get(nonce); | ||
| if (!action || TERMINAL_ACTION_STATUSES.has(action.status)) return; |
There was a problem hiding this comment.
Only expire actions that are still pending
After approval, runApprovedAction changes the status to running, but this expiry check only skips terminal states. If expires_at arrives while gh pr view/gh pr merge is still running, the timer or status endpoint records an expired receipt even though the action was already approved and may later flip to merged or failed, corrupting the action audit trail. Expiry should be limited to actions whose status is still pending.
Useful? React with 👍 / 👎.
Adds the typed
/actions/*approval lane for broad CodeWatch-button-gated actions.What:
POST /actions/requestvalidates structured action requests and creates a normal approval intent.GET /actions/{nonce}returns typed action status/receipt.merge_prfor allowlisted ThinkOffApp repos only (antfarm,xfor,codewatch-site) with basemainvalidation.Validation performed locally:
node --check src/confirmations.mjsNote: I could not write the live
/Users/petrus/ide-agent-kitcheckout from the family user, so this is a reviewable PR for the live MacBook/daemon checkout to pull.