Repository navigation
fix(codex): close shared app-server clients with the Gateway - #205152
Conversation
Register the existing build-scoped disposer with the host singleton lifecycle so prepared runtime clients do not outlive Gateway shutdown when no Codex harness was registered. Cover the production drain at the host/plugin boundary. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: jalehman <[email protected]>
Worked on by: - @jalehman - @RomneyDa Co-authored-by: jalehman <[email protected]> Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: 1c0cddbe-1e29-4052-8c52-8666c494331a
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR registers the existing build-scoped Codex client disposer with the Gateway’s global singleton lifecycle. Example: Model discovery opens a shared Codex app-server client without registering a Codex harness, then the Gateway stops.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a concrete cleanup gap still present on main, preserves existing lifecycle ownership, and introduces no identified correctness defect. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex plugin owns shared app-server clients; Gateway shutdown drains registered singleton cleanup callbacks, which close transports and join pending startup work. flowchart TD
A[Model discovery] --> B[Shared Codex client]
B --> C[Codex app-server transport]
D[Gateway shutdown] --> E[Singleton lifecycle drain]
E --> F[Build-scoped disposer]
G[Harness retirement] --> F
F --> B
Technical reviewBest possible solution: Keep the existing build-scoped disposer as the cleanup owner and register it with the established Gateway lifecycle as this PR does. Do we have a high-confidence way to reproduce the issue? Source confirms that main exposes the disposer only through the build-scoped callback consumed by harness retirement; the author reports the new host regression failing before registration and passing afterward, but no reproduction was run during this read-only review. Is this the best way to solve the issue? This is the smallest complete production fix: it connects the existing disposer to the existing shutdown owner without adding state, changing public APIs, or replacing transport cleanup policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4e766e6e61ba. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +38, Other 0. Total +38 across 5 files. Added test files: 2. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 25, 2026, 1:38 AM ET / 06:38 UTC. |
* fix(codex): close shared app-server clients with the Gateway Register the existing build-scoped disposer with the host singleton lifecycle so prepared runtime clients do not outlive Gateway shutdown when no Codex harness was registered. Cover the production drain at the host/plugin boundary. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: jalehman <[email protected]> * fix(codex): close shared app-server clients with the Gateway Worked on by: - @jalehman - @RomneyDa Co-authored-by: jalehman <[email protected]> Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: 1c0cddbe-1e29-4052-8c52-8666c494331a --------- Co-authored-by: RomneyDa <[email protected]> Co-authored-by: jalehman <[email protected]> (cherry picked from commit c985e34)
…w#205152) * fix(codex): close shared app-server clients with the Gateway Register the existing build-scoped disposer with the host singleton lifecycle so prepared runtime clients do not outlive Gateway shutdown when no Codex harness was registered. Cover the production drain at the host/plugin boundary. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: jalehman <[email protected]> * fix(codex): close shared app-server clients with the Gateway Worked on by: - @jalehman - @RomneyDa Co-authored-by: jalehman <[email protected]> Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: 1c0cddbe-1e29-4052-8c52-8666c494331a --------- Co-authored-by: RomneyDa <[email protected]> Co-authored-by: jalehman <[email protected]>
What Changed
A prepared model runtime can open a build-scoped Codex app-server client without activating a registered Codex harness. Shutdown previously reached the disposer only through harness retirement, so that path left the transport open.
Why This Change Was Made
Register the same build-scoped disposer with the host singleton lifecycle, keeping the existing harness-retirement callback intact. The host regression opens the shared client through the Codex test facade and asserts its stdio input stays open before the real host drain and is closed afterwards. Removed one cast and lowered its assertion ratchet entry from 2 to 1.
Forward-ports 2026.11.10 release commits
fababde406e1and56c50d77fc11.Evidence
1f3262a9e4dc), the added host test failed at the post-drain assertion: stdin was still open.d32063f96c2d,codex-rs/app-server/src/lib.rs:1217–1240) terminates its single-client loop on stdio disconnect.Worked on by