ubiquitous-invention/plans/Plan-agent-coordination/Epic-mcp-claim-complete
Randall Stillwell b2aff2045b feat(mcp): claim_task tool + register claim/complete pair
Pairs with the parallel complete_task commit. claim_task opens an
agent_runs row, flips status to in_progress only when it's safe
(ready/draft → in_progress, never overwriting a deliberate
blocked/done/in_progress), and returns the resolved workflow prompt
+ source level. Idempotent re-claim by the same actor returns the
existing run with reused=true and refreshes notes only — started_at
is sacred. Different-actor re-claim errors with ALREADY_CLAIMED
naming the existing actor and run id.

Tenancy fence: if the backlog item exists but in a different workspace
than the resolved handle, we refuse with "doesn't belong to workspace"
rather than 404. Prevents cross-tenant existence fishing.

All three writes (run insert + status flip + audit insert) happen in
one db.transaction() so a partial claim is unreachable.

tools/index.ts now registers both claim_task and complete_task.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 22:23:05 -05:00
..
Epic-mcp-claim-complete.md feat(mcp): claim_task tool + register claim/complete pair 2026-06-02 22:23:05 -05:00
Task-mcp-claim-task-tool.md feat(mcp): claim_task tool + register claim/complete pair 2026-06-02 22:23:05 -05:00
Task-mcp-complete-task-tool.md feat(mcp): claim_task tool + register claim/complete pair 2026-06-02 22:23:05 -05:00