"Which helper is current" is implemented twice, and neither copy checks process identity
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 ownbyRecencysort 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.
ndycode/codex-multi-auth#648 - fix(codex): route resume/fork through the canonical home and bound helper shutdown (๐ Related PRs
#647) [closed]
ndycode/codex-multi-auth#658 - fix: resolve issues #652โ#656 [merged]
ndycode/codex-multi-auth#660 - fix(codex): route app-server through the canonical home (#659) [open]
ndycode/codex-multi-auth#664 - fix(codex): stop runtime helpers from leaking past their idle timeout (#663) [open]
ndycode/codex-multi-auth#665 - fix(codex): reap app helpers stranded by the detach grace [open]
๐ Issue Planner
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
- [ ] Create Plan
๐งช Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
๐ฌ Have feedback or questions? Drop into our discord!
Fixed by #669, merged to main in 0e66b1f.
Left open by a syntax slip in the PR body: Closes #666, #667, #668 only registers the keyword against the first number, so #666 closed automatically and this one did not. Closing by hand.
- #667 โ both hand-rolled selectors replaced by
selectRuntimeHelperStatusinlib/runtime/app-helper-selection.ts;printRotationStatusnow selects once and threads onenowthrough the status line, the live count and the account marker. Liveness is identity-checked via record freshness, and PIDs are validated as positive integers. - #668 โ PID sentinels and
process.ppidreplaced with processes the tests own; the recency sort exercised with two live candidates; all seven fault injectors in the published wrapper gated behind an explicit opt-in with a strict digits-only parse; the owner-path literal reusesresolveRuntimeHelperOwnerPath.
Covered by regression tests plus a stress suite at the scale of the original report, mutation-checked.