Title: codex-proxy: exec transports have no turn deadline — a hung codex exec child hangs the request forever and is never killed · Issue #2157 · developing-today/code · GitHub
Open Graph Title: codex-proxy: exec transports have no turn deadline — a hung codex exec child hangs the request forever and is never killed · Issue #2157 · developing-today/code
X Title: codex-proxy: exec transports have no turn deadline — a hung codex exec child hangs the request forever and is never killed · Issue #2157 · developing-today/code
Description: Problem bin/codex-proxy.mjs's exec transports have no turn deadline. runCodexOnce (bin/codex-proxy.mjs:803, spawn at :815) returns a promise that settles only from the child's close handler (:921) or a synchronous spawn throw — there is ...
Open Graph Description: Problem bin/codex-proxy.mjs's exec transports have no turn deadline. runCodexOnce (bin/codex-proxy.mjs:803, spawn at :815) returns a promise that settles only from the child's close handler (:921) ...
X Description: Problem bin/codex-proxy.mjs's exec transports have no turn deadline. runCodexOnce (bin/codex-proxy.mjs:803, spawn at :815) returns a promise that settles only from the child's close handler...
Opengraph URL: https://github.com/developing-today/code/issues/2157
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"codex-proxy: exec transports have no turn deadline — a hung codex exec child hangs the request forever and is never killed","articleBody":"## Problem\n\n`bin/codex-proxy.mjs`'s exec transports have no turn deadline. `runCodexOnce` (`bin/codex-proxy.mjs:803`, spawn at `:815`) returns a promise that settles only from the child's `close` handler (`:921`) or a synchronous spawn throw — there is no timer anywhere in the function. Both exec call sites await it directly: the warm-resume attempt (`:1219`) and the cold full-history run (`:1242`). If the spawned `codex exec` child hangs — alive but never finishing its turn (upstream stall, a CLI waiting on something, a wedged session resume) — the HTTP request hangs forever, the child process is never killed, and the promise never settles. The only recovery is the client giving up; even then nothing in `runCodexOnce` kills the child on client disconnect (no `res.on('close')` hook reaches it — `onSpawn` only registers the child for the caller's bookkeeping).\n\nEvery sibling path in the same file, and in the sibling proxies, is bounded:\n\n- The app-server transport in this same file: connect timeout 10s (`:504`), JSON-RPC timeout 30s (`:635-641`).\n- `bin/claude-code-proxy.mjs`: `TURN_TIMEOUT_MS = 300 * 1000` (`:55`) applied to its spawned turns (`:455-461`), with a SIGKILL escalation 3s after the deadline (`:480`).\n- `bin/muse-proxy.mjs`'s warm path: `WARM_TURN_TIMEOUT_MS = 300 * 1000` (`:300`, applied `:585-587`).\n\nThe exec fallback is precisely the path taken when the bounded app-server path has already failed — i.e. when the backend is already misbehaving — and it is the one path with no bound at all.\n\n## Evidence (verified this run, main `b2b885b9`)\n\nSandbox probe with a fake `codex` binary (`$HOME/.local/bin/codex` under a scratch HOME; the fake answers `debug models` with garbage so the static catalog floor is used, and sleeps 60s for any other invocation), `CODEX_PROXY_TRANSPORT=exec`:\n\n- Proxy log: `Spawning: .../codex exec --json --skip-git-repo-check ... -m gpt-5.6-luna ...` — the request reached `runCodexOnce`'s spawn.\n- `curl -X POST /v1/chat/completions` (non-streaming): **no response after 8s** (curl killed by `timeout 8`, exit 124, 0 response bytes) while the fake child (`sleep 60`) was still running. Nothing in the proxy would have ended the request before the child's own exit at 60s — and a truly hung child never exits.\n\nDedup: `gh` searches for `codex-proxy exec timeout`, `runCodexOnce`, and `codex-proxy hang` (open + closed) return no covering issue. Adjacent but distinct: #2097/#2100/#2102 are the same no-timeout class in design-code-proxy, clef-proxy, and antigravity-ls-proxy (HTTP fetch / RPC paths in other files); the muse-proxy exec path has the same defect and is filed separately this run.\n\n## Why it matters\n\ncode-queue workers and OpenCode sessions route real coding turns through this proxy. One hung `codex exec` child wedges its request indefinitely and leaks a process; repeated hangs accumulate children and stall every caller queued behind them, with no log line or error to act on. The fallback path exists for resilience — unbounded, it converts a backend stall into a permanent proxy-side hang.\n\n## Acceptance criteria\n\n- [ ] A `codex exec` turn that exceeds a named deadline (consistent with the house convention, e.g. claude-code-proxy's / muse-proxy's 300s turn timeout, or a `CODEX_PROXY_*` env override parsed strictly) is terminated (SIGTERM, then SIGKILL after a short grace) and the request settles with an error result through the existing `done({ok:false, ...})` shape.\n- [ ] The deadline applies to both `runCodexOnce` call sites (warm resume and cold run); the app-server transport's existing timeouts are unchanged.\n- [ ] A client disconnect before the deadline also kills the exec child (no orphaned `codex exec` processes).\n- [ ] Regression tests in `bin/codex-proxy.test.mjs` style: a fake child that never exits is killed at the deadline and the request errors; a fake child that completes normally is unaffected.\n- [ ] No change to the success/failure semantics judged from `turn.failed` / exit code (#676/#680 behavior preserved for children that do exit).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-29T06:48:09Z","url":"https://github.com/developing-today/code/issues/2157"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e50b2130-e2e0-5fdc-5b8b-0a208544decc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 92C0:20D4:18FA49:214A22:6B06337E |
| html-safe-nonce | 89972818ca77d845a740f88aa923991e5d7b008bc053e12ce7821b1a7254f8ba |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkMwOjIwRDQ6MThGQTQ5OjIxNEEyMjo2QjA2MzM3RSIsInZpc2l0b3JfaWQiOiI3MTQyMjA1Nzk5NTUxODczOTE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 56b2c970421fc759665bdfd1cdd1d4ce53c4ae8cbdce8413d6161b05111690e4 |
| hovercard-subject-tag | issue:6094515138 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/2157/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81d86c36841aeb11a5d52408e915ad7a0768dcf8bab67b7721763c8a4c06e5f9/developing-today/code/issues/2157 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81d86c36841aeb11a5d52408e915ad7a0768dcf8bab67b7721763c8a4c06e5f9/developing-today/code/issues/2157 |
| og:image:alt | Problem bin/codex-proxy.mjs's exec transports have no turn deadline. runCodexOnce (bin/codex-proxy.mjs:803, spawn at :815) returns a promise that settles only from the child's close handler (:921) ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | c3584c853cd39700ecff6e2cf8364295ffdb5313e571046c41cd2479270f7df0 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9eb3bb1597d09170a5f282cd38ae376dee1a5ec1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width