fix(runtime): skip stale pid registration#279
Conversation
Autohealing Verification — schedule-e217cf83-29108401222This PR is from a first-time contributor, so GitHub Actions CI has not yet been authorized to run on the Local CI results
Change assessmentThe diff adds a terminal-status guard before the deferred PID-file append in NoteThis comment is a CI verification pass, not an approval — a maintainer still needs to approve workflow runs to trigger the hosted CI on this branch. No code changes were made here by the autohealing agent. |
|
Great, thanks @fengjikui. |
Summary
setStatus(..., 'complete')wins before the asyncgetPidIdentity(...).then(...)append runsWhy
createTask()records orphan-reaper PID entries after an async process identity lookup. A very fast Copilot subprocess can become terminal before that lookup resolves. In that ordering,setStatus(...terminal...)has already removed the PID entry, but the delayed append can write the completed task back into the orphan PID file.That leaves stale orphan-reaper state for a task that is no longer running. Checking the current task status immediately before append keeps the existing running/cancelling behavior while avoiding terminal-task resurrection in the pid file.
Validation
bun test tests/task-registry.test.ts tests/pid-file.test.tsbun run test:unitbun run typecheckbun run lintbun run buildnpm pack --dry-run --jsonNote: local
bun test/bun run test:tuion my macOS+Bun 1.3.14 environment hits a Bun SIGTRAP after visible TUI tests start; the touched runtime/unit suites above pass and cover this change.