Skip to content

fix(ollama): stream native tool call lifecycle - #116809

Merged
steipete merged 1 commit into
mainfrom
codex/qa100-ollama-native-tool-lifecycle
Jul 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa100-ollama-native-tool-lifecycle

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Stream start, toolcall_start, toolcall_delta, and toolcall_end events as native Ollama calls arrive, with stable provider IDs and immutable partial snapshots.
  • Preserve visible text/thinking ordering, parallel native calls, Kimi reasoning sanitization, and the existing plaintext compatibility wrapper.
  • Keep token-limited terminal calls non-executable and ignore empty tool-call arrays before finalizing buffered Kimi text.

Verification

  • /Users/steipete/.local/bin/node scripts/run-vitest.mjs run extensions/ollama/src/stream-runtime.test.ts extensions/ollama/src/stream.test.ts --config=test/vitest/vitest.extension-providers.config.ts (158 tests passed).
  • Existing oxfmt binary checked both changed files; git diff --check passed.
  • Independent read-only owner review: CLEAN.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 7:53 AM ET / 11:53 UTC.

ClawSweeper review

What this changes

This PR makes the Ollama provider emit normalized start, tool-call start/delta/end, and final events while native Ollama tool calls arrive, with regression coverage for tool-only, parallel, and mixed-content responses.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for maintainer review. This is an active same-day PR carrying the protected maintainer label, and the supplied context shows focused provider tests plus successful repository checks; there is no evidence that current main already contains or supersedes the change.

Priority: P2
Reviewed head: ff404f83f640ffb79017623fa1f223dcdf98cf97
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has focused regression coverage and successful checks in the supplied context, but a refreshed-head stream-contract review is still needed before a stronger quality assessment.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-labelled provider PR; its body records focused tests, while final landing should still include owner review of the refreshed stream behavior.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-labelled provider PR; its body records focused tests, while final landing should still include owner review of the refreshed stream behavior.
Evidence reviewed 4 items Active protected PR: The supplied GitHub context identifies this as an open PR created on 2026-07-31 with the maintainer label; repository policy requires explicit maintainer handling rather than automated cleanup for protected-label items.
Focused behavioral coverage: The PR body reports 158 passing focused tests for stream-runtime.test.ts and stream.test.ts, covering the modified Ollama streaming behavior; repository CI also reports the changed-code and guard lanes as successful.
Bounded implementation surface: The supplied PR diff confines the runtime change to the Ollama stream adapter and expands its focused runtime tests; it does not include dependency, workflow, package, or credential changes.
Findings None None.
Security None None.

How this fits together

The bundled Ollama provider turns Ollama NDJSON chat chunks into OpenClaw assistant-stream events. Those events preserve assistant text, thinking, and tool-call state for the agent runtime before the completed assistant message determines whether tools execute.

flowchart LR
  A[Ollama NDJSON response] --> B[Ollama stream adapter]
  B --> C[Text and thinking events]
  B --> D[Tool-call lifecycle events]
  C --> E[Assistant stream consumer]
  D --> E
  E --> F[Completed assistant message]
  F --> G[Agent tool execution]
Loading

Decision needed

Question Recommendation
Should this maintainer-labelled Ollama streaming change be refreshed onto current main and approved after an owner confirms the shared stream-event contract? Refresh and review the merge result: Rebase onto current main and have the provider owner confirm event ordering, IDs, and final-message consistency before merge.

Why: The implementation modifies normalized provider events consumed by the agent runtime, and the protected maintainer label requires an explicit human landing decision rather than automated cleanup.

Before merge

  • Add real behavior proof - Not applicable: This is a maintainer-labelled provider PR; its body records focused tests, while final landing should still include owner review of the refreshed stream behavior.
  • Resolve merge risk (P1) - The branch is behind current main, so the final review should confirm the same lifecycle ordering and test expectations against the refreshed three-way merge result before landing.
  • Complete next step (P2) - The protected maintainer label and current-base drift require an owner to review the refreshed provider-stream contract; no discrete mechanical repair was established for an automated fix lane.
Agent review details

Security

None.

PR surface

Source +51, Tests +214. Total +265 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 75 24 +51
Tests 1 220 6 +214
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 295 30 +265

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or refresh the PR against current main, then have an Ollama/provider owner confirm that the emitted event ordering and stable tool-call IDs match the shared assistant-stream contract for mixed text, thinking, and parallel tool calls.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or refresh the PR against current main, then have an Ollama/provider owner confirm that the emitted event ordering and stable tool-call IDs match the shared assistant-stream contract for mixed text, thinking, and parallel tool calls.

Do we have a high-confidence way to reproduce the issue?

No high-confidence live reproduction was established in this read-only review. The PR supplies focused automated coverage for the reported event sequences, but no real Ollama runtime transcript or artifact was available to inspect.

Is this the best way to solve the issue?

Unclear pending refreshed-head review. Emitting the shared lifecycle events at the provider boundary is the maintainable shape if the resulting IDs, content indices, and final assistant message remain consistent with the shared stream contract.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 5f5a871f39c4.

Labels

Label changes:

  • add P2: This changes an optional provider's normalized tool-call streaming behavior and has a bounded but user-visible effect on tool execution.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-labelled provider PR; its body records focused tests, while final landing should still include owner review of the refreshed stream behavior.

Label justifications:

  • P2: This changes an optional provider's normalized tool-call streaming behavior and has a bounded but user-visible effect on tool execution.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-labelled provider PR; its body records focused tests, while final landing should still include owner review of the refreshed stream behavior.

Evidence

What I checked:

  • Active protected PR: The supplied GitHub context identifies this as an open PR created on 2026-07-31 with the maintainer label; repository policy requires explicit maintainer handling rather than automated cleanup for protected-label items. (ff404f83f640)
  • Focused behavioral coverage: The PR body reports 158 passing focused tests for stream-runtime.test.ts and stream.test.ts, covering the modified Ollama streaming behavior; repository CI also reports the changed-code and guard lanes as successful. (extensions/ollama/src/stream-runtime.test.ts, ff404f83f640)
  • Bounded implementation surface: The supplied PR diff confines the runtime change to the Ollama stream adapter and expands its focused runtime tests; it does not include dependency, workflow, package, or credential changes. (extensions/ollama/src/stream.ts:1262, ff404f83f640)
  • Current-base refresh remains necessary: GitHub reports the PR as cleanly mergeable but behind its base branch (c75e435e30b9c71c6ff090f5584c5558697e8b72), while the review checkout is at newer current main 5f5a871f39c41f40b336d96767fee72d4cbeb381; final maintainer review should use a refreshed merge result. (5f5a871f39c4)

Likely related people:

  • steipete: The only available concrete provenance is the current Ollama streaming change commit; a fuller local history hunt could not be completed in the read-only execution environment. (role: recent area contributor; confidence: low; commits: ff404f83f640; files: extensions/ollama/src/stream.ts, extensions/ollama/src/stream-runtime.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and rerun the focused Ollama stream tests.
  • Add a redacted real Ollama stream transcript or terminal capture if an owner wants direct confirmation beyond the lifecycle test fixtures.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete force-pushed the codex/qa100-ollama-native-tool-lifecycle branch from ff404f8 to 46e9b41 Compare July 31, 2026 12:02
@steipete
steipete merged commit c2b0def into main Jul 31, 2026
85 checks passed
@steipete
steipete deleted the codex/qa100-ollama-native-tool-lifecycle branch July 31, 2026 12:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to yetval/openclaw that referenced this pull request Aug 1, 2026
* commit 'd8f229f2e6c39e2dc694730c2efc479e4fb3871e': (59 commits)
  fix(setup): isolate failed channel probes and report doctor diagnostics (openclaw#116824)
  fix(telegram): preserve edit previews, message cache, and group history (openclaw#116818)
  fix(whatsapp): preserve interactive replies and normalize media MIME (openclaw#116816)
  fix(file-transfer): keep fetched media attachable in sandboxed replies (openclaw#116400)
  fix(browser): preserve doctor JSON failure status (openclaw#116811)
  fix(ollama): stream native tool call lifecycle (openclaw#116809)
  fix(matrix): preserve message-tool room thread routing (openclaw#116802)
  fix(ui): restore mobile navigation and accessible usage filters (openclaw#116751)
  fix(ui): coalesce profile identity refresh (openclaw#116764)
  fix(ui): preserve chat attachments and run ownership (openclaw#116752)
  fix(plugins): clean up partial service startup once (openclaw#116804)
  fix(qa-channel): enforce message and thread lifecycle ownership (openclaw#116801)
  fix(qa-lab): support groups and isolate thread timelines (openclaw#116803)
  feat(plugins): externalize Voyage embeddings (openclaw#116785)
  fix(outbound): strip echoed inbound metadata before delivery (openclaw#50520)
  fix(anthropic-vertex): correct multi-region endpoints (openclaw#116757)
  fix(ui): scope agent cron jobs and surface model catalog failures (openclaw#116771)
  fix(ui): preserve scoped session state across updates (openclaw#116772)
  fix(build): fail closed on symlinked build output roots (openclaw#116705)
  fix(commands): validate native settings and preserve Telegram ingress outcomes (openclaw#116773)
  ...
pull Bot pushed a commit to liudf0716/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (52 commits)
  fix(setup): isolate failed channel probes and report doctor diagnostics (openclaw#116824)
  fix(telegram): preserve edit previews, message cache, and group history (openclaw#116818)
  fix(whatsapp): preserve interactive replies and normalize media MIME (openclaw#116816)
  fix(file-transfer): keep fetched media attachable in sandboxed replies (openclaw#116400)
  fix(browser): preserve doctor JSON failure status (openclaw#116811)
  fix(ollama): stream native tool call lifecycle (openclaw#116809)
  fix(matrix): preserve message-tool room thread routing (openclaw#116802)
  fix(ui): restore mobile navigation and accessible usage filters (openclaw#116751)
  fix(ui): coalesce profile identity refresh (openclaw#116764)
  fix(ui): preserve chat attachments and run ownership (openclaw#116752)
  fix(plugins): clean up partial service startup once (openclaw#116804)
  fix(qa-channel): enforce message and thread lifecycle ownership (openclaw#116801)
  fix(qa-lab): support groups and isolate thread timelines (openclaw#116803)
  feat(plugins): externalize Voyage embeddings (openclaw#116785)
  fix(outbound): strip echoed inbound metadata before delivery (openclaw#50520)
  fix(anthropic-vertex): correct multi-region endpoints (openclaw#116757)
  fix(ui): scope agent cron jobs and surface model catalog failures (openclaw#116771)
  fix(ui): preserve scoped session state across updates (openclaw#116772)
  fix(build): fail closed on symlinked build output roots (openclaw#116705)
  fix(commands): validate native settings and preserve Telegram ingress outcomes (openclaw#116773)
  ...
sunlit-deng pushed a commit to sunlit-deng/openclaw that referenced this pull request Aug 1, 2026
* commit 'd8f229f2e6c39e2dc694730c2efc479e4fb3871e': (60 commits)
  fix(setup): isolate failed channel probes and report doctor diagnostics (openclaw#116824)
  fix(telegram): preserve edit previews, message cache, and group history (openclaw#116818)
  fix(whatsapp): preserve interactive replies and normalize media MIME (openclaw#116816)
  fix(file-transfer): keep fetched media attachable in sandboxed replies (openclaw#116400)
  fix(browser): preserve doctor JSON failure status (openclaw#116811)
  fix(ollama): stream native tool call lifecycle (openclaw#116809)
  fix(matrix): preserve message-tool room thread routing (openclaw#116802)
  fix(ui): restore mobile navigation and accessible usage filters (openclaw#116751)
  fix(ui): coalesce profile identity refresh (openclaw#116764)
  fix(ui): preserve chat attachments and run ownership (openclaw#116752)
  fix(plugins): clean up partial service startup once (openclaw#116804)
  fix(qa-channel): enforce message and thread lifecycle ownership (openclaw#116801)
  fix(qa-lab): support groups and isolate thread timelines (openclaw#116803)
  feat(plugins): externalize Voyage embeddings (openclaw#116785)
  fix(outbound): strip echoed inbound metadata before delivery (openclaw#50520)
  fix(anthropic-vertex): correct multi-region endpoints (openclaw#116757)
  fix(ui): scope agent cron jobs and surface model catalog failures (openclaw#116771)
  fix(ui): preserve scoped session state across updates (openclaw#116772)
  fix(build): fail closed on symlinked build output roots (openclaw#116705)
  fix(commands): validate native settings and preserve Telegram ingress outcomes (openclaw#116773)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* commit '4e7fffdb98ce4d3e6fd69859bedd584cf474ec53': (59 commits)
  fix(setup): isolate failed channel probes and report doctor diagnostics (openclaw#116824)
  fix(telegram): preserve edit previews, message cache, and group history (openclaw#116818)
  fix(whatsapp): preserve interactive replies and normalize media MIME (openclaw#116816)
  fix(file-transfer): keep fetched media attachable in sandboxed replies (openclaw#116400)
  fix(browser): preserve doctor JSON failure status (openclaw#116811)
  fix(ollama): stream native tool call lifecycle (openclaw#116809)
  fix(matrix): preserve message-tool room thread routing (openclaw#116802)
  fix(ui): restore mobile navigation and accessible usage filters (openclaw#116751)
  fix(ui): coalesce profile identity refresh (openclaw#116764)
  fix(ui): preserve chat attachments and run ownership (openclaw#116752)
  fix(plugins): clean up partial service startup once (openclaw#116804)
  fix(qa-channel): enforce message and thread lifecycle ownership (openclaw#116801)
  fix(qa-lab): support groups and isolate thread timelines (openclaw#116803)
  feat(plugins): externalize Voyage embeddings (openclaw#116785)
  fix(outbound): strip echoed inbound metadata before delivery (openclaw#50520)
  fix(anthropic-vertex): correct multi-region endpoints (openclaw#116757)
  fix(ui): scope agent cron jobs and surface model catalog failures (openclaw#116771)
  fix(ui): preserve scoped session state across updates (openclaw#116772)
  fix(build): fail closed on symlinked build output roots (openclaw#116705)
  fix(commands): validate native settings and preserve Telegram ingress outcomes (openclaw#116773)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (52 commits)
  fix(setup): isolate failed channel probes and report doctor diagnostics (openclaw#116824)
  fix(telegram): preserve edit previews, message cache, and group history (openclaw#116818)
  fix(whatsapp): preserve interactive replies and normalize media MIME (openclaw#116816)
  fix(file-transfer): keep fetched media attachable in sandboxed replies (openclaw#116400)
  fix(browser): preserve doctor JSON failure status (openclaw#116811)
  fix(ollama): stream native tool call lifecycle (openclaw#116809)
  fix(matrix): preserve message-tool room thread routing (openclaw#116802)
  fix(ui): restore mobile navigation and accessible usage filters (openclaw#116751)
  fix(ui): coalesce profile identity refresh (openclaw#116764)
  fix(ui): preserve chat attachments and run ownership (openclaw#116752)
  fix(plugins): clean up partial service startup once (openclaw#116804)
  fix(qa-channel): enforce message and thread lifecycle ownership (openclaw#116801)
  fix(qa-lab): support groups and isolate thread timelines (openclaw#116803)
  feat(plugins): externalize Voyage embeddings (openclaw#116785)
  fix(outbound): strip echoed inbound metadata before delivery (openclaw#50520)
  fix(anthropic-vertex): correct multi-region endpoints (openclaw#116757)
  fix(ui): scope agent cron jobs and surface model catalog failures (openclaw#116771)
  fix(ui): preserve scoped session state across updates (openclaw#116772)
  fix(build): fail closed on symlinked build output roots (openclaw#116705)
  fix(commands): validate native settings and preserve Telegram ingress outcomes (openclaw#116773)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* commit '4e7fffdb98ce4d3e6fd69859bedd584cf474ec53': (60 commits)
  fix(setup): isolate failed channel probes and report doctor diagnostics (openclaw#116824)
  fix(telegram): preserve edit previews, message cache, and group history (openclaw#116818)
  fix(whatsapp): preserve interactive replies and normalize media MIME (openclaw#116816)
  fix(file-transfer): keep fetched media attachable in sandboxed replies (openclaw#116400)
  fix(browser): preserve doctor JSON failure status (openclaw#116811)
  fix(ollama): stream native tool call lifecycle (openclaw#116809)
  fix(matrix): preserve message-tool room thread routing (openclaw#116802)
  fix(ui): restore mobile navigation and accessible usage filters (openclaw#116751)
  fix(ui): coalesce profile identity refresh (openclaw#116764)
  fix(ui): preserve chat attachments and run ownership (openclaw#116752)
  fix(plugins): clean up partial service startup once (openclaw#116804)
  fix(qa-channel): enforce message and thread lifecycle ownership (openclaw#116801)
  fix(qa-lab): support groups and isolate thread timelines (openclaw#116803)
  feat(plugins): externalize Voyage embeddings (openclaw#116785)
  fix(outbound): strip echoed inbound metadata before delivery (openclaw#50520)
  fix(anthropic-vertex): correct multi-region endpoints (openclaw#116757)
  fix(ui): scope agent cron jobs and surface model catalog failures (openclaw#116771)
  fix(ui): preserve scoped session state across updates (openclaw#116772)
  fix(build): fail closed on symlinked build output roots (openclaw#116705)
  fix(commands): validate native settings and preserve Telegram ingress outcomes (openclaw#116773)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: ollama maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant