Repository navigation
Description
What happened
If the signaled owner becomes a zombie (its parent does not reap it), unlock reports termination_failed with owner_did_not_exit_before_timeout and exits 3, even though the process has terminated and the lock was released.
ps -p <pid> -o lstart= still returns the original start time for a zombie, so originalProcessExited returns false for the whole polling period.
Reproduction with a fixture owner forked under a parent that does not reap (perl fork + sleep):
{"outcome":"termination_failed","processExited":false,"lockReleased":true,"transcriptUnchanged":true}What you expected
A terminated-but-unreaped owner is recognised as exited (for example via ps -o stat= containing Z), or reported with a distinct reason such as owner_zombie, instead of a misleading timeout.
Environment
codex-unlock0.4.0 at6227e6c- macOS 27.0 arm64, Node.js 22.14.0
Source evidence
- Exit decided from start time only:
Lines 167 to 173 in 6227e6c
export function originalProcessExited( originalStartTime: string, observation: ProcessStartObservation, ): boolean | null { if (observation.status === "unknown") return null; return observation.status === "absent" || observation.startTime !== originalStartTime; } - Polling loop and timeout reason:
Lines 95 to 124 in 6227e6c
while (Date.now() <= deadline) { const [startObservation, lockProbe] = await Promise.all([ processStartTime(owner.pid), Promise.resolve(probeLock(inspection.lock.path)), ]); processObservation = startObservation; lastLockProbe = lockProbe; processExited = originalProcessExited(owner.startTime, startObservation); lockReleased = lockProbe.status === "free"; if (processExited === true && lockReleased) { break; } await delay(100); } let transcriptUnchanged: boolean | null = null; const reasons: string[] = []; try { transcriptUnchanged = (await stableFileHash(transcriptPath)).hash === transcriptHash; if (!transcriptUnchanged) reasons.push("transcript_changed_during_unlock"); } catch (error) { reasons.push(`post_unlock_transcript_hash_failed:${errorText(error)}`); } if (processExited === null) { reasons.push( `owner_exit_unknown:${processObservation.error ?? "process observation failed"}`, ); } else if (!processExited) { reasons.push("owner_did_not_exit_before_timeout"); } - Success requires
processExited === true:Line 133 in 6227e6c
const verified = processExited === true && lockReleased && transcriptUnchanged === true;
Acceptance criteria
- Zombie state is detected and either treated as exited or surfaced with a dedicated reason.
- A fixture test with an unreaped child covers the outcome and exit code.
Scope and limitations
- Fails in the safe direction (never reports false success). Frequency is low because parents normally reap Codex processes.
Checked
- security: distinguish process exit from process inspection failure #12 distinguished exit from inspection failure but did not cover zombies.
Activity
fix: classify post-signal owner exit and lock reacquisition