Skip to content

fix(taskctl): use assignee_pid for liveness in resurrectionScan and heartbeatActiveAgents #254

@randomm

Description

@randomm

Problem

Both resurrectionScan and heartbeatActiveAgents in pulse.ts use isSessionActivelyRunning(task.assignee) to check if a developer session is alive. This reads from SessionStatus, a module-level in-memory Map.

After a binary restart, SessionStatus can contain stale busy entries for sessions from before the restart. This causes tasks to get stuck at stage: developing forever after restart.

Root Cause

SessionStatus state is not cleared on restart. isPidAlive(task.assignee_pid) is the authoritative signal.

Fix

Add PID-based liveness check in both resurrectionScan and heartbeatActiveAgents:

  • Dead if EITHER SessionStatus is idle OR assignee PID is dead
  • In resurrectionScan: if stage === developing and dead, advance to reviewing (preserve worktree) instead of resetting to idle

Acceptance Criteria

  • After binary restart, task with stage: developing and dead assignee PID advances to reviewing within one Pulse tick
  • Worktree preserved when advancing to reviewing
  • bun test and bun run typecheck pass

Closes #252, #253

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