fix(core): reset attempt timeout on received chunks (#87) - #88
Merged
Merged
Conversation
Owner
|
Integrated current main and widened the active-stream regression timing margin (200ms gaps, 500ms idle limit, >600ms total). Confirmed this test fails on the original implementation and passes with the fix. Existing regression explicitly verifies a stream that emits partial text and then stalls times out without retrying; it remains green. Full npm test passes with real Pi and OMP plus format/diff checks. Waiting for CI. |
Owner
|
Shipped in |
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
Fixes #87.
In
streamCommandCode,attemptTimeoutIdwas started when the HTTP request begins, but was not refreshed insidereadLoopwhenreader.read()yielded new chunks. This causedtimeoutMs(forwarded from Pi'shttpIdleTimeoutMssetting, default 300,000ms) to act as a hard wall-clock cap on the total duration of the generation rather than an idle gap timeout between chunks, aborting legitimate long-running reasoning generations (e.g. GLM-5.3-flash with max thinking or DeepSeek models) after 300 seconds.Changes
src/core.ts(readLoop):doneis true (response completed).attemptTimeoutIdwhenever a new chunk is received, preserving the idle timeout protection against hanging streams while allowing active generations of any length.tests/test-retry.ts:does not abort actively streaming responses that exceed timeoutMs overall(streams for 90ms with 30ms gaps under a 50ms timeout).CHANGELOG.md:Test plan
npm run typecheck— 0 errorsnpm run format:check— Prettier cleannpm run test:unit— all unit tests pass, including the new regression test and all existing retry/timeout tests