Allow worker callbacks to flush responses without returning - #3
Merged
Conversation
This reverts commit acc2866.
renerocksai
marked this pull request as ready for review
September 6, 2026 17:44
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.
Fixed worker handlers currently have to return a flush action and reconstruct continuation state when called again.
Context.flushAndWait()now lets a handler write, flush, do finite work, and write again on its existing reserved worker stack.The I/O owner sends the frozen snapshot while the worker waits. Separate streaming phases retain the callback borrow through transmission and cancellation. Only final callback return permits slot reuse. Inline execution rejects this operation; existing continuation handlers, original deadlines, cumulative response bounds, and transports remain unchanged. One active stream occupies one fixed worker.
Validation uses exact Zig 0.16.0 and assertions. Native macOS, Linux, and Windows passed Debug/ReleaseSafe verification and maintained wire suites. macOS: 100 passed/4 skipped per mode; Linux: 102/2; Windows: 115/4. Each host also passed nine comparator receipt tests and 30,000 exact ReleaseSafe smoke responses. All recorded ownership/allocation counters ended at zero. These are correctness gates, not performance comparisons.
Native Windows run tested exact candidate
2a269ef57301b21df22f1c616d02d6d244e5d6ca. Linux executed tree-identical62c238a; the complete Git tree is2465f8b25ce564cfc81e72daffe890b77c62a832. Mac tested the feature candidate. Independent lifecycle review found no material defect. Baz's new same-handler streaming suite additionally passed all 14 groups on macOS, including a client-controlled first-chunk gate, backpressure, cancellation, slot reuse, and the runnable example.