Skip to content

Share async stream input reads - #159

Open
tony wants to merge 2 commits into
masterfrom
fix/73-foreground-stream-reader
Open

tony wants to merge 2 commits into
masterfrom
fix/73-foreground-stream-reader

Conversation

@tony

@tony tony commented Dec 3, 2026

Copy link
Copy Markdown
Member

Closes #73
Closes #94

What changed, and why:

Concurrent foreground waits and direct pumps share one read. Closing the stream releases the reader before a successor can consume bytes. Cancelling one of several observers leaves the shared read running.

Checks run:

On Linux, Ruff formatting and lint, ty for Python 3.12 through 3.15, the full pytest suite with doctests, compiled Ghostty comparisons, and the Sphinx warnings-as-errors build passed.

Tool use:

Codex prepared the change and ran the local checks. A separate Codex reviewer replayed the changed behavior and checked the publication tree against the reviewed patch.

why: Concurrent observers and successor streams need one reader owner.

what:
- Feed each chunk once for waiters and direct pumps.
- Join the owned read before releasing the transport.
- Cover concurrent reads, timeout and close during cancellation.

Fixes #73
Fixes #94
tony added a commit that referenced this pull request Dec 3, 2026
why: Readers need the behavior and scope of this change at release.

what:
- Add the unreleased entry for PR #159
- Preserve previously published notes and the parent branch's entries
@tony
tony marked this pull request as ready for review December 3, 2026 01:32
why: A foreground wait and a direct read can request input from the same
     stream concurrently.

what:
- Document shared reads and when the next reader can take ownership.
@tony
tony force-pushed the fix/73-foreground-stream-reader branch from d7c52ca to b5e1add Compare December 3, 2026 23:58

This branch was successfully deployed

1 active deployment
docs — b5e1addf Deployed Dec 4, 2026 by tony via build (3.14) #333
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.

Concurrent foreground waits can compete for the same StreamReader A closed stream’s foreground waiter can consume its successor’s bytes

1 participant