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>
2 KiB
2 KiB
| kind | slug | title | plan_slug | status | priority | tenant_id | cursor_epic_id | updated_at |
|---|---|---|---|---|---|---|---|---|
| epic | task-as-runnable-unit | Task as runnable unit — workflow prompts and a runs table | agent-coordination | ready | P2 | global | null | 2026-06-01 |
Epic objective
Every backlog item can carry a workflow prompt; every agent session against a task gets recorded in a runs table. These two changes are the foundation that claim_task / complete_task build on.
In scope / out of scope
In scope
- Schema additions for workflow prompts.
- New
runstable + tRPC router. - Minimal UI for editing the prompt and viewing recent runs.
Out of scope
- The actual MCP tools (next epic).
- Orchestrator process (deferred epic).
Related tasks
| Task | Link |
|---|---|
| Add workflow prompt to backlog items | ./Task-add-workflow-prompt-to-backlog-items.md |
| Runs table and tRPC router | ./Task-runs-table-and-trpc-router.md |
Dependencies
- Depends on:
Plan-daily-driver-finish(don't extend stubs). - Blocks:
Epic-mcp-claim-complete.
Acceptance criteria
- A task row can store an optional workflow prompt that overrides the epic/plan default. (Schema column
workflow_prompt, parser plumbing, slug-based inheritance walk all shipped.) - An
agent_runsrow capturesstarted_at,finished_at,actor_user_id,outcome,tokens_input,tokens_output,tokens_total,notes,error, andmetadata. (One column more than the spec — addedtokens_totalbecause Symphony's "absolute totals win" rule needs explicit storage.) - Minimal UI lets an operator read recent runs at
/[workspaceSlug]/settings/runs. Prompt-editing UI is deferred toTask-workflow-prompt-task-detail-ui.mdbecauseapps/webdoesn't yet have a backlog-item detail panel.
Proposed timeline
| Phase | Window | Notes |
|---|---|---|
| Schema + procedures | Day 1 | Columns, table, tRPC router. |
| UI surfacing | Day 2 | Inline prompt editor, recent-runs panel. |