forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Summary
The Project Manager agent can dispatch tasks via mcp_task and check status via mcp_check_task, but cannot cancel running tasks. This limits orchestration capability.
Problem
When requirements change or a better-scoped task is dispatched, old tasks continue running:
- Wastes compute/tokens
- May produce conflicting changes
- No way to stop runaway or stuck tasks
Current State
- ✅
mcp_task- dispatch tasks to specialists - ✅
mcp_check_task- check task status - ❌
cancel_task- missing
Requirements
- Add
cancel_tasktool that acceptstask_id - Should gracefully stop the running agent
- Return confirmation:
{ "status": "cancelled", "task_id": "..." } - Handle edge cases: task already completed, task not found
Implementation
- Find task management code (likely
packages/opencode/src/tool/task.ts) - Add AbortController tracking per task
- Implement
cancel_tasktool - Register tool in MCP tool registry
- Add tests
Acceptance Criteria
-
cancel_tasktool implemented - Cancelled tasks stop execution promptly
- Status returns "cancelled" when checked
- Works for all agent types
Metadata
Metadata
Assignees
Labels
No labels