openai / openai/codex

Passive write_stdin polling can return exit_code=143 without a correlated inner-command receipt

Open
#45,419 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI tool-calls
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Environment

  • Linux (Strato2 remote compute host)
  • Managed Codex unified exec; reporter version was not captured
  • Same-host control: codex-cli 0.154.0
  • Long command wrapped by KB_COMPACT_KEEP_LOG=1 kb-run-compact ...

Intermittent reproduction

  1. Start a multi-minute foreground command through exec_command with a short yield_time_ms so it returns an inner session_id.
  2. Keep the owning turn active.
  3. Poll that same id with empty write_stdin calls. Do not send Ctrl-C or any termination request.
  4. Intermittently, a poll returns exit_code=143 around three minutes even though the command wrapper emitted no correlated terminal receipt.

Observed on a Julia/Documenter build: the last model-visible heartbeat was [kb-run-compact +161s ...] ExpandTemplates; the retained 13,699-byte log ended at ExpandTemplates. It contained neither [kb-run-compact] exit=... nor the wrapper's retained this wrapper received SIGTERM trap stamp. Child completion/cancellation was therefore unknowable, and launching a duplicate was unsafe.

Controls

  • On the same host with Codex 0.154.0, the same yielded-session/empty-poll pattern ran 221 seconds and completed with tool exit 0 plus the wrapper's final exit=0 receipt. This is not a deterministic three-minute ceiling.
  • Deliberately TERM-signaling the wrapper produced all correlated evidence: tool 143, terminal wrapper exit=143, and a retained this wrapper received SIGTERM stamp. The passive incident had none of those wrapper signals.

Expected behavior

A yielded exec session should have a durable, runtime-owned status/lookup channel. Any terminal tool status must be correlated to the actual inner command, or explicitly labeled as transport/session termination. After a polling route is lost or passively settles, callers need to retrieve the inner command's final exit status or verify/cancel it without cross-session PID guessing.

Related: #11058 and #14824.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the exec_command and write_stdin session lifecycle, then run the yielded-session/empty-poll reproduction and compare it with deliberate SIGTERM behavior. Done means terminal status is correlated to the inner command or explicitly identified as transport termination, with a way to retrieve or verify the command's final status after polling is lost.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, cli
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.