Skip to content

Preserve output from hooks that exit before reading stdin - #35194

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/e1b6e7c6ac5e39232e49b45245ea0df9d34d1fe6
Jul 24, 2026
Merged

Preserve output from hooks that exit before reading stdin#35194
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/e1b6e7c6ac5e39232e49b45245ea0df9d34d1fe6

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 24, 2026

Copy link
Copy Markdown

Preserve output from hooks that exit before reading stdin

Why

A hook can exit successfully without consuming its JSON input. If it closes
stdin while Codex is still writing, the resulting broken pipe should not hide
the hook's exit status and output.

What changed

Ignore broken-pipe errors when writing hook stdin and continue waiting for the
process result. Other stdin write errors remain failures.

Testing

Add a cross-platform regression test that sends a large input to a
fast-exiting hook and verifies that its successful status and stdout are
preserved.

## Why

A hook can exit successfully without consuming its JSON input. If it closes
stdin while Codex is still writing, the resulting broken pipe should not hide
the hook's exit status and output.

## What changed

Ignore broken-pipe errors when writing hook stdin and continue waiting for the
process result. Other stdin write errors remain failures.

## Testing

Add a cross-platform regression test that sends a large input to a
fast-exiting hook and verifies that its successful status and stdout are
preserved.

GitOrigin-RevId: e1b6e7c6ac5e39232e49b45245ea0df9d34d1fe6
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/e1b6e7c6ac5e39232e49b45245ea0df9d34d1fe6 branch from d50e008 to 634a998 Compare July 24, 2026 14:37
@copyberry
copyberry Bot merged commit 634a998 into main Jul 24, 2026
14 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/e1b6e7c6ac5e39232e49b45245ea0df9d34d1fe6 branch July 24, 2026 14:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants