openclaw - ✅(Solved) Fix [Bug]: Ollama Kimi tool call fails with "Tool exec not found" despite /tools showing exec [2 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74487Fetched 2026-04-30 06:23:36
View on GitHub
Comments
2
Participants
3
Timeline
11
Reactions
2
Timeline (top)
commented ×2cross-referenced ×2labeled ×2mentioned ×2

OpenClaw 2026.4.26 (be8c246) Provider/model: ollama/kimi-k2.5:cloud Channel: Telegram DM Runtime: OpenClaw Pi Default Execution: direct tools.profile: coding /tools compact shows exec available

Issue: In a Telegram DM session, asking the agent to use exec fails with:

Tool exec not found Exec: pwd failed: Tool exec not found I also tried starting a fresh Telegram session with /new and then repeated the same exec/pwd request. It still fails with the same "Tool exec not found" behavior.

Local test: This local command works:

sudo -H openclaw agent --session-id test-exec --local --model ollama/kimi-k2.5:cloud --message "Usa exec para ejecutar pwd. Responde solo con el resultado." --timeout 120

Result:

/root/.openclaw/workspace

Config details:

  • models.providers.ollama.api = ollama
  • models.providers.ollama.baseUrl = https://ollama.com
  • tools.deny = not configured -- agents.list = not configured
  • /tools compact in Telegram shows exec in Built-in tools
  • /status in Telegram shows:
    • Model: ollama/kimi-k2.5:cloud
    • Session: agent:main:telegram:direct:124218767
    • Execution: direct
    • Runtime: OpenClaw Pi Default
    • Think: off

Expected: The Telegram session should be able to call exec because /tools shows exec available and the local OpenClaw agent run can execute pwd successfully.

Actual: The Telegram session reports "Tool exec not found" even after /new.

Root Cause

Expected: The Telegram session should be able to call exec because /tools shows exec available and the local OpenClaw agent run can execute pwd successfully.

Fix Action

Fixed

PR fix notes

PR #74499: fix(ollama): normalize prefixed tool-call names before Ollama dispatch

Description (problem / solution / changelog)

Summary

  • Problem:
    • Ollama adapter was sending/handling tool call names like functions.exec or tools.exec without normalization, so tool matching could fail in downstream dispatch.
  • Why it matters:
    • Tool calls from assistant/history/round-trip data could be rejected or misrouted, causing real tool execution failures in tool-using chats.
  • What changed:
    • Added normalizeOllamaToolCallName in extensions/ollama/src/stream.ts.
    • Applied normalization when converting assistant content to Ollama tool calls (convertToOllamaMessages path via extractToolCalls).
    • Applied normalization when rebuilding assistant messages from Ollama responses (buildAssistantMessage) so SDK-facing tool calls stay canonical.
    • Added two regression tests in extensions/ollama/src/stream-runtime.test.ts for both directions of normalization.
  • What did NOT change (scope boundary):
    • No schema/API changes, no provider-level behavior changes outside Ollama extension, no model/provider config changes, no security surface changes.

Change Type

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #74487
  • Related #
  • This PR fixes a bug or regression

Root Cause

  • Root cause:
    • Tool names coming in as legacy/provider-prefixed forms (functions.*, tools.*) were passed through unchanged in Ollama-adapter conversion paths.
  • Missing detection / guardrail:
    • No shared normalization guard existed in the Ollama request/response conversion boundary for tool-call names.
  • Contributing context (if known):
    • Observed during investigation of tool-call dispatch failures across Ollama/Kimi-style prefixed tool names.

Regression Test Plan

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • extensions/ollama/src/stream-runtime.test.ts
  • Scenario the test should lock in:
    • functions.exec / tools.exec tool-call names are normalized to exec in both outgoing Ollama messages and incoming tool-call reconstruction.
  • Why this is the smallest reliable guardrail:
    • It directly verifies the exact normalization boundary where the defect appears.
  • Existing test that already covers this (if any):
    • N/A (new regression coverage added)
  • If no new test is added, why not:
    • N/A

User-visible / Behavior Changes

  • Tool-call names with functions.* / tools.* prefixes now normalize to canonical names during Ollama conversion.
  • No user-facing UI changes.
  • No defaults/configuration changes.

Diagram

Before: [user assistant toolCall (functions.exec)] -> [Ollama request conversion sends "functions.exec"] -> [tool lookup mismatch / no-op execution]

After: [user assistant toolCall (functions.exec)] -> [normalize name -> "exec"] -> [Ollama conversion and SDK tool-call reconstruction use "exec"] -> [tool executes normally]

Security Impact

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No changes in behavior, only name normalization)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:
    • N/A

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node.js (repo runtime)
  • Model/provider: Ollama / Kimi/GLM-compatible endpoints
  • Integration/channel (if any): Tool execution flow in OpenClaw assistant runtime (Ollama extension)
  • Relevant config (redacted): standard local config

Steps

  1. Trigger assistant tool-call with prefixed names (functions.exec, tools.exec) from historical/Anthropic-compatible tool-call payloads.
  2. Route through Ollama stream path and check emitted Ollama payloads/tool-call reconstruction.
  3. Run focused tests for extensions/ollama/src/stream-runtime.test.ts (planned).

Expected

  • Prefixed tool names are converted to canonical names before Ollama interaction.

Actual

  • Implemented and covered by unit tests.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios:
    • Read-through code-path inspection for outbound (convertToOllamaMessages) and inbound (buildAssistantMessage) tool-call conversions.
    • Added/validated focused regression tests for both sides.
  • Edge cases checked:
    • empty/standard tool names, prefixed names.
  • What you did not verify:
    • Full live runtime smoke run in a running OpenClaw instance (not executed in this pass).

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:
    • N/A

Risks and Mitigations

  • Risk:
    • Rare edge case where a tool name intentionally starts with functions or tools as a literal prefix without separator.
  • Mitigation:
    • Prefix stripping only applies when followed by ., /, _, or - and only in Ollama conversion paths; normal non-prefixed names are unchanged.

Changed files

  • extensions/ollama/src/stream-runtime.test.ts (modified, +74/-0)
  • extensions/ollama/src/stream.ts (modified, +24/-3)

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

Description (problem / solution / changelog)

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 89f871679e8def9aab0d7054f75f807b0e65e548.; Original commit author: Peter Steinberger.
  • Validation: pnpm check:changed

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

Changed files

  • extensions/ollama/src/stream-runtime.test.ts (modified, +79/-0)
  • extensions/ollama/src/stream.ts (modified, +60/-8)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

OpenClaw 2026.4.26 (be8c246) Provider/model: ollama/kimi-k2.5:cloud Channel: Telegram DM Runtime: OpenClaw Pi Default Execution: direct tools.profile: coding /tools compact shows exec available

Issue: In a Telegram DM session, asking the agent to use exec fails with:

Tool exec not found Exec: pwd failed: Tool exec not found I also tried starting a fresh Telegram session with /new and then repeated the same exec/pwd request. It still fails with the same "Tool exec not found" behavior.

Local test: This local command works:

sudo -H openclaw agent --session-id test-exec --local --model ollama/kimi-k2.5:cloud --message "Usa exec para ejecutar pwd. Responde solo con el resultado." --timeout 120

Result:

/root/.openclaw/workspace

Config details:

  • models.providers.ollama.api = ollama
  • models.providers.ollama.baseUrl = https://ollama.com
  • tools.deny = not configured -- agents.list = not configured
  • /tools compact in Telegram shows exec in Built-in tools
  • /status in Telegram shows:
    • Model: ollama/kimi-k2.5:cloud
    • Session: agent:main:telegram:direct:124218767
    • Execution: direct
    • Runtime: OpenClaw Pi Default
    • Think: off

Expected: The Telegram session should be able to call exec because /tools shows exec available and the local OpenClaw agent run can execute pwd successfully.

Actual: The Telegram session reports "Tool exec not found" even after /new.

Steps to reproduce

  1. Run OpenClaw 2026.4.26 (be8c246) on Ubuntu VPS as root.
  2. Configure Telegram DM with the main/default agent.
  3. Configure Ollama Cloud as:
    • models.providers.ollama.api = ollama
    • models.providers.ollama.baseUrl = https://ollama.com
    • model = ollama/kimi-k2.5:cloud
  4. In Telegram, run /status and confirm:
    • Execution: direct
    • Runtime: OpenClaw Pi Default
    • Model: ollama/kimi-k2.5:cloud
  5. In Telegram, run /tools compact and confirm exec appears in Built-in tools.
  6. In Telegram, run /new.
  7. In Telegram, run /verbose on.
  8. Debes llamar la tool exec ahora. Ejecuta exactamente: pwd No expliques nada. Después de la tool, responde solo con stdout.
  9. Observe the response: Tool exec not found Exec: pwd failed: Tool exec not found
  10. Compare with local CLI test: sudo -H openclaw agent --session-id test-exec --local --model ollama/kimi-k2.5:cloud --message "Usa exec para ejecutar pwd. Responde solo con el resultado." --timeout 120
  11. Local CLI test succeeds and returns: /root/.openclaw/workspace

Expected behavior

The Telegram session should be able to call the exec tool because /tools compact shows exec as an available built-in tool, the session is running with Execution: direct and Runtime: OpenClaw Pi Default, and the same model can execute pwd successfully through a local OpenClaw agent run.

When asked to run pwd via exec, the Telegram session should call exec and return the command stdout, e.g.:

/root/.openclaw/workspace

Actual behavior

The Telegram session reports that exec is not found, even though /tools compact shows exec as available.

Observed response after asking the Telegram session to run pwd via exec:

Tool exec not found Exec: pwd failed: Tool exec not found

This still happens after starting a fresh Telegram session with /new and enabling verbose output with /verbose on.

The same model works through a local OpenClaw agent test and returns:

/root/.openclaw/workspace

OpenClaw version

OpenClaw 2026.4.26 (be8c246)

Operating system

ubuntu 24.04

Install method

npm global

Model

ollama/ kimi2.5

Provider / routing chain

Provider/model: ollama/kimi-k2.5:cloud Auth: api-key (ollama:default) Runtime: OpenClaw Pi Default Execution: direct Channel/session: Telegram DM, agent:main:telegram:direct:124218767 Ollama config: - models.providers.ollama.api = ollama - models.providers.ollama.baseUrl = https://ollama.com

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue might be related to the configuration or availability of the exec tool in the Telegram DM session, despite it being listed as available in /tools compact.

Guidance

  • Verify that the exec tool is properly configured and enabled for the specific model and provider used in the Telegram DM session.
  • Check the OpenClaw documentation to ensure that the exec tool is compatible with the ollama/kimi-k2.5:cloud model and the OpenClaw Pi Default runtime.
  • Compare the configuration and setup of the local OpenClaw agent test that succeeds with the Telegram DM session configuration to identify any differences.
  • Consider checking the permissions and access controls for the exec tool in the Telegram DM session to ensure it can be executed by the agent.

Example

No specific code example is provided as the issue seems to be related to configuration and setup rather than code.

Notes

The issue might be specific to the interaction between OpenClaw, the ollama/kimi-k2.5:cloud model, and the Telegram DM session. Further investigation into the configuration and setup of these components is necessary to identify the root cause.

Recommendation

Apply workaround: Verify and adjust the configuration of the exec tool and the Telegram DM session to ensure compatibility and proper setup, as the issue seems to be related to the specific environment and setup rather than a version-specific bug.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The Telegram session should be able to call the exec tool because /tools compact shows exec as an available built-in tool, the session is running with Execution: direct and Runtime: OpenClaw Pi Default, and the same model can execute pwd successfully through a local OpenClaw agent run.

When asked to run pwd via exec, the Telegram session should call exec and return the command stdout, e.g.:

/root/.openclaw/workspace

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING