AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-248
  5. plan
  6. plan.md
plan.md(1.8 KB)· Apr 2, 2026· 1 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: Unit tests for BLOCKED:PERSISTENT → gated status transition#

Summary#

Add missing edge-case unit tests in internal-adapter.service.spec.ts and create a new phase-hooks.service.spec.ts to cover the BLOCKED:PERSISTENT → status=gated transition and the gated hook category side effect from commit #243.

Files#

FileActionDescription
src/internal-adapter/internal-adapter.service.spec.tsmodifyAdd edge-case tests: already-gated task, transient block resolved before threshold
src/hooks/phase-hooks.service.spec.tscreateUnit tests for onPhaseBlocked with gated category

Steps#

  1. Add "already gated" edge case to internal-adapter.service.spec.ts: create a task with status=gated, fire BLOCKED:PERSISTENT, assert no error and status remains gated with updated gatePhase/gateReason.
  2. Add "clears before threshold" edge case to internal-adapter.service.spec.ts: fire one BLOCKED:TRANSIENT (below MAX_TRANSIENT_RETRIES), then fire COMPLETE — assert status is NOT gated and task advances normally.
  3. Create phase-hooks.service.spec.ts: test onPhaseBlocked with category='gated' for a non-refine/review phase — assert addLabel('agent-blocked') is called and comment body contains 🚫 Phase persistently blocked.
  4. Test gated category early return for refine/review: call onPhaseBlocked with category='gated' and phase='refine' or phase='review' — assert no label added and no comment posted.

Verification#

  • npm run test passes with all new tests green
  • npm run lint passes with zero warnings
  • No production code changes

Risks#

  • PhaseHooksService constructor has four dependencies (GitHubService, ConfigService, CompoundService, EventService) — all must be mocked correctly in the new spec file.
ContextPrd