Repository navigation
fix(lifecycle): retryable restart-drain code and quiet journal no-op recovery - #6686
Conversation
…te recovery Co-authored-by: agentHits <140916359+agentHits@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe changes distinguish actual file writes from already-original state during journal recovery. They also return a retryable ChangesJournal recovery reporting
Restart drain responses
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change makes restart-drain responses retryable and quiets stale journal recovery that needs no rewrite. No merge-blocking risk is evident in the supplied context. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The only supplied directly linked issue is Full details: Docstring CoverageExplanation Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 552fa7f141
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
✅ Deterministic PR hygiene checks passed. |
|
Maintainer integration into
|
Summary
Two lifecycle fixes that change what a client sees during recovery and restart.
Restart drain is retryable for every Codex version (closes #6642). While OpenCodex drains for a restart, new data-plane requests got HTTP 503 with
error.code: "server_is_overloaded". Codex maps that code toServerOverloaded("Selected model is at capacity"). Older Codex clients never retry it, and current Codex retries it only while retry advice survives, so a restart of a few seconds could end the turn with a model-capacity message. The drain now answers:{"error":{"type":"server_error","code":"server_restarting","message":"OpenCodex is restarting; retry this request."}}It keeps HTTP 503,
Content-Type: application/json,Retry-After: 5, and the receiving listener's CORS policy. Codex classifies the new code as a retryableUnexpectedStatus(openai/codexcodex-rs/codex-api/src/api_bridge.rs,codex-rs/protocol/src/error.rs). Provider overload mapping insrc/lib/errors.tsand the drain fence length (#6643) are unchanged.Journal recovery stays quiet on a no-op and warns on an incomplete recovery. This carries the journal half of #6649 by @agentHits:
restoreJournalState()reports whether it actually rewrote or removed a file, andreconcileJournal()no longer prints "did not shut down cleanly" when a stale journal needed no rewrite. On top of that, both reconcile branches (client owner and dead process) now print a content-free "recovery was incomplete; the journal was preserved" warning when restoration did not complete, for example when the generated profile cannot be removed. A quiet no-rewrite recovery also warns when the stale journal file itself could not be deleted (for example a Windows file lock), sinceremoveJournal()ignores unlink errors. Before, such a partial recovery either claimed success or, with the carried change alone, went silent. The restart-admission half of #6649 is not carried; it stays on #6649 for maintainer review.Co-authored-by: agentHits 140916359+agentHits@users.noreply.github.com
Verification
bun testonissue-452-empty-503,codex-journal,codex-journal-recovery(new),shutdown-drain,system-restart,memory-watchdog, the test-layout pair,file-size-ratchetandstructure-ssot: 204 pass / 0 fail on this head.drainingResponsethe updated drain test fails (0/1); with the previoussrc/codex/journal.tsall 11 new recovery tests fail, and the two journal-removal tests added in359e100d1ffail on552fa7f141; both pass on this head. The dead-owner tests stubprocess.kill(pid, 0)to throwESRCHinstead of relying on an unused PID, and profile-removal failure is injected with anEPERMunlinkSyncmock.Retry-After: 5, JSON content type and the new code.bun run typecheckexit 0;bun run structure:checkpass;bun run privacy:scanpass; docs-site build pass.src/server/index.tsshrinks from 887 to 885 lines (cap 893);scripts/test-layout/layout.jsonstays at 1,999 lines.Checklist
reference/management-api.md,reference/architecture.md,troubleshooting/windows-memory.md,structure/codex-home.md,structure/ops/service-and-sidecars.md,structure/runtime.md)Summary by CodeRabbit