Repository navigation
Description
What happened
An ENOENT anywhere on the lock path is classified as absent, including when the Codex home itself does not exist or thread-writer-locks is a dangling symlink. unlock then reports success:
$ codex-unlock unlock <thread> --codex-home /nonexistent/typo --json
outcome "not_locked", lockReleased true, transcript "missing", exit 0
The same happens when thread-writer-locks points to an unmounted volume, and list --codex-home /nonexistent/typo exits 0 with an empty list.
Typical triggers are a typo in --codex-home, a shell whose CODEX_HOME differs from the one Codex uses, or a home on an unmounted external volume. The real lock may be held in another home while the tool prints "Lock released: yes" and exits 0, which automation may treat as permission to start a new writer.
What you expected
A missing Codex home (or a missing/dangling thread-writer-locks directory) is not "confirmed absent". It should be reported as unknown or as a usage/configuration error, and unlock should not return lockReleased: true with exit 0.
Environment
codex-unlock0.4.0 at6227e6c- macOS 27.0 arm64, Node.js 22.14.0
Source evidence
- Any
ENOENTbecomesabsent:Lines 31 to 39 in 6227e6c
if ((error as NodeJS.ErrnoException).code === "ENOENT") { return { status: "absent", exists: false, regularFile: null, symlink: null, ownedByCurrentUser: null, snapshot: null, }; absentclassification:codex-unlock/src/inspection.ts
Lines 51 to 52 in 6227e6c
if (lockObservation === "absent") { return lockStable === false ? "unknown" : "absent"; not_lockedwithlockReleased: true:Lines 197 to 211 in 6227e6c
if ( inspection.classification === "absent" || inspection.classification === "stale_residue" ) { return unlockResult(inspection, { outcome: "not_locked", changed: false, pid: null, signalSent: null, processExited: null, processObservation: null, lockReleased: true, transcriptUnchanged: null, reasons: [inspection.classification], }); - Exit 0 for
not_locked:Line 384 in 6227e6c
if (result.outcome === "unlocked" || result.outcome === "not_locked") return 0; listtreats a missing lock directory as empty:codex-unlock/src/inspection.ts
Lines 185 to 186 in 6227e6c
if ((error as NodeJS.ErrnoException).code === "ENOENT") { names = []; - JSON contract defines
absentas "the lock path was confirmed absent":Line 80 in 6227e6c
- `absent`: the lock path was confirmed absent;
Acceptance criteria
- The Codex home and its
thread-writer-locksdirectory are verified to exist (and to be directories) before a lock is reported absent. - A missing home yields a documented non-success result for
inspect/unlockand a clear error or warning forlist. - Tests cover a nonexistent home and a dangling
thread-writer-lockssymlink.
Scope and limitations
- No signal is sent; the issue is a false success report. A home that exists but has never created
thread-writer-locksmay need a separate, explicitly documented treatment.
Checked
- fix: classify lock observation errors as unknown #11 classified lock observation errors as unknown but kept
ENOENTas absent; no issue covers a missing home.
Activity
fix: validate CLI usage and Codex home before inspection