Skip to content

Share async stream input reads - #159

Merged
tony merged 2 commits into
masterfrom
fix/73-foreground-stream-reader
Dec 5, 2026
Merged

tony merged 2 commits into
masterfrom
fix/73-foreground-stream-reader

Conversation

@tony

@tony tony commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

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.

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
@tony
tony force-pushed the fix/73-foreground-stream-reader branch from d7c52ca to b5e1add Compare December 3, 2026 23:58
tony added 2 commits December 5, 2026 07:43
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
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 b5e1add to 676dcea Compare December 5, 2026 13:44
@tony
tony changed the base branch from master to fix/83-mouse-mode-selection December 5, 2026 13:44
@tony
tony changed the base branch from fix/83-mouse-mode-selection to master December 5, 2026 13:45
@tony
tony merged commit 9e411d6 into master Dec 5, 2026
9 checks passed
@tony
tony deleted the fix/73-foreground-stream-reader branch December 5, 2026 20:41

This branch was successfully deployed

1 active deployment
docs — 676dcea8 Deployed Dec 5, 2026 by tony via build (3.14) #431
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