Repository navigation
Conversation
97bd8bd to
a9fd06b
Compare
|
Nice recovery design - the conditional-UPDATE reclaim and keeping the ownership 409 on expired rows are the right shape. One wording thought on the card's interrupted text: "The previous attempt was interrupted before it finished" reads as if the action definitely did not complete. The crash window this recovers from is between the remote tool call returning and (I had a parallel PR up for #134 without spotting this one first - closing mine; this is the one finding from its review round that this diff does not already cover.) |
Fixes #134.
User workflow
An owner approves a gated connected-service action and the server stops before the result is saved (crash, restart, deploy). Today that card shows "Running" forever with no retry path, and every approval attempt returns
409 This action is already running.After this change, the card shows "Interrupted" with a Retry action button once the claim is demonstrably stale, and retrying runs the already-stored request exactly once.Change
ACTION_TTL_MS(10 min; a claimed action settles in ~60s since MCP calls are bounded, so a result-less older claim cannot belong to a live run).claimActionreclaims an expired result-less claim atomically (conditional UPDATE, so concurrent reclaimers serialize and only one executes);finishActionno longer overwrites a saved result.interruptedfor an expired result-less claim; the POST path lets the same approval reclaim it.runningrows still 409, saved results still return only to their own approval, and a different approval can never steal the claim.interrupted, labels it, explains the retry, and offers "Retry action".Verification
tests/connections.test.ts: retry-after-interruption runs the stored request exactly once (receiptinterrupted→ POST 200 → receiptdone), fresh claims still 409, and a stale claim under a different approval still 409s. The retry test failed on the base commit (receipt stayedrunning, POST stayed 409) and passes with the fix.npm run check-format,npm run lint,npm run typecheck, andnpm run buildall green (Node v22.23.1).