Skip to content

Preserve remote exec output until it is collected - #53622

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/b1671fad8b61a2cdecf7cf9fdf92e57c028c7af8
Oct 13, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/b1671fad8b61a2cdecf7cf9fdf92e57c028c7af8

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Preserve remote exec output until it is collected

Why

Remote process exit can arrive before the final output, and inherited pipes can keep the output stream open after exit. Removing the session at exit can lose output that should remain available to write_stdin polls.

What changed

  • Retain remote sessions with open or unread output after exit, including early exits and cancelled initial collection.
  • Collect pending output when write_stdin races with exit, skipping stdin writes once remote exit is known.
  • After initial collection finishes and the process exits, allow a five-second grace period before a final background read. Respect active polling deadlines and keep later polls available while that read recovers retained output.
  • Let explicit termination stop output collection even when the process has already exited, and install the exit watcher before cancellable cleanup.

Testing

Extend remote process event tests to cover output arriving after the initial yield, polling during a delayed final read, active polls exceeding the background grace period, resumable cancellation, and termination before the initial yield.

## Why

Remote process exit can arrive before the final output, and inherited pipes can keep the output stream open after exit. Removing the session at exit can lose output that should remain available to `write_stdin` polls.

## What changed

- Retain remote sessions with open or unread output after exit, including early exits and cancelled initial collection.
- Collect pending output when `write_stdin` races with exit, skipping stdin writes once remote exit is known.
- After initial collection finishes and the process exits, allow a five-second grace period before a final background read. Respect active polling deadlines and keep later polls available while that read recovers retained output.
- Let explicit termination stop output collection even when the process has already exited, and install the exit watcher before cancellable cleanup.

## Testing

Extend remote process event tests to cover output arriving after the initial yield, polling during a delayed final read, active polls exceeding the background grace period, resumable cancellation, and termination before the initial yield.

GitOrigin-RevId: b1671fad8b61a2cdecf7cf9fdf92e57c028c7af8
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/b1671fad8b61a2cdecf7cf9fdf92e57c028c7af8 branch from 2bbd962 to b043762 Compare October 13, 2026 09:34
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-13T09:34:29.632025Z 2bbd962 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit b043762 into main Oct 13, 2026
15 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/b1671fad8b61a2cdecf7cf9fdf92e57c028c7af8 branch October 13, 2026 09:34
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 2026
@nittanochan
nittanochan deployed to issue-triage October 13, 2026 10:02 — with Image GitHub Actions Active
@nittanochan
nittanochan deployed to issue-triage October 13, 2026 10:02 — with Image GitHub Actions Active
@nittanochan
nittanochan deployed to issue-triage October 13, 2026 10:02 — with Image GitHub Actions Active
@nittanochan
nittanochan deployed to issue-triage October 13, 2026 10:03 — with Image GitHub Actions Active
@ksvs1984
ksvs1984 deployed to issue-triage October 13, 2026 10:07 — with Image GitHub Actions Active
@ksvs1984
ksvs1984 deployed to issue-triage October 13, 2026 10:07 — with Image GitHub Actions Active
@ksvs1984
ksvs1984 deployed to issue-triage October 13, 2026 10:07 — with Image GitHub Actions Active
@ksvs1984
ksvs1984 deployed to issue-triage October 13, 2026 10:09 — with Image GitHub Actions Active
@son-lavie
son-lavie deployed to issue-triage October 13, 2026 10:09 — with Image GitHub Actions Active
@son-lavie
son-lavie deployed to issue-triage October 13, 2026 10:09 — with Image GitHub Actions Active
@son-lavie
son-lavie deployed to issue-triage October 13, 2026 10:09 — with Image GitHub Actions Active
@son-lavie
son-lavie deployed to issue-triage October 13, 2026 10:10 — with Image GitHub Actions Active

This branch was successfully deployed

1 active deployment
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.

6 participants