Skip to content

[Bug]: start can recover the Codex journal under a live owner when the first liveness probe misses it #7827

Closed

Description

@lidge-jun

Client or integration

Other

Area

Platform (Windows / macOS / Linux)

Summary

tests/cli/cli-start-journal-order.test.ts > "start and ensure journal ownership (#1230) > a healthy proxy owner preserves the journal for both start and ensure" fails intermittently on hosted Windows shards. The failure shows a product-path ordering problem, not only a slow test:

  1. handleStart calls findProxyOwnerBeforeJournalRecovery() (src/cli/index.ts, findLiveProxy(START_OWNERSHIP_LIVENESS), 3 attempts). This first probe returns no live owner although the fixture's owner proxy is running and was healthy moments earlier.
  2. Because the probe saw no owner, recoverStartStateUnderOwnershipLease runs reconcileStartupJournal() and restores the Codex config from the journal ("Previous session (PID 999999) did not shut down cleanly. Codex state restored from journal.").
  3. The lease-held bind fence then calls findLiveProxy(START_OWNERSHIP_LIVENESS) again. This second probe does find the owner and refuses with "Proxy appeared before bind (PID unknown, port N)".

The test expects "Proxy already running" and an untouched journal and config. The run instead rewrote the Codex config under a live owner. The pre-recovery liveness answer is a single negative observation, and it authorizes a destructive journal recovery that the later fence contradicts.

Expected: a live owner that the bind fence can see must never have its journal and config recovered by the same start. Recovery should not proceed on a negative probe that a recheck under the ownership lease would contradict.

Reproduction

Intermittent on hosted windows-latest under shard load; not reproduced locally yet.

  • dev lane=all run 40434080650 (head 1de2b71b), a Windows shard: (fail) ... a healthy proxy owner preserves the journal for both start and ensure [21025.89ms].
  • PR fix(windows): preserve bounded ACL failure diagnostics #7773 lane=all run 40513796719 (head a32f7a11), job windows 9/9: same case, stderr Previous session (PID 999999) did not shut down cleanly. Codex state restored from journal. then Proxy appeared before bind (PID unknown, port 60775). Use 'ocx stop' first.

Version

dev 2.94.0 line (1de2b71b, a32f7a11)

Operating system

Windows (hosted windows-latest)

Provider and model

Not applicable (test fixture).

Logs or error output

error: expect(received).toContain(expected)
Expected to contain: "Proxy already running"
Received: "⚠️  Previous session (PID 999999) did not shut down cleanly. Codex state restored from journal.\n⚠️  Proxy appeared before bind (PID unknown, port 60775). Use 'ocx stop' first.\n"
(fail) start and ensure journal ownership (#1230) > a healthy proxy owner preserves the journal for both start and ensure [18862.50ms]

Screenshots and supporting files

No response

Redacted configuration

n/a

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    platform
    on Oct 27, 2026
  2. lidge-jun commented on Oct 28, 2026

    @lidge-jun
    OwnerAuthor

    Fixed on dev by #7851 (squash merge 7a1565b). start now rechecks proxy ownership under the ownership lease immediately before journal recovery, and recovers only when that recheck proves the owner absent; a live owner is adopted, and an unverifiable answer refuses startup while preserving the PID record and journal. A negative early probe no longer authorizes recovery. Closing manually because pull requests into dev do not auto-close issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplatform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions