Skip to content

tests(agent): cover the OpenAI batch request bound - #177

Merged
yusiwen merged 1 commit into
yusiwen:masterfrom
AdamMagued:fix/bound-sse-read-idle
Oct 11, 2026
Merged

yusiwen merged 1 commit into
yusiwen:masterfrom
AdamMagued:fix/bound-sse-read-idle

Conversation

@AdamMagued

Copy link
Copy Markdown
Contributor

Resolves #176

Introduces an idle timeout on OpenAI-compatible stream reads that resets on each received line. This prevents endpoints that hold connections open without emitting [DONE] or closing from stalling indefinitely while preserving support for late usage chunks.

@AdamMagued
AdamMagued force-pushed the fix/bound-sse-read-idle branch from 2c37f1b to 7222e40 Compare October 10, 2026 19:36
@yusiwen yusiwen added the tests Test coverage and test infrastructure label Oct 11, 2026
@yusiwen yusiwen changed the title agent: bound idle time during openai stream reading tests(agent): cover the OpenAI batch request bound Oct 11, 2026
@yusiwen
yusiwen merged commit a6b86c8 into yusiwen:master Oct 11, 2026
9 checks passed
@yusiwen

yusiwen commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Thanks @AdamMagued — the diagnosis was right, and the fix landed separately while this PR was open:
#178 (rebase-merged as 49964e2) added the idle bound,
the per-line watchdog reset and the named cancel cause — the code half of #176, which is now closed.

What this diff still added is TestOpenAIBatchTimesOutOnSilentEndpoint, which master lacked:
openAIRequestTimeout had no test at all, while its Ollama counterpart
(TestOllamaBatchTimesOutOnSilentEndpoint) did.

Landing: squash-merged as a6b86c8 with the subject reworded to tests(agent): … (the change is
test-only) rather than rebase-merging 7222e40, whose message describes code that is already in master.
The merged commit is attributed to your account.

Two follow-ups found while reviewing this area, both filed with measured repros:

  • #185 — a healthy long stream is still cut by the
    client-wide 120 s timeout (http.Client.Timeout covers the body read; Ollama's client has no timeout).
  • #186 — the idle bound cannot fire under the default
    settings, because the request bound is the same 120 s and the watchdog is reset by every line, so the
    reader gets Client.Timeout exceeded … instead of stream went silent.

Both are open and unassigned. FYI, minor: your own commit 7222e40 carries adammaged8@gmail.com,
which is not connected to your GitHub account, so commits authored with that address do not link to your
profile — the squash commit above used your account identity, so this one is already credited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test coverage and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[agent] Bound the SSE read after finish_reason so a stream without [DONE] cannot stall the call

2 participants