Skip to content

fix(taskctl): heartbeatActiveAgents not transitioning developing→reviewing after binary restart #253

@randomm

Description

@randomm

Problem

After a binary restart and taskctl resume, Pulse restarts and ticks every 5 seconds. heartbeatActiveAgents checks isSessionActivelyRunning(task.assignee) for tasks with stage: developing. The developer session is dead (not in memory after restart), so isSessionActivelyRunning should return false, triggering the developing → reviewing transition.

However, the transition is NOT happening — tasks remain stuck at stage: developing indefinitely.

Suspected Causes

  1. Instance context mismatch: startPulse captures instanceContext.tryGet() at call time. After a restart, the captured context may not match the live instance, causing SessionStatus.get() inside isSessionActivelyRunning to throw and return false... but something else prevents the update.

  2. pulse_pid display bug: taskctl status shows Pulse PID: none because it reads job.pulse_pid from the DB, but the PID is stored in a lock file. These are never in sync. Low priority cosmetic issue but causes confusion.

Acceptance Criteria

  • After binary restart + resume, developing tasks with dead sessions advance to reviewing within one Pulse tick (5s)
  • Adversarial agent spawns after transition
  • taskctl status correctly reflects Pulse running state
  • bun test and bun run typecheck pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions