-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
When the opencode binary restarts, resurrectionScan runs on taskctl resume. For tasks with stage: developing where the developer session is no longer alive, resurrection resets them to status: open, stage: idle, assignee: null and removes the worktree.
This destroys completed developer work. A developer that finished before the binary restarted loses all its changes.
Root Cause
resurrectionScan conflates two scenarios:
- Crash mid-development: session died unexpectedly → correct to reset and retry
- Completed before restart: session finished normally, binary restarted before heartbeat advanced stage → wrong to reset
Both look identical to resurrection: stage: developing + dead session.
Fix
In resurrectionScan, check pipeline.last_activity timestamp. If the session is dead AND the task is in stage: developing, advance to stage: reviewing instead of resetting to idle. Preserve the worktree and branch.
Alternatively: before resetting, check if the worktree has uncommitted changes. If it does, treat as completed and advance to reviewing.
Acceptance Criteria
- Developer work is preserved across binary restarts
- Task advances to
reviewingwhen developer session is dead after restart - Worktree is NOT removed when advancing to reviewing
- Crash scenario (mid-development) still correctly resets to idle
-
bun testandbun run typecheckpass