Skip to content

fix(taskctl): resurrectionScan doesn't handle adversarial-running stage on Pulse restart #263

@randomm

Description

@randomm

Task Description

When Pulse restarts, resurrectionScan iterates over in-progress tasks and handles:

  • stage: developing → advances to reviewing (preserve worktree)
  • All other stages → reset to idle (destroy worktree)

But adversarial-running tasks are NOT handled correctly. They fall into the "other stages" branch, which destroys the worktree and resets to idle — losing the developer's work. The correct behavior is to reset stage to reviewing (preserving worktree) so Pulse re-spawns the adversarial agent on the next tick.

Root Cause

Line 122 only checks for stage === 'developing'. The adversarial-running case should also preserve the worktree and reset to reviewing.

Fix

Add adversarial-running handling in resurrectionScan:

  • Clear assignee / assignee_pid
  • Reset stage to reviewing (so adversarial re-spawns)
  • Preserve worktree and branch (developer's work is there)
  • Add comment: 'Resurrected: adversarial session ended before restart. Returned to reviewing.'

Quality Gates (Non-Negotiable)

  • TDD: Write tests before implementation
  • Coverage: 80%+ test coverage for new code
  • Linting: All code passes project linting rules
  • Local Verification: All tests pass locally before completion

Acceptance Criteria

  • resurrectionScan resets adversarial-running tasks to reviewing stage (not idle)
  • Worktree and branch are preserved
  • Unit test covers the new branch in pulse.test.ts or a new fixture

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