fix: propagate EventStream poll errors - #1070
Open
alurm wants to merge 1 commit into
Open
Conversation
Preserve errors from the blocking EventStream poll and wake the async consumer instead of retrying indefinitely. This allows terminal disconnection errors to reach the stream consumer. Assisted-by: Codex:gpt-5.6-sol
cammeresi
reviewed
Jul 29, 2026
| task.stream_wake_task_executed | ||
| .store(false, Ordering::SeqCst); | ||
| task.stream_waker.wake(); | ||
| run_stream_wake_task(task, || internal::poll(None, &EventFilter)); |
Contributor
There was a problem hiding this comment.
In C, the language greatly encouraged callees to be above callers, so you could generally read from the bottom up. Rust doesn't have that restriction, so some people order things top down (which I don't like, but I'm letting that go).
LLMs just do not care about human readers at all and so will spray out code in all directions, which can be hard for a human to read. I think people should pick an order and try to force the LLM to stick to it. If A calls B calls C, the reviewer should see an order that makes sense (A-B-C or C-B-A, not A-C-B).
(This is not an anti-LLM rant.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EventStream's blocking worker from retrying indefinitely after a polling error.poll_nextreturns it.EventStreamshutdown.Motivation
EventStreamalready exposesio::Result<Event>, and errors from its immediate non-blocking poll are returned to the consumer. However, errors from the blocking poll on its background thread were ignored and retried indefinitely.That could leave the worker spinning after a terminal failure instead of reporting the error to the stream consumer.
Related work
This is independent of #1067, which makes the Unix event source report an error when its TTY disappears. The two changes are complementary: #1067 detects the disconnected TTY, while this PR propagates that error through
EventStream.Testing
The tests cover:
Commands run:
Assisted by Codex:gpt-5.6-sol.