Skip to content

[codex] Preserve child process termination context#3469

Merged
juliusmarminge merged 1 commit into
mainfrom
codex/stdio-termination-errors
Jun 21, 2026
Merged

[codex] Preserve child process termination context#3469
juliusmarminge merged 1 commit into
mainfrom
codex/stdio-termination-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

  • attach the child process PID to ACP and Codex App Server termination errors
  • retain the exact exit-status read failure as the transport error cause
  • keep normal process exits cause-free while preserving their exit code
  • cover both symmetric adapters with compact focused tests

Why

Termination failures previously retained the exit code or read failure but not the process identity, which made concurrent child-process failures harder to correlate. The existing termination helper remains because it performs an effectful status read and selects between distinct error types; it is not a constructor-only wrapper.

Validation

  • vp test across all effect-acp and effect-codex-app-server test files: 47 passed
  • vp check
  • vp run typecheck

Note

Low Risk
Additive optional fields on error types and clearer diagnostics; no changes to auth, data handling, or core transport behavior beyond enriched error payloads.

Overview
Child process termination errors now carry the process ID in both effect-acp and effect-codex-app-server. makeTerminationError passes handle.pid into AcpProcessExitedError / CodexAppServerProcessExitedError on normal exit and into the corresponding transport error when reading exit status fails; the exit-status failure still uses the original cause unchanged.

The termination helper now accepts a narrowed ChildProcessTerminationHandle (pid + exitCode only). Error schemas gain an optional pid field on process-exited and read-exit-status transport types. New stdio.test.ts files assert PID retention, cause identity, and that user-facing messages stay free of nested diagnostic text.

Reviewed by Cursor Bugbot for commit f751e75. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Preserve child process PID in termination errors for ACP and Codex App Server

  • Adds an optional pid field to AcpProcessExitedError, AcpTransportError, CodexAppServerProcessExitedError, and CodexAppServerTransportError schema classes.
  • Updates makeTerminationError in both packages to accept a ChildProcessTerminationHandle (typed as Pick<ChildProcessHandle, 'exitCode' | 'pid'>) and populate pid on all produced errors.
  • Adds test suites in both packages verifying PID propagation and correct error messages for both exit-code success and failure cases.

Macroscope summarized f751e75.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dcb27feb-bf79-4558-89cc-52389a70f5db

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/stdio-termination-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 21, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds optional pid fields to error classes and populates them when creating termination errors - a simple, backwards-compatible enhancement for debugging context with no runtime behavior changes.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
juliusmarminge merged commit cebbe6f into main Jun 21, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/stdio-termination-errors branch June 21, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant