test(openai): cover ReAct streamEvents backpressure regression - #3061
test(openai): cover ReAct streamEvents backpressure regression#3061guslegend0510 wants to merge 12 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Regression coverage for the #3055 streaming stall: a new OpenAIReActAgentStreamingBackpressureTest that drives 96 SSE deltas through OkHttpTransport → OpenAIChatModel → ReActAgent.streamEvents() and asserts every delta is delivered before [DONE], under both eager and incremental (publishOn(parallel(), 1)) demand, plus exactly one model request and one ModelCallEndEvent. The only production change is an explanatory comment on subscribeOn(Schedulers.boundedElastic(), false). Clean, valuable test-first PR — the negative control (restoring the old scheduling makes both tests time out) is exactly the evidence a regression test needs, and the fake-Pipe harness avoids any live model call.
Two small notes, neither blocking:
- [Info]
agentscope-extensions-model-openai/src/test/.../OpenAIReActAgentStreamingBackpressureTest.java:78— the response body is created with anullcontent type; passingMediaType.parse("text/event-stream")would make the fixture closer to what a real OpenAI-compatible endpoint returns, in case the decoder ever starts inspecting the content type. - [Info] same file,
responseSinkis fully buffered before the request is subscribed. That is safe for 96 chunks (~8 KB against the 64 KB pipe) but will block the test thread (rather than fail cleanly) if someone scalesexpectedup past the buffer. A one-line comment on that limit, or writing chunks from a separate task, would keep it future-proof.
CLA: signed ✅
Automated review by github-manager-bot
AgentScope-Java Version
2.0.3-SNAPSHOT
Description
Refs #3055.
Related issue: #2957.
Follow-up to the transport fix in #2963.
The streaming stall described in #3055 matches the request-starvation issue already fixed in OkHttpTransport by #2963.
This PR adds regression coverage through OkHttpTransport, OpenAIChatModel, and ReActAgent.streamEvents():
[DONE].subscribeOn(Schedulers.boundedElastic(), false).The existing runtime fix is preserved; this PR adds regression tests and an explanatory comment.
Validation
git diff --checkpassed.The reproduction uses a controlled streaming response body; no live model API was called.
Checklist