Skip to content

fix: Found one narrow regression risk in the new Ollama tool-call name - #74563

Merged
vincentkoc merged 1 commit into
mainfrom
clawsweeper/clawsweeper-commit-openclaw-openclaw-89f871679e8d
Apr 29, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
clawsweeper/clawsweeper-commit-openclaw-openclaw-89f871679e8d

Conversation

@clawsweeper

@clawsweeper clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Found one narrow regression risk in the new Ollama tool-call name normalizer.

What ClawSweeper Is Fixing

  • Low: Ollama now rewrites valid tool_ / function_ tool names before dispatch (regression)
    • File: extensions/ollama/src/stream.ts:792
    • Evidence: normalizeOllamaToolCallName unconditionally strips any leading function, functions, tool, or tools followed by ., /, _, or -. That means a legitimate tool named tool_a, tools_invoke_test, or function-run is converted to a, invoke_test, or run in both replay conversion (extensions/ollama/src/stream.ts:771) and response conversion (extensions/ollama/src/stream.ts:887). The same adapter advertises tools to Ollama using the exact registered tool.name (extensions/ollama/src/stream.ts:845), while OpenClaw docs and prompt construction treat tool names as exact strings (docs/plugins/building-plugins.md:110, src/agents/system-prompt.ts:720). Ollama’s own tool-calling docs also use call.function.name as the tool identity that is executed and sent back as tool_name. citeturn1view1turn1view0
    • Impact: Any current or third-party plugin tool whose canonical name starts with these prefixes plus an allowed separator can become unusable under native Ollama: the model is shown the real tool name, but OpenClaw receives a different name and dispatch/allowlist matching can fail with “tool not found.”
    • Suggested fix: Make Ollama normalization allowlist-aware, matching the existing embedded-runner approach: preserve an exact registered tool name first, and only strip provider prefixes when the stripped suffix matches an available tool. If no allowlist is available, avoid stripping _/- forms or keep normalization limited to the observed provider namespace forms.
    • Confidence: high

Expected Repair Surface

  • extensions/ollama/src/stream.ts
  • extensions/ollama/src/stream-runtime.test.ts

Source And Review Context

Expected validation

  • pnpm check:changed

ClawSweeper already ran:

  • pnpm test extensions/ollama/src/stream-runtime.test.ts -- --reporter=verbose passed: 71 tests.
  • pnpm test src/agents/pi-embedded-runner/run/attempt.test.ts -- --reporter=verbose -t "maps provider-prefixed tool names to allowed canonical tools|normalizes toolUse and functionCall names before dispatch|preserves multi-segment tool suffixes" passed: 3 tests, 124 skipped.
  • Initial test attempt failed because node_modules was missing; ran one pnpm install per repo instructions, then retried.

Known review limits:

  • No live Ollama/Kimi request was run; review used mocked stream tests, code tracing, issue context, and official API docs.

ClawSweeper Guardrails

  • Re-check the finding against latest main before changing code.
  • Keep the patch to the narrowest behavior change and matching regression coverage.
  • Do not merge automatically; this PR stays for maintainer review.

ClawSweeper 🐠 replacement reef notes:

  • Cluster: clawsweeper-commit-openclaw-openclaw-89f871679e8d
  • Source PRs: none
  • Credit: Detected by ClawSweeper commit review for 89f8716.; Original commit author: Peter Steinberger.
  • Validation: pnpm check:changed

fish notes: model gpt-5.5, reasoning medium; reviewed against b1deca6.

@clawsweeper clawsweeper Bot added clawsweeper Tracked by ClawSweeper automation clawsweeper:commit-finding PR created from a ClawSweeper commit finding labels Apr 29, 2026
@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

Codex review: needs maintainer review before merge.

What this changes:

The PR updates Ollama tool-call name normalization to preserve exact registered tool names, only strip provider prefixes when the stripped suffix is allowlisted, and adds stream-runtime regression tests for replay and response conversion.

Maintainer follow-up before merge:

This is an open implementation PR with a narrow applicable patch; the remaining action is maintainer review and validation, not a separate automated repair job.

Security review:

Security review cleared: The diff touches tool-name normalization but adds no dependencies, workflow changes, secret handling, or broader execution permissions, and it narrows prefix rewriting when an allowlist is available.

Review details

Best possible solution:

Land this allowlist-aware Ollama normalization, or an equivalent maintainer patch, after changed-gate validation so exact registered tool names remain stable while known provider-prefixed names still map to canonical tools.

Acceptance criteria:

  • pnpm test extensions/ollama/src/stream-runtime.test.ts -- --reporter=verbose
  • pnpm test src/agents/pi-embedded-runner/run/attempt.test.ts -- --reporter=verbose -t "maps provider-prefixed tool names to allowed canonical tools|normalizes toolUse and functionCall names before dispatch|preserves multi-segment tool suffixes"
  • pnpm check:changed

What I checked:

Likely related people:

  • steipete: Commit 89f8716 added the current Ollama prefixed tool-call normalizer and response/replay tests, and related issue discussion says that commit fixed the original report on main. (role: recent maintainer / introduced current behavior; confidence: high; commits: 89f871679e8d, 4b4e0c82e451; files: extensions/ollama/src/stream.ts, extensions/ollama/src/stream-runtime.test.ts)
  • Shakker: Git history shows commit c85ff84 introduced the Ollama stream adapter/test file and the embedded-runner tool-call normalization helper that this PR mirrors. (role: introduced adjacent Ollama adapter and shared normalization surface; confidence: medium; commits: c85ff84334b7; files: extensions/ollama/src/stream.ts, extensions/ollama/src/stream-runtime.test.ts, src/agents/pi-embedded-runner/run/attempt.tool-call-normalization.ts)

Remaining risk / open question:

  • I did not rerun tests because this review was explicitly read-only; the PR body reports the targeted Ollama stream-runtime tests and focused embedded-runner normalization tests passed.
  • No live Ollama/Kimi request is documented for the exact tool_ / function- canonical-name edge case, so the proof is code tracing plus mocked conversion coverage.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 4b4e0c82e451.

@vincentkoc vincentkoc self-assigned this Apr 29, 2026
@vincentkoc
vincentkoc merged commit 7b97af4 into main Apr 29, 2026
73 of 81 checks passed
@vincentkoc
vincentkoc deleted the clawsweeper/clawsweeper-commit-openclaw-openclaw-89f871679e8d branch April 29, 2026 21:08
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
openclaw#74563)

Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
openclaw#74563)

Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
openclaw#74563)

Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
openclaw#74563)

Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
openclaw#74563)

Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:commit-finding PR created from a ClawSweeper commit finding clawsweeper Tracked by ClawSweeper automation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant