-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Goal
Write an in-process integration test that drives the complete Pulse happy path without a live binary, using TDD to fix the stuck-at-developing bug.
Why
The pipeline consistently stalls at stage: developing after the developer session completes. Rather than debugging through the live binary, this test will:
- Prove exactly where the transition fails
- Drive the fix via TDD
- Prevent regression
Happy Path to Test
scheduleReadyTasks → spawnDeveloper → SessionPrompt.prompt() completes
→ next Pulse tick → heartbeatActiveAgents detects idle session
→ stage: reviewing
→ scheduleReadyTasks → spawnAdversarial → SessionPrompt.prompt() completes
→ processAdversarialVerdicts → APPROVED → commitTask → stage: done
Key Observations
spawnDevelopersetsassignee_pid: process.pid(Pulse's own PID) — soisPidAliveis always true while runningawait SessionPrompt.prompt()blocks the tick until developer completes- After prompt returns, SessionStatus for the dev session should be idle (set by
defer(() => cancel())in loop.ts) - The NEXT Pulse tick should then see
sessionAlive=false,pidAlive=true,alive=false→ transition to reviewing - Something is preventing this next tick from firing or the sessionAlive check from returning false
Suggested Approach
Mock SessionPrompt.prompt to return immediately (simulating developer completing), then run Pulse ticks manually via the exported tick functions or by directly calling heartbeatActiveAgents and scheduleReadyTasks.
Use Instance.provide + tmpdir fixture pattern from existing pipeline tests.
Export the internal tick functions (heartbeatActiveAgents, scheduleReadyTasks, processAdversarialVerdicts) if not already exported, so they can be called directly in tests.
Acceptance Criteria
- Test creates a job + task in
openstate - Test calls
scheduleReadyTasks→ task becomesin_progress, stage: developing - Test simulates developer session completing (mock SessionPrompt, clear SessionStatus)
- Test calls
heartbeatActiveAgents→ task becomesstage: reviewing - Test calls
scheduleReadyTasks→ adversarial session spawned (stage: adversarial-running) - Test simulates APPROVED verdict → task becomes
closed, stage: done -
bun testpasses,bun run typecheckpasses - If any step reveals a real bug, fix it as part of this issue (TDD)