Follow-up from CodeRabbit review of #665; the code belongs to #664 rather than to that PR.
Two sites pick a live running helper by newest updatedAt, falling back to the freshest record, using isProcessAlive(pid) alone as the liveness test:
lib/codex-manager/commands/rotation.ts:576-587 (liveAppRuntimeHelpers / selectAppRuntimeHelperStatus)
lib/runtime/runtime-current-account.ts:168-188 (its own byRecency sort and live filter)
A single codex-multi-auth rotation status run executes both copies, so any drift between them produces a status line and an account marker that disagree.
The shared gap is identity: a stale legacy runtime-rotation-app-helper.json whose PID was recycled passes isProcessAlive, counts as live, and can be selected as the current helper — the exact trust that #664 removed from the helper's own idle reaper, still present in the readers. lib/runtime/app-bind.ts:1233-1236 already parses startedAt, so the identity check is available.
Suggested: one shared selector used by both call sites, with startedAt parsed in readAppRuntimeHelperStatusFile so liveness can be identity-checked. Regression case: two live per-PID status files plus one stale legacy file with a recycled PID, asserting both readers agree.
Credit: CodeRabbit, on #665.
Follow-up from CodeRabbit review of #665; the code belongs to #664 rather than to that PR.
Two sites pick a live
runninghelper by newestupdatedAt, falling back to the freshest record, usingisProcessAlive(pid)alone as the liveness test:lib/codex-manager/commands/rotation.ts:576-587(liveAppRuntimeHelpers/selectAppRuntimeHelperStatus)lib/runtime/runtime-current-account.ts:168-188(its ownbyRecencysort and live filter)A single
codex-multi-auth rotation statusrun executes both copies, so any drift between them produces a status line and an account marker that disagree.The shared gap is identity: a stale legacy
runtime-rotation-app-helper.jsonwhose PID was recycled passesisProcessAlive, counts as live, and can be selected as the current helper — the exact trust that #664 removed from the helper's own idle reaper, still present in the readers.lib/runtime/app-bind.ts:1233-1236already parsesstartedAt, so the identity check is available.Suggested: one shared selector used by both call sites, with
startedAtparsed inreadAppRuntimeHelperStatusFileso liveness can be identity-checked. Regression case: two live per-PID status files plus one stale legacy file with a recycled PID, asserting both readers agree.Credit: CodeRabbit, on #665.