{
"meta": {
"agent": "planner",
"task_id": "248",
"title": "Unit tests for BLOCKED:PERSISTENT → gated status transition",
"created_at": "2026-04-02T12:00:00Z"
},
"inputs": [
{
"name": "issue-248",
"type": "context",
"ref": "https://github.com/AgentSDE/agent-core/issues/248",
"notes": "Test-only issue, no production code changes"
},
{
"name": "internal-adapter.service.ts",
"type": "file",
"ref": "src/internal-adapter/internal-adapter.service.ts",
"notes": "handlePersistentBlock sets status=gated and calls onPhaseBlocked with category='gated'"
},
{
"name": "phase-hooks.service.ts",
"type": "file",
"ref": "src/hooks/phase-hooks.service.ts",
"notes": "onPhaseBlocked early-returns for refine/review with gated category, otherwise adds label + posts comment"
},
{
"name": "internal-adapter.service.spec.ts",
"type": "file",
"ref": "src/internal-adapter/internal-adapter.service.spec.ts",
"notes": "Existing spec — has basic BLOCKED:PERSISTENT test but missing edge cases"
}
],
"outputs": [
{
"name": "plan",
"type": "plan",
"format": "md",
"content": "plan.md"
}
],
"files": [
{
"path": "src/internal-adapter/internal-adapter.service.spec.ts",
"action": "modify",
"reason": "Add edge-case tests for already-gated and clears-before-threshold"
},
{
"path": "src/hooks/phase-hooks.service.spec.ts",
"action": "create",
"reason": "New spec file for PhaseHooksService onPhaseBlocked gated category"
}
],
"steps": [
{
"id": "S1",
"summary": "Add edge-case tests to internal-adapter.service.spec.ts: already-gated task + clears-before-threshold",
"acceptance": [
"Test asserts BLOCKED:PERSISTENT on already-gated task does not error or double-transition",
"Test asserts task that completes before MAX_TRANSIENT_RETRIES does NOT have status=gated"
],
"depends_on": []
},
{
"id": "S2",
"summary": "Create phase-hooks.service.spec.ts with gated category tests",
"acceptance": [
"Test asserts onPhaseBlocked with category='gated' on non-refine/review phase adds label and posts comment",
"Test asserts onPhaseBlocked with category='gated' on refine or review phase returns early with no side effects"
],
"depends_on": []
}
],
"risks": [
{
"risk": "PhaseHooksService has 4 constructor dependencies requiring mocks",
"mitigation": "Follow existing mock patterns from internal-adapter.service.spec.ts"
}
],
"assumptions": [
"No production code changes are needed — all acceptance criteria can be met with tests alone",
"The existing test infrastructure (better-sqlite3 in-memory DB) supports the new edge-case tests"
],
"open_questions": []
}