Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95c05c111b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR prevents SessionEnd from hanging indefinitely by adding a bounded timeout to the broker shutdown RPC and ensuring the shutdown socket is cleaned up via a single guarded completion path.
Changes:
- Add an optional
timeoutMs(default5000) tosendBrokerShutdownand resolve on timeout. - Centralize shutdown completion logic for
data,error,close, and timeout; destroy the socket during cleanup. - Add a regression test for the “accepts connection but never responds” broker behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
plugins/codex/scripts/lib/broker-lifecycle.mjs |
Adds a bounded timeout + guarded cleanup to prevent indefinite shutdown waits. |
tests/broker-lifecycle.test.mjs |
Introduces a regression test for an unresponsive broker shutdown socket. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ai#303, openai#315) - Drop non-JSONL garbage on app-server stdout (openai#311) - Fix broker shutdown hang on unresponsive socket (openai#300) - Treat jobs as inactive when their PID is dead (openai#297) - Fix stale shared broker auth after account switch (openai#303) - Widen /codex:review wait threshold to ~5 files / 200 lines (openai#315) - Update test fixtures to include pid for PID-alive checks Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Confirmed on plugin v1.0.4 (Node 26, macOS). Reproduces as Applied this fix's approach locally — bounded timeout in One minor note: a 1s default bounds the wait well under the 5s hook budget; 5s leaves no cushion before the harness cancels the hook. Either works for the hang itself, but a sub-budget default also fixes the "Hook cancelled" message, not just the indefinite hang. |
|
Windows 11 / plugin 1.0.6 reproduction adds a host-bound constraint to this PR. The current Codex host reports: Using a disposable named pipe that accepts {"event":"still_running","ms":3218}
{"event":"exit","ms":3227,"code":null,"signal":"SIGTERM"}Controls on the same machine: no broker, five runs, exit 0 in 1244.3/280.5/346.5/362.4/353.1 ms; responsive pipe, exit 0 in 360 ms. No real broker or job was touched. So the proposed default This is independent of Codex — codex-session: 01a08730 (win) |
Summary
Fixes a SessionEnd hang where
sendBrokerShutdowncould wait indefinitely if the broker accepted the shutdown socket connection but never replied, errored, or closed.This adds a bounded timeout to the shutdown RPC and uses a single guarded cleanup path for
data,error,close, and timeout.Changes
timeoutMs = 5000tosendBrokerShutdownbroker/shutdownbut never respondsTesting
node --test tests/broker-lifecycle.test.mjs npm testFull suite passed locally: 87 passed, 0 failed.
Fixes #288 .