Plan: Fix E2E failure on replan/restart plan invalidation (#263)#
Summary#
PR #261 (feat/issue-234) adds resetForReplan(), clearPlanArtefacts(), and restart PR cleanup. The CI E2E job was cancelled (timeout/infra), not a deterministic test failure. All 675 unit tests pass. The fix adds integration test coverage for the replan and restart directive lifecycles to validate the new state contracts, and re-triggers E2E CI to confirm no regression.
Files#
| File | Action | Description |
|---|---|---|
test/integration/replan-directive.integration.spec.ts | create | Integration test for /agent replan lifecycle: artefact cleanup, state reset, PR close, re-enqueue |
test/integration/restart-directive.integration.spec.ts | create | Integration test for /agent restart lifecycle: PR close, state reset, re-enqueue (no artefact cleanup) |
test/integration/blocked-persistent-to-refine.integration.spec.ts | modify | Verify ArtefactsService mock covers all methods called during directive processing |
Steps#
- Create replan directive integration test — Wire DirectiveService with real TaskStateService + in-memory SQLite + mocked GitHub/ArtefactsService. Test: task with plan+PR → replan → artefacts cleared, prNumber/prBranch nullified, replanAttempt incremented, phases reset, refine enqueued, superseded comment posted.
- Create restart directive integration test — Same wiring. Test: task with open PR → restart → PR closed with superseded comment, prNumber/prBranch cleared, phases reset, refine enqueued, plan artefacts NOT cleared.
- Verify existing integration test — Confirm
blocked-persistent-to-refine.integration.spec.tsArtefactsService mock is complete (bothclearPlanArtefactsandbuildCentralTaskDircovered — already done in PR #261, verify no drift). - Run full test suite —
npm run testandnpm run lintpass with zero regressions.
Verification#
npm run test— all tests pass including new integration testsnpm run lint— zero warnings- Re-trigger E2E CI on the PR branch to confirm the timeout was transient (not a code regression)
Risks#
- The E2E timeout was infra-related (reviewer confirmed "likely-infra") — if it recurs, the issue is in CI runner capacity, not agent-core code. Flaky E2E timeouts should not block this PR.