Repository navigation
lane host: a slow reader's stream sits out rounds at 1,024 unread tokens; one stalled 60 s is cancelled - #3234
Merged
Merged
Conversation
This was referenced Nov 15, 2026
ashhart
added a commit
that referenced
this pull request
Nov 18, 2026
…ne limit Keep main's wait_reason and fell_back fields in lane_job.Job and place the PR's backlog field after them. Join lane_host.zig's two trailing test blocks into one (all imports kept) so the merged file is 600 lines. Add the CHANGELOG entry under Unreleased.
ashhart
force-pushed
the
lead/slow-reader-pause
branch
from
November 18, 2026 01:54
ef640d7 to
a3128cc
Compare
ashhart
added a commit
that referenced
this pull request
Nov 19, 2026
…ne limit Keep main's wait_reason and fell_back fields in lane_job.Job and place the PR's backlog field after them. Join lane_host.zig's two trailing test blocks into one (all imports kept) so the merged file is 600 lines. Add the CHANGELOG entry under Unreleased.
ashhart
force-pushed
the
lead/slow-reader-pause
branch
from
November 19, 2026 01:48
a3128cc to
4c19615
Compare
…ens; one stalled 60 s is cancelled A streamed reply's tokens went to its mailbox with no bound, so a client that read slowly, or stopped reading without closing, left its lane decoding text nobody was taking. - The mailbox counts a streamed reply's tokens that have landed and are not yet written to the client, and hands the count to the engine as Request.unread. A whole reply passes none and is never watched. - Before each turn the shared lane host holds a stream whose count reaches 1,024 (Stream.paused) until it falls to 512. A stream with a step queued ahead lands it in its next round first, so a held stream keeps no draw in flight (GLM's ring would refuse a peer's next one). - A held stream whose client reads nothing for 60 s goes on the cancel list a disconnect uses; any read restarts the 60 s. - The host lifts only holds it placed: a stream its backend paused (Flash Next's sized sessions) stays paused. - A lone driver hands back a stream whose reader is behind, and reclaim leaves such a stream in the lane core. - With every stream held and no cancel waiting, the engine thread waits up to 2 ms for an arrival, outside its activity scope, instead of turning empty rounds. The scan runs on the engine thread with no lock or clock read while no stream is held. Host tests with the fake backend cover a normal reader, a slow reader in stepped and drafted rounds, a stalled reader beside a fast one, a four-slot ring, the stall cancel, the lone driver and the hold rules; a server test checks the count a streamed reply's engine sees. docs/api.md names the limit, the resume point and the timeout. Fixes #3198
…ne limit Keep main's wait_reason and fell_back fields in lane_job.Job and place the PR's backlog field after them. Join lane_host.zig's two trailing test blocks into one (all imports kept) so the merged file is 600 lines. Add the CHANGELOG entry under Unreleased.
ashhart
force-pushed
the
lead/slow-reader-pause
branch
from
November 21, 2026 04:52
4c19615 to
4f43020
Compare
ashhart
added a commit
that referenced
this pull request
Nov 21, 2026
…ne limit Keep main's wait_reason and fell_back fields in lane_job.Job and place the PR's backlog field after them. Join lane_host.zig's two trailing test blocks into one (all imports kept) so the merged file is 600 lines. Add the CHANGELOG entry under Unreleased.
ashhart
added a commit
to bikepresentball/TensorFold
that referenced
this pull request
Nov 21, 2026
ashhart
added a commit
that referenced
this pull request
Nov 21, 2026
ashhart
added a commit
to AIflow-Labs/TensorFold
that referenced
this pull request
Nov 21, 2026
ashhart
added a commit
that referenced
this pull request
Nov 21, 2026
ashhart
added a commit
to AIflow-Labs/TensorFold
that referenced
this pull request
Nov 21, 2026
ashhart
added a commit
that referenced
this pull request
Nov 21, 2026
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.
A streamed reply's tokens went to its mailbox with no bound, so a client that read slowly, or stopped reading without closing, left its lane decoding text nobody was taking.
What changed
Request.unread). Whole (non-streamed) replies pass none and are never watched.cancelledand its lane goes to the next request. Any read restarts the 60 seconds.docs/api.mdnames the limit, the resume point and the timeout.Why delivered text and other streams are unchanged
Tests (lane host with the fake backend): a normal reader never pauses, even at a limit of 8; a slow reader's backlog stays within a round of the limit and its text equals a fast reader's, in one-token steps and in drafted windows; a stalled reader holds only its own stream while another finishes with its solo tokens; a held stream leaves no draw in a four-slot ring while a peer decodes; a reader stalled past the timeout is cancelled, the next request gets the lane, and the engine thread does not spin; a lone driver hands back a slow reader's stream and its reply is unchanged; the hold rules themselves. Server: a streamed reply's engine sees the count fall as tokens are written; a whole reply's engine sees none. With the change switched off, every new test except the normal-reader guard fails.
Still owed: a served check on a device: decode speed at 1-8 streams against main with normal readers, plus a slow and a stalled reader beside normal ones, with token hashes equal.
Fixes #3198