Skip to content

Prevent STDIO shutdown file-handle race#182

Merged
lynnswap merged 1 commit into
mainfrom
codex/fix-merge-ci-filehandle-crash
Jul 15, 2026
Merged

Prevent STDIO shutdown file-handle race#182
lynnswap merged 1 commit into
mainfrom
codex/fix-merge-ci-filehandle-crash

Conversation

@lynnswap

Copy link
Copy Markdown
Owner

Purpose

Prevent an immediate STDIO adapter shutdown from closing stdin before Foundation has prepared its async iterator. This race aborted the merged main CI run with NSFileHandleOperationException.

Failing job: https://github.com/lynnswap/XcodeMCPKit/actions/runs/29392946378/job/87280397262

Changes

  • Redefine reader readiness as completion of FileHandle.AsyncBytes.Iterator creation.
  • Make shutdown wait for that readiness before closing the input descriptor.
  • Add a repeated immediate start/stop regression test.

Testing

  • CI remaining package-test command: 296 tests passed.
  • scripts/check.sh: 951 standard, 24 process runtime, and 8 STDIO adapter tests passed.
  • codex-review --base main: clean.

Wait for FileHandle.AsyncBytes iterator creation before closing its descriptor so an immediate stop cannot trigger NSFileHandleOperationException.
@lynnswap
lynnswap merged commit 0d1985b into main Jul 15, 2026
9 checks passed
@lynnswap
lynnswap deleted the codex/fix-merge-ci-filehandle-crash branch July 15, 2026 06:21
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