You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cancel oversized provider response bodies rejected by Content-Length #39
The provider adapter rejects an oversized Content-Length without cancelling the response body. It then clears its timeout and removes the runtime abort listener, leaving the unread stream without cleanup from this adapter.
Reproduced on main at f5db6e2 and installed guardstep@0.1.0-alpha.1 with an injected fetch implementation. No external service or API key is required.
The result is PROVIDER_RESPONSE_TOO_LARGE, but both cancelled and fetchSignal.aborted are false. Waiting beyond the timeout leaves them false.
Starting point
packages/guardstep/src/providers/openai-compatible.ts, readResponseText: the early header check returns before obtaining a reader. The streamed-size-limit branch already calls reader.cancel().
Acceptance criteria
Cancel the unread body or abort the request when rejecting the declared size.
Add a regression test using an injected response stream and a cancellation/abort spy.
Keep the public failure code PROVIDER_RESPONSE_TOO_LARGE and avoid including provider response content in errors.
Preserve existing streamed-size-limit and timeout behavior.
I'll take this. I'll add cancellation to the early Content-Length rejection and a regression test with an injected response stream, preserving the existing failure code and streamed-size/timeout behavior.
Activity
kudala-bharani commentedon Sep 5, 2026
I'll take this. I'll add cancellation to the early Content-Length rejection and a regression test with an injected response stream, preserving the existing failure code and streamed-size/timeout behavior.
haseebahmed248 commentedon Sep 6, 2026
Assigned to you, @kudala-bharani. Thanks for sending #43 with regression tests. I've left one review comment about pending cancellation on the PR.