Title: codex-proxy: PR #693's turn.failed parser accepts string and message-less error shapes that are untested — and the message-less shape reports 'exited with code 0' as the failure cause · Issue #694 · developing-today/code · GitHub
Open Graph Title: codex-proxy: PR #693's turn.failed parser accepts string and message-less error shapes that are untested — and the message-less shape reports 'exited with code 0' as the failure cause · Issue #694 · developing-today/code
X Title: codex-proxy: PR #693's turn.failed parser accepts string and message-less error shapes that are untested — and the message-less shape reports 'exited with code 0' as the failure cause · Issue #694 · developing-today/code
Description: Finding PR #693 (merged, commit ed0a71ecc29befe03d4960926fb8ffcaf349d05e, merge b286aaaafb09375f685f4cd6fb43dbc85e1aa8b8) added turn.failed handling to bin/codex-proxy.mjs, but only one of the three error shapes its own parser accepts is...
Open Graph Description: Finding PR #693 (merged, commit ed0a71ecc29befe03d4960926fb8ffcaf349d05e, merge b286aaaafb09375f685f4cd6fb43dbc85e1aa8b8) added turn.failed handling to bin/codex-proxy.mjs, but only one of the thre...
X Description: Finding PR #693 (merged, commit ed0a71ecc29befe03d4960926fb8ffcaf349d05e, merge b286aaaafb09375f685f4cd6fb43dbc85e1aa8b8) added turn.failed handling to bin/codex-proxy.mjs, but only one of the thre...
Opengraph URL: https://github.com/developing-today/code/issues/694
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"codex-proxy: PR #693's turn.failed parser accepts string and message-less error shapes that are untested — and the message-less shape reports 'exited with code 0' as the failure cause","articleBody":"## Finding\n\nPR #693 (merged, commit `ed0a71ecc29befe03d4960926fb8ffcaf349d05e`, merge `b286aaaafb09375f685f4cd6fb43dbc85e1aa8b8`) added `turn.failed` handling to `bin/codex-proxy.mjs`, but only one of the three error shapes its own parser accepts is tested — and the shape with no usable message produces a self-contradictory error detail on current main.\n\nThe parser at `bin/codex-proxy.mjs:374-378` accepts three shapes:\n\n```js\nif (event.type === 'turn.failed') {\n const msg = typeof event.error === 'string'\n ? event.error\n : (event.error && typeof event.error.message === 'string' ? event.error.message : '');\n turnFailedMessage = msg;\n}\n```\n\n1. `error: {message: \"...\"}` — tested (stub modes `INBANDFAIL` / `INBANDPARTIAL` in `bin/codex-proxy.test.mjs`).\n2. `error: \"...\"` (a bare string) — **no test**. The stub never emits this shape.\n3. `error` missing, `null`, or `{}` with no string `message` — **no test**, and this shape is broken in its detail (below).\n\n## Evidence — reproduced on current main (`b286aaa`, = `gh api commits/main`)\n\nUsing a stub `codex` at `$HOME/.local/bin/codex` (the same resolution the test suite uses) emitting `turn.failed` + exit 0 with no stderr:\n\n- String shape: `{\"type\":\"turn.failed\",\"error\":\"stub string error\"}` → `500 {\"error\":{\"message\":\"Codex execution failed: stub string error\"}}` — works, but is unpinned.\n- No-error shape: `{\"type\":\"turn.failed\"}` → `500 {\"error\":{\"message\":\"Codex execution failed: codex exec exited with code 0\"}}`\n- Empty-object shape: `{\"type\":\"turn.failed\",\"error\":{}}` → same: `Codex execution failed: codex exec exited with code 0`\n\nThe last two fall through at `bin/codex-proxy.mjs:434`:\n\n```js\nconst detail = (turnFailedMessage || stderrLine || fallback).trim();\n```\n\nwhere `fallback` (lines 429-433) was written for the exit-code path and, for an in-band failure on an exit-0 run, reads `` `codex exec exited with code ${code}` `` with `code === 0`. The client is told the run failed *because it exited with code 0* — the same class of misleading fallback #676 fixed for the signal case (`code null`, pinned by the test asserting the detail does not match `/code (null|-2)\\b/`), reintroduced for the new in-band path. Whether real `codex exec --json` ever emits a message-less `turn.failed` is beside the point: the parser explicitly handles that shape (it maps it to `''` rather than ignoring the event), so the detail it produces should be coherent.\n\nSingle-repo: `bin/codex-proxy.mjs` / `turnFailedMessage` exist only in this repo (git-grep clean in the developing-today/opencode, developing-today/openchamber and dezren39/nix clones).\n\n## Why it matters\n\n- The string and message-less shapes can regress silently (e.g. a parser refactor dropping the `typeof event.error === 'string'` branch) with the whole suite green, because no stub emits them.\n- When the message-less shape does occur, the only diagnostic a client/operator gets actively misstates the cause, sending debugging toward the exit path that actually succeeded.\n\n## Acceptance criteria\n\n- [ ] Add stub modes + tests (both stream and non-stream, via the existing `assertFailure` helper) for `turn.failed` with `error` as a bare string, pinning the string as the error detail.\n- [ ] Add stub modes + tests for `turn.failed` with no usable error message (`error` absent and/or `{}`), no stderr, exit 0.\n- [ ] For the message-less in-band case, the error detail no longer claims the run \"exited with code 0\" (e.g. a generic `codex turn failed` detail when the failure came from `turn.failed` and the exit code is 0); the detail for genuine non-zero exits is unchanged.\n- [ ] Ablation: reverting only the parser's string branch, or only the new fallback, makes exactly the corresponding new tests fail.\n- [ ] Full suite: `node --test bin/*.test.mjs` passes.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-23T22:20:51Z","url":"https://github.com/developing-today/code/issues/694"}
| 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:dfee1f2c-3516-7675-396c-3416097662a8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BEB0:0DF6:C7C0AB:103B467:6B0641B8 |
| html-safe-nonce | 96c15474fe68d7faf0d27a29012cf2c9539956be69dcb9b711cb8ce92f7fd95b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUIwOjBERjY6QzdDMEFCOjEwM0I0Njc6NkIwNjQxQjgiLCJ2aXNpdG9yX2lkIjoiNzQyNDU2NzI1MzIxNzQ2MDY2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 75f7fc0c4d43d9b4f9fb2ba23a4619e088d45dff09810b0f42031283ea7897bd |
| hovercard-subject-tag | issue:6006297268 |
| 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/694/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ec0d6a353283599984d7b79f85fde84888a803ef5b0360a741402473e235488/developing-today/code/issues/694 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ec0d6a353283599984d7b79f85fde84888a803ef5b0360a741402473e235488/developing-today/code/issues/694 |
| og:image:alt | Finding PR #693 (merged, commit ed0a71ecc29befe03d4960926fb8ffcaf349d05e, merge b286aaaafb09375f685f4cd6fb43dbc85e1aa8b8) added turn.failed handling to bin/codex-proxy.mjs, but only one of the thre... |
| 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 | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| 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 | ac613d3698d3d8565651455086e1f74da07bf277 |
| 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