Story 44: Agent Completion Report via MCP

- report_completion MCP tool for agents to signal done
- Rejects if worktree has uncommitted changes
- Runs acceptance gates (clippy, tests) automatically
- Stores completion status on agent record
- 10 new tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-20 15:02:34 +00:00
parent 679370e48a
commit 1b71449dd0
5 changed files with 464 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
---
name: Agent Completion Report via MCP
test_plan: pending
test_plan: approved
---
# Story 44: Agent Completion Report via MCP
@@ -12,11 +12,29 @@ As an agent finishing work on a story, I want to report my completion status via
## Acceptance Criteria
- [ ] MCP tool report_completion(story_id, agent_name, summary) allows agents to signal they are done
- [ ] Server auto-commits all changes in the worktree (git add -A && git commit) with a deterministic message before running gates — agents do NOT need to commit themselves
- [ ] Server rejects the report if the agent's worktree has uncommitted changes
- [ ] Server runs acceptance gates (clippy, tests) automatically on report
- [ ] Completion status and results are stored on the agent record for retrieval by wait_for_agent or the supervisor
- [ ] Agent prompts are updated to call report_completion as their final action
## Test Plan
### Unit Tests (agents.rs)
- `report_completion_rejects_nonexistent_agent` — calling on a non-existent agent returns Err
- `report_completion_rejects_non_running_agent` — calling on an already-Completed agent returns Err
- `report_completion_rejects_dirty_worktree` — calling with uncommitted changes returns Err containing "uncommitted"
- `report_completion_stores_result_and_transitions_status` — with a clean real git worktree, completes and stores a CompletionReport
### Unit Tests (mcp.rs)
- `report_completion_in_tools_list` — tool appears in handle_tools_list output
- `report_completion_tool_missing_story_id` — returns Err mentioning "story_id"
- `report_completion_tool_missing_agent_name` — returns Err mentioning "agent_name"
- `report_completion_tool_missing_summary` — returns Err mentioning "summary"
- `report_completion_tool_nonexistent_agent` — isError response for unknown agent
- `wait_for_agent_includes_completion_field` — wait_for_agent JSON output has "completion" key
## Out of Scope
- TBD
- Frontend UI for displaying completion reports
- Persisting completion reports to disk across server restarts
- Running biome/frontend checks in the acceptance gates (Rust only for now)