{
"issueNumber": 232,
"branchName": "feat/232-agent-replan-directive",
"generatedAt": "2026-04-01T12:00:00Z",
"stories": [
{
"id": "S1",
"title": "Add 'replan' to ALLOWED_DIRECTIVES and add closePR/deleteBranch to GitHubService",
"priority": 1,
"dependsOn": [],
"acceptanceCriteria": [
"DirectiveValue type includes 'replan'",
"GitHubService.closePR() calls PATCH /pulls/:number with state:'closed'",
"GitHubService.deleteBranch() calls DELETE /git/refs/heads/:branch",
"Both methods handle 404/422 as success (already closed/deleted)",
"Unit tests for closePR and deleteBranch pass"
],
"passes": false,
"completedAt": null
},
{
"id": "S2",
"title": "Add cleanupLabelsForReplan to PhaseHooksService and replan handler to DirectiveService",
"priority": 2,
"dependsOn": [
"S1"
],
"acceptanceCriteria": [
"cleanupLabelsForReplan removes 'refined', 'in-review', 'agent-blocked' and adds 'in-refinement'",
"Replan on completed/archived task is rejected with explanatory comment",
"Replan on task already in active refine is a no-op with explanatory comment",
"Normal replan: closes PR, deletes branch, resets all phases, clears PR metadata, records replan_triggered event, enqueues refine",
"PR/branch close failure (non-404) logs warning but replan proceeds",
"Confirmation comment posted with details",
"Unit tests cover normal replan, already-in-refine guard, completed-task guard"
],
"passes": false,
"completedAt": null
},
{
"id": "S3",
"title": "Wire replan into PhaseRouterService and verify full pipeline",
"priority": 3,
"dependsOn": [
"S2"
],
"acceptanceCriteria": [
"'replan' added to VALID_DIRECTIVES array",
"resolvePhase returns 'refine' for replan directive",
"Directive handling block processes replan (reset + enqueue, no active-process rejection)",
"npm run lint passes with zero warnings",
"npm run test passes all tests",
"npm run build compiles without errors"
],
"passes": false,
"completedAt": null
}
]
}