Skip to content

Allow worker callbacks to flush responses without returning - #3

Merged
renerocksai merged 1 commit into
mainfrom
feat/worker-streaming
Sep 6, 2026
Merged

Allow worker callbacks to flush responses without returning#3
renerocksai merged 1 commit into
mainfrom
feat/worker-streaming

Conversation

@renerocksai

@renerocksai renerocksai commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

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-identical 62c238a; the complete Git tree is 2465f8b25ce564cfc81e72daffe890b77c62a832. 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.

@renerocksai
renerocksai marked this pull request as ready for review September 6, 2026 17:44
@renerocksai
renerocksai merged commit 86e8ec2 into main Sep 6, 2026
1 check passed
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.

1 participant