Skip to content

Observe each committed frame in a single transport read - #192

Merged
tony merged 3 commits into
masterfrom
fix/72-observe-committed-frames
Dec 5, 2026
Merged

tony merged 3 commits into
masterfrom
fix/72-observe-committed-frames

Conversation

@tony

@tony tony commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Closes #72

What changed, and why:

A program can commit a prompt and replace it before the next stream or PTY read. A registered wait now sees the first matching committed frame even when both updates arrive together. Predicates run in the waiting task, and delivery uses bounded batches.

This builds on #159 for shared reader ownership. #160 independently fixes writer cleanup after a failed input pump. Their close paths overlap where the stream finishes bytes it has already received.

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 #192
- Preserve previously published notes and the parent branch's entries
@tony
tony marked this pull request as ready for review December 3, 2026 03:05
@tony
tony force-pushed the fix/72-observe-committed-frames branch from 619b793 to ff4863e Compare December 3, 2026 23:58
tony added 3 commits December 5, 2026 07:43
why: A single read can contain two synchronized updates. Feeding both
before checking a waiter hides the first committed frame.

what:
- Step through commit boundaries in stream and PTY input
- Check bounded batches of snapshots in the waiting task
- Finish buffered frames before reporting terminal EOF
- Exercise coalesced input, waiter cancellation and shared close
why: A prompt can appear and disappear in synchronized updates carried
     by one transport read.

what:
- Explain when stream and PTY waits observe the transient frame.
why: Darwin can discard unread output when the last PTY slave closes.
The child can also block writing while the parent waits for it to exit.

what:
- Keep the parent slave open until the observer sees the final frame.
- Send 34 frames in 714 bytes to cross the 32-frame batch boundary.
- Verify the final frame and EOF for concurrent close and cancellation.

Refs #72
@tony
tony force-pushed the fix/72-observe-committed-frames branch from 3f9895c to 5eb699a Compare December 5, 2026 13:44
@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 fix/73-foreground-stream-reader to master December 5, 2026 13:48
@tony
tony merged commit 7acb9e2 into master Dec 5, 2026
18 checks passed
@tony
tony deleted the fix/72-observe-committed-frames branch December 5, 2026 20:41

This branch was successfully deployed

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

wait_for() misses a committed frame inside a single transport read

1 participant