fix(ollama): yield during dense stream processing#86633
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the useful Ollama dense-stream mitigation has been ported onto a current maintainer branch with stronger proof, while this contributor branch is now dirty and no longer the best landing candidate. Canonical path: Close this dirty branch and let #87818 carry the same narrow Ollama mitigation; keep the broader gateway starvation work tracked separately. So I’m closing this here and keeping the remaining discussion on #87818. Review detailsBest possible solution: Close this dirty branch and let #87818 carry the same narrow Ollama mitigation; keep the broader gateway starvation work tracked separately. Do we have a high-confidence way to reproduce the issue? Yes for the narrow source path: current main drains dense native Ollama chunks without a cooperative scheduler, and the patch adds a timer-progress regression test. The full Windows beta gateway starvation report remains broader than this PR. Is this the best way to solve the issue? Yes for the narrow mitigation, but not via this branch. The better solution is the rebased maintainer PR because it ports the same fix onto current main and carries stronger real-behavior proof. Security review: Security review cleared: The diff only changes Ollama stream scheduling and a regression test; it adds no dependency, workflow, credential, download, install, or package-resolution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 1e48ca4e3251. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
Related: #86599. This PR addresses one contributor from that issue: native Ollama can deliver dense stream chunks, and the Ollama parser can process many of them before the gateway gets a chance to handle other work. I would scope this as a related but partial mitigation. It may improve the native-Ollama dense-stream path, but #86599 is broader unless we also prove the gateway stays responsive during the original repro and address the repeated full-partial stream work discussed there. |
|
Maintainer verification for the native Ollama mitigation, tested on the PR patch rebased onto current main because the original branch now conflicts with newer Ollama tests. Behavior addressed: native Ollama stream processing should yield during dense stream bursts, and the patched branch should still pass a real Ollama provider smoke. Real environment tested: AWS Crabbox Linux, provider=aws, lease=cbx_e26f0fab127c, run=run_4597e73408f8 for the dense-stream test and run=run_4c1504086f15 for live Ollama Cloud. Exact steps or command run after this patch: OPENCLAW_VITEST_MAX_WORKERS=1 timeout 240s corepack pnpm test extensions/ollama/src/stream.test.ts -- --reporter=verbose
OPENCLAW_LIVE_TEST=1 \
OPENCLAW_LIVE_OLLAMA=1 \
OPENCLAW_LIVE_OLLAMA_BASE_URL=https://ollama.com \
OPENCLAW_LIVE_OLLAMA_MODEL=gemma3:4b \
OPENCLAW_LIVE_OLLAMA_WEB_SEARCH=0 \
OPENCLAW_LIVE_OLLAMA_EMBEDDINGS=0 \
OPENCLAW_VITEST_MAX_WORKERS=1 \
timeout 360s corepack pnpm test:live -- extensions/ollama/ollama.live.test.tsEvidence after fix: Observed result after fix: the dense NDJSON parser regression passes, and the patched Ollama runtime can complete both the CLI local transport live smoke and native chat live smoke against a real Ollama Cloud model. What was not tested: this is still not a full Windows local-daemon reproduction of #86599. I would still scope this PR as a native-Ollama mitigation, not the complete fix for the broader full-partial/repeated-work issue. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Real behavior proof
Behavior or issue addressed: Ollama stream chunk processing was monopolizing the event loop on dense native streams.
Real environment tested: local OpenClaw checkout in /Users/miya/Desktop/openclaw-issue-86599.
Exact steps or command run after this patch:
pnpm test extensions/ollama/src/stream.test.tsEvidence after fix:
Observed result after fix: the dense-stream regression test passed after the cooperative-yield change.
What was not tested: I did not reproduce the Windows beta gateway loop on a live Windows beta machine in this environment.
Verification
pnpm test extensions/ollama/src/stream.test.ts