Ensure tasks meet quality requirements before marking complete.
Completion Gates prevent tasks from being marked "complete" until they meet defined criteria:
- Tests must pass before feature completion
- Guard validation must succeed before code commit
- Evidence must be collected for audit trail
| Status | Meaning |
|---|---|
completed |
All requirements met, task done |
pending |
Waiting for evidence/validation |
blocked |
Cannot proceed until issue resolved |
pending → (evidence collected) → pending → (all gates pass) → completed
↓
(gate fails)
↓
blocked
Evidence is structured proof that a requirement was met.
{
"taskId": "fix-auth-bug",
"type": "guard", // or "test", "manual"
"status": "passed",
"timestamp": "2025-12-15T11:00:00Z",
"details": {
"ruleset": "security",
"rulesChecked": 12,
"warnings": 0,
"errors": 0
}
}| Type | Source | Collected By |
|---|---|---|
guard |
guard_validate |
Auto when taskId provided |
test |
testing_run |
Auto when taskId provided |
manual |
User assertion | Manual API call |
When calling guard or test tools, include taskId to auto-collect evidence:
// Guard validation with evidence
{
"tool": "guard_validate",
"args": {
"code": "...",
"filename": "auth.ts",
"ruleset": "security",
"taskId": "fix-auth-bug" // Evidence tagged to this task
}
}
// Test run with evidence
{
"tool": "testing_run",
"args": {
"files": ["tests/auth.test.ts"],
"taskId": "fix-auth-bug" // Evidence tagged to this task
}
}When a task cannot complete, the response includes nextToolCalls - suggested actions to resolve blockers.
{
"taskId": "fix-auth-bug",
"status": "blocked",
"blockingGates": ["test_pass"],
"nextToolCalls": [
{
"tool": "testing_run",
"args": { "files": ["tests/auth.test.ts"] },
"priority": 1,
"reason": "3 tests failing, need to pass before completion"
},
{
"tool": "guard_validate",
"args": { "filename": "auth.ts", "ruleset": "security" },
"priority": 2,
"reason": "Security validation required"
}
]
}nextToolCalls are ordered by priority:
- Priority 1: Critical blockers (failing tests)
- Priority 2: Required validations (guard checks)
- Priority 3: Recommended actions (documentation)
After resume or when blocked:
// Get current task status
const status = await workflow_task_list({ status: ["blocked"] });
// Execute suggested tools in priority order
for (const call of status.nextToolCalls) {
await callTool(call.tool, { ...call.args, taskId: call.taskId });
}
// Re-check completion
await workflow_task_complete({ taskId: "fix-auth-bug" });Attempt to mark task as complete. Will check gates first.
// Request
{ "taskId": "fix-auth-bug" }
// Success response
{
"success": true,
"status": "completed",
"evidence": [
{ "type": "guard", "status": "passed" },
{ "type": "test", "status": "passed" }
]
}
// Blocked response
{
"success": false,
"status": "blocked",
"blockingGates": ["test_pass"],
"nextToolCalls": [...]
}Update task progress and check gates.
// Request
{
"taskId": "fix-auth-bug",
"status": "in_progress",
"progress": 80
}In some cases, you may need to bypass gates.
- Emergency hotfix: Critical production issue, tests can wait
- Known flaky test: Test failure unrelated to changes
- Manual verification: Human confirmed requirements met
// Force complete with reason (logged for audit)
{
"tool": "workflow_task_complete",
"args": {
"taskId": "fix-auth-bug",
"force": true,
"bypassReason": "Emergency hotfix, tests verified manually"
}
}Bypasses are logged:
{
"type": "gate:bypassed",
"taskId": "fix-auth-bug",
"timestamp": "2025-12-15T11:00:00Z",
"metadata": {
"bypassedGates": ["test_pass"],
"reason": "Emergency hotfix, tests verified manually",
"bypassedBy": "user"
}
}Default gate requirements by task type:
| Task Type | Required Gates |
|---|---|
| Feature | test_pass, guard_pass |
| Bug fix | test_pass |
| Refactor | test_pass, guard_pass |
| Hotfix | (none, but logged) |
Gates are checked automatically when calling workflow_task_complete.
# 1. Create task
workflow_task_create {
"name": "Add password reset",
"tags": ["feature", "auth"]
}
# 2. Work on implementation...
# 3. Run guard with taskId (auto-collects evidence)
guard_validate {
"code": "...",
"filename": "reset.ts",
"ruleset": "security",
"taskId": "task-001"
}
# 4. Run tests with taskId (auto-collects evidence)
testing_run {
"files": ["tests/reset.test.ts"],
"taskId": "task-001"
}
# 5. Attempt completion
workflow_task_complete { "taskId": "task-001" }
# → If all gates pass: completed
# → If gates fail: blocked + nextToolCalls- Re-run the blocking validation with taskId
- New evidence will update gate status
- Try
workflow_task_completeagain
- All required evidence may be collected
- Check
blockingGatesfor manual requirements - May need to contact admin for unblocking
- Ensure
taskIdis passed to validation tools - Check task exists:
workflow_task_list
- Session Resume - Resume with nextToolCalls
- Guard Rulesets - Validation rulesets
- Testing Observability - Test evidence
- TaskGraph Workflows - DAG-based gate policies
Last updated: December 2025