Repository navigation
fix(ollama): promote plain text tool calls - #87675
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 28, 2026, 2:11 PM ET / 18:11 UTC. Summary PR surface: Source +9, Tests +107. Total +116 across 3 files. Reproducibility: yes. Source inspection shows current main emits native Ollama text through the raw stream path without the plain-text wrapper, and the PR tests plus maintainer live proof exercise the missing promotion path. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Refresh the branch against current main, keep the shared-wrapper approach, and land only after maintainers accept the Ollama text-to-tool promotion boundary and record the desired current-head validation. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main emits native Ollama text through the raw stream path without the plain-text wrapper, and the PR tests plus maintainer live proof exercise the missing promotion path. Is this the best way to solve the issue? Yes, after branch refresh and maintainer acceptance. Reusing createPlainTextToolCallCompatWrapper is the narrowest maintainable fix and matches the LM Studio precedent, but the parser boundary is message-delivery-sensitive. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against a8991e02d831. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +107. Total +116 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
dd7663a to
5c1386e
Compare
5c1386e to
7f1fbe7
Compare
|
Maintainer verification for current head 7f1fbe701e952b568e7cdb783f69a207eb33efd9: Behavior addressed: Ollama native streams now reuse the shared plain-text tool-call compatibility wrapper, so standalone bracketed/Harmony tool-call text can be promoted into structured toolCall events when matching tools are available. Real environment tested: local OpenClaw source checkout against a real local Ollama server, ollama 0.24.0, model llama3.2:latest, base URL http://127.0.0.1:11434. Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: matching plain-text Ollama tool-call output is suppressed as visible assistant text and delivered as structured toolCall stream events, with final completion marked toolUse. What was not tested: full UI/manual Windows Ollama flow. Broad Testbox check:changed was attempted on tbx_01ksqvjtdxqdmvwzztgv043etq / swift-crab and failed before this PR's tests on an unrelated current-main type error in src/agents/embedded-agent-runner/run/attempt.abort-settle-timeout.ts from df4475d; this PR diff only touches extensions/ollama/src/stream.ts and extensions/ollama/src/stream.test.ts. |
|
Maintainer verification for final head 09931522e95d48ec8cfd91dcb66c46923ba4b8b1: Behavior addressed: Ollama native streams now reuse the shared plain-text tool-call compatibility wrapper, so standalone bracketed/Harmony tool-call text can be promoted into structured toolCall events when matching tools are available. Real environment tested: local OpenClaw source checkout against a real local Ollama server, ollama 0.24.0, model llama3.2:latest, base URL http://127.0.0.1:11434. Broad checks and focused tests also ran in Blacksmith Testbox through Crabbox. Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: matching plain-text Ollama tool-call output is suppressed as visible assistant text and delivered as structured toolCall stream events, with final completion marked toolUse. The current-main env type blocker from df4475d is fixed by allowing the injected env shape to be partial, matching existing tests and runtime behavior. What was not tested: full UI/manual Windows Ollama flow. Local Vitest could not run on this Mac because Vite/Rolldown failed during project config loading before test execution; the same focused tests passed in Testbox. |
0993152 to
44e2425
Compare
|
Final maintainer verification for head 44e242589b52d09aa5bb99ed5fc5cde034da0ca7: Behavior addressed: Ollama native streams now reuse the shared plain-text tool-call compatibility wrapper, so standalone bracketed/Harmony tool-call text can be promoted into structured toolCall events when matching tools are available. Real environment tested: local OpenClaw source checkout against a real local Ollama server, ollama 0.24.0, model llama3.2:latest, base URL http://127.0.0.1:11434. Focused tests and changed gate ran in Blacksmith Testbox through Crabbox. Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: matching plain-text Ollama tool-call output is suppressed as visible assistant text and delivered as structured toolCall stream events, with final completion marked toolUse. What was not tested: full UI/manual Windows Ollama flow. Local Vitest could not run on this Mac because Vite/Rolldown failed during project config loading before test execution; the same focused tests passed in Testbox. |
Summary
toolCallevents when matching tools are available.[tool] ... [END_TOOL_REQUEST]andcommentary to=toolforms.Verification
node scripts/run-vitest.mjs extensions/ollama/src/stream.test.ts src/plugin-sdk/provider-stream.test.ts src/plugin-sdk/tool-payload.test.ts- passed, 3 files / 29 tests on5c1386e./node_modules/.bin/oxfmt --check --threads=1 extensions/ollama/src/stream.ts extensions/ollama/src/stream.test.ts- passed./node_modules/.bin/oxlint extensions/ollama/src/stream.ts extensions/ollama/src/stream.test.ts- passedgit diff --check- passed.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main- clean, no accepted/actionable findingscorepack pnpm check:changedon the same patch shape: runrun_63007c8cd66f, leasecbx_9c760afc22c6, slugviolet-barnacle; it failed duringtypecheck extensionson existing current-main errors outside this branch. Current SHA was rebased afterward; fresh broad gate is queued behind the active AWS lane.Real behavior proof
Behavior addressed: Ollama models that emit tool requests as plain assistant text can now be recovered into structured tool calls through the shared provider compatibility path.
Real environment tested: Local linked OpenClaw worktree after rebase, plus previous AWS Crabbox Linux changed gate for the same patch shape.
Exact steps or command run after this patch: The Vitest, format, lint, diff, autoreview, and previous Crabbox commands listed above.
Evidence after fix: Focused Ollama/plugin-sdk tests passed and cover both bracketed and Harmony-style plain-text tool-call promotion.
Observed result after fix: Matching plain-text tool-call payloads are emitted as
toolCallevents and stream completion is markedtoolUse.What was not tested: Full live Windows/Ollama UI reproduction; current rebased SHA has not yet had a fresh broad Crabbox/Testbox
check:changedbecause another AWS gate is already active.