Skip to content

Read app-server pipes in the readability handler - #432

Merged
lynnswap merged 1 commit into
mainfrom
codex/drain-app-server-pipes
Nov 23, 2026
Merged

lynnswap merged 1 commit into
mainfrom
codex/drain-app-server-pipes

Conversation

@lynnswap

@lynnswap lynnswap commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Purpose

Keep ReviewMonitor's memory use stable as the Codex app-server writes to stdout and stderr. In a long-running instance of 0.15.0, the stdout reader's autorelease pool alone held 2.23 GiB of 16 KiB buffers.

Changes

Read each pipe inside its FileHandle readability handler. Previously, the handler returned after scheduling a read on a separate queue. The same unread bytes could trigger more callbacks, leaving queued reads blocked until the next write. At EOF, the handler now unregisters itself, yields the end event, and finishes the stream. An explicit close finishes the stream without emitting EOF.

Testing

Ran three consecutive reviews through isolated copies of the app with a fixture app-server that made 2,000 small writes to each pipe per review. All three reviews returned the expected result on both builds. Version 0.15.0 retained 1,875 of the 16 KiB data buffers after the third review. The fixed build retained zero after each review and its physical footprint stayed between 59 and 61 MB.

A separate stress test completed 1,000 iterations of racing EOF with explicit cancellation. Seven transport tests passed on macOS, including split responses, EOF racing explicit close, invalid framing, and cancellation followed by another request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T15:58:06.591407Z 604d73e PR opened
🔒 Security Review ✅ Completed 2026-11-23T15:59:38.197211Z 604d73e 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.

@lynnswap
lynnswap merged commit 935a8f3 into main Nov 23, 2026
9 of 10 checks passed
@lynnswap
lynnswap deleted the codex/drain-app-server-pipes branch November 23, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant