Skip to content

fix: Tool Search uses one dispatcher name across providers - #169552

Merged
steipete merged 6 commits into
mainfrom
fix/tool-search-dispatch-action
Oct 13, 2026
Merged

steipete merged 6 commits into
mainfrom
fix/tool-search-dispatch-action

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Related: #145137. Builds on #167933; thanks to @lator57-gif for the local-model report.

What Problem This Solves

Ollama's parser confuses the generic tool_call dispatcher with chat-template markers, while its wire alias introduces a second name that small models can mix up.

User Impact

Generic Tool Search now uses dispatch_action consistently across providers. Update custom instructions to use that name with the existing id and args shape. Completed tool_call history remains readable and displays the target tool without rewriting stored transcripts. Existing literal and wildcard policies and literal hook matchers remain effective; hook/event fields and tool_call: invocation IDs are unchanged. Codex keeps its native tool surface.

Direct Ollama names that still collide with parser envelopes, such as ls, name, and function, retain wire aliases. The dispatcher-specific description rewriting and historical alias allocation are removed. This does not change security defaults, configure web search, or expose deferred web tools directly; that is a separate follow-up.

Why This Change Was Made

One canonical dispatcher spelling removes the prompt/wire mismatch. The remaining adapter covers only advertised colliding names, including their selectors and streamed results. Historical names reserve the alias namespace without becoming new aliases; the shipped dispatcher is preserved before function-prefix normalization, including beside a direct tool named call.

Evidence

Native Ollama 0.40.2, qwen3:8b, through real pnpm openclaw --profile <isolated-profile> agent --local:

Flow Result Agent / CLI wall
Main baseline, Use exec to run echo hello and report the actual stdout. Do not answer from memory. Actual hello; dispatcher offered as openclaw_tool_call 25.422 / 121.227 s
This head, same echo prompt Actual hello; dispatch_action offered directly, no dispatcher alias 31.224 / 134.623 s
Explicit tool_search → dispatch_action search → dispatch_action fetch Real search and fetch; page title Ollama, native endpoint /api/chat; zero tool failures 25.112 / 131.950 s
Old web-after transcript continuation, fetch https://example.com History retained tool_search, tool_call, tool_call; current declarations used dispatch_action; returned Example Domain 90.957 s CLI

The copied schema-25 profile first refused admission with explicit Doctor guidance. doctor --fix --yes --non-interactive migrated the copy to schema 26; original database bytes stayed unchanged. The subsequent real continuation supplied the old tool names unchanged to Ollama. No transcript-name migration was added here.

security audit still reports models.small_params; security audit --fix changed neither configuration bytes nor the tools policy. This advisory finding is not a runtime model block.

The first cold CLI attempt exceeded the former 180-second process allowance before any model request; it is excluded from model results. Launch allowance is now 720 seconds, with the agent deadline still 120 seconds. The matched echo captures report 8,199 initial native prompt tokens on main and 8,205 here (+6); different worktree paths and bounded skill-description truncation also affect those bytes. There is no claim of material prompt savings.

  • Rename/display/native replay regressions failed on the main base. A review regression reproduced legacy tool_call being rewritten to openclaw_call, then passed after the correction.
  • Core policy/display/surface: 195 passing tests (115.54 s Vitest); agent tool assembly: 49 (101.31 s); Tool Search/runtime: 115 (149.40 s).
  • Ollama schema/alias boundary: 20 passed (88.22 s); after the replay correction, all 19 alias cases passed (48.47 s runner wall). Five Codex exclusion cases passed (217.43 s runner wall), and two Copilot catalog-guidance cases passed (runner process 420.80 s, mostly cold transforms).
  • QA routing/fixture run passed 31 cases and found two stale expected-log cases; after fixing the emitted fixture name, all three failure-evidence cases passed (140.42 s runner wall).
  • Swift selected run: 93 tests passed. Android local execution is unavailable because this host has no Android SDK; CI owns that platform check.
  • Core, Ollama, Codex, and Copilot typechecks and targeted lint passed. QA Lab reports the unchanged base fixture's sessionFile / SessionEntryCore type error.
  • Required ratchets passed. Full build passed (reported 21m 3.1s); final runtime build passed (9m 27.7s). Prompt snapshots regenerated with zero tracked changes; these fixtures omit the generic dispatcher, so native token measurements are reported separately.
  • Codex autoreview: scoped-clean through P2 at f63c37a3fff9ef37e78600b102f4925761acfa8e.

Runtime production +51/-54 (net -3); QA/scripts +35/-29 (net +6); tests/test support +282/-243; docs +38/-28. Counting every non-test code path, this is +86/-83 (net +3). The alias cleanup pays for runtime compatibility; the remaining growth is the QA/tooling cutover and formatter wrapping for the longer canonical name. No changelog edit.

CI follow-up

The first exact-head CI exposed two sorted allowlist expectations that retained the dispatcher's old alphabetical position. The follow-up changes only those two expectations; all six owner tests pass (316.03 s runner wall, dominated by cold transforms). Production code and the model payload construction used for live proof are unchanged. Autoreview is clean again through P2; the runtime rebuild passed (3m 27.3s).

First CI merge 2b136b9300e27591c39ceb8214fae56b987d96d3 used main base 00809bf2c2a0f9a154f57c76909b7457a058af29. Independent base-only reproductions:

Failure Exact-base result
agent-tools.model-provider-collision.test.ts, unauthenticated direct Codex search Same missing web_search assertion; 1 failed/6 passed, 159.88 s process wall
eager-import-closure.test.ts Same three duplicate closure paths; 1 failed/16 passed, 165.10 s
settled-turn-finalizer.native.test.ts Same four SessionTranscriptWriterClaimReboundError failures; 4 failed/5 passed, 245.63 s
gateway-widget-restart.e2e.test.ts Same two non-recovery requests and pending recovery entry; failed on base, 98.05 s
gateway-workshop-learning.e2e.test.ts Same missing 💾 Learned: assertion on Linux base; macOS instead reached its test deadline

Linux proof used the default Blacksmith Testbox through the repository wrapper: tbx_01m4q8twrz1hw72ena6tpgsxty, run. The payload verified the exact base tree before execution. The owned lease stopped after the run.

The separate skill-library-worker-wire.e2e.test.ts placement-authority failure at the replacement turn after cancellation did not reproduce on that base on macOS (passed, 291.70 s) or Linux (passed, 75.49 s runner wall). The changed provider fixture contains no remaining dispatcher-name mismatch; the rejection is in placement admission before model/tool dispatch. This prior CI failure remains investigated but unresolved; no repair or passing replay is claimed as a fix. The new head must still complete CI.

Final-head checks

At f63c37a3fff9ef37e78600b102f4925761acfa8e, CI has 95 successful jobs and these remaining failures (the aggregate openclaw/ci-gate is consequently red):

  • Workshop's missing 💾 Learned: assertion, reproduced on the CI main base in the Linux run above.
  • Widget restart's two non-recovery requests/pending recovery entry, reproduced on that main base locally.
  • Android third-party flavor: NodeRuntimeAgentSelectionTest.removedAgentFallsBackToGatewayDefaultAfterReconnect, expected the device-owned main key but observed main immediately after reconnect/agent refresh. The tested merge is 05bdd103d66f50c053c503a13322b010696e4134, with main parent 1c20c58fbf79935d6e2254b4ce13e1b37891c4c4. Its failing test, NodeRuntime.kt, and ChatController.kt are blob-identical to that parent. This fixture supplies no tool-call content to the changed display helper, and the failure occurs in session selection, before tool display. This is same-base source/causal attribution, not a claim that a baseline Android run was executed. The earlier head's identical Android changes passed third-party tests; Play, Wear, native access, and ktlint also pass on this head. No retry is claimed as a repair.

The earlier search-route, closure, finalizer, and worker-placement failures are absent from this run. The placement failure remains a recorded prior-run uncertainty, not a claimed fix.

ClawSweeper reviewed this exact head with no findings and no Before merge items; live proof is sufficient. Nothing is merged.

Rename the generic dispatcher to dispatch_action and retain read-only historical display plus shipped policy and hook matching. Keep Ollama wire aliases only for directly advertised names that collide with its parser envelopes. Preserve tool_call invocation IDs and event contracts. Builds on #167933 and the local web-tool report from @lator57-gif in #145137.
@steipete steipete added the ci:no-fail-fast Keep all selected CI matrix jobs running after failures on the next PR run. label Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: android App: android gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling extensions: qa-lab extensions: codex extensions: ollama extensions: copilot size: L labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR renames the generic Tool Search dispatcher to dispatch_action while preserving historical display, policy, and hook compatibility.

Example: Qwen3:8b searches for a web tool and invokes it through native Ollama.

  • Before: Instructions name tool_call while Ollama advertises openclaw_tool_call.
  • After: Instructions and declarations both use dispatch_action with the existing id and args parameters.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A coherent, owner-approved cutover with shipped-entry-point proof and no identified introduced bug; incomplete CI does not establish merge readiness.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Reported real CLI runs exercise the changed Tool Search owner through native Ollama 0.40.2 with Qwen3:8b, completing explicit dispatch, real search/fetch, and old-transcript continuation; subsequent follow-ups retain the demonstrated production cutover.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Small models can receive two spellings for the same Tool Search dispatcher and confuse the offered function name.
Reason: The feature-history owner authorizes the direction, and the change removes dispatcher-specific translation while retaining shipped compatibility.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this maintainer-authored PR open: it makes a coherent dispatcher cutover with preserved compatibility and no identified introduced defect; current-head CI failures still need attribution.

Priority: P2
Reviewed head: df94595f97d303150dd2abe80312ba98eccd9be5

Before merge

  • Complete next step - Classify the runtime-config readiness and sidebar-selection failures against the pinned base, fixing only any failure shown to be introduced by this PR.

Findings

None.

Agent review details

How this fits together

Tool Search compacts authorized core, plugin, MCP, and client tools into a catalog; provider-facing controls discover entries and dispatch calls through their existing execution owners.

flowchart LR
A[Authorized tools] --> B[Tool Search catalog]
B --> C[Provider tool declarations]
C --> D[Model call]
D --> E[dispatch_action]
E --> F[Target execution owner]
F --> G[Result and transcript]
Loading

Technical review

Best possible solution:

Use one generic dispatcher name, retain shipped policy and transcript compatibility, and keep parser aliases confined to the Ollama transport.

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

Source establishes the prompt/wire spelling mismatch and Ollama's envelope-sensitive parser; supplied live runs exercise the replacement, while the reported baseline echo also succeeds with the existing adapter.

Is this the best way to solve the issue?

The shared rename removes dispatcher-specific transport rewriting and preserves the existing execution owner, with narrower aliases retained for direct names that still collide.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7c1c689bfcac.

Provenance checked

  • Generic Tool Search dispatcher changes intended behavior with a stated reason (93acb38: The original Tool Search implementation supplied structured search, describe, and call controls for compact catalogs.)
  • Ollama alias allocation and descriptor rewriting changes intended behavior with a stated reason (8899f3b: Prevent advertised tool names from matching chat-template envelopes before the intended JSON function name.)
  • Presentation-only dispatcher unwrapping keeps the original intent (a226ca2: Show the target tool's useful details without changing invocation identity or stored transcripts.)
  • Literal plugin hook matchers keeps the original intent (68dbf92: Scope hooks and policy relay to named tools while rejecting malformed matchers.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8899f3b adds extensions/ollama/src/tool-name-aliases.ts:13 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8899f3b8dae5; files: extensions/ollama/src/tool-name-aliases.ts)
  • Naka Masato: Raw commit 68dbf92 adds src/plugins/tool-hook-matcher.ts:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 68dbf92281cc; files: src/plugins/tool-hook-matcher.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: A focused provider-reliability improvement; the existing adapter already supports successful calls.
  • merge-risk: 🚨 compatibility: The model-facing dispatcher and literal plugin matcher behavior change; the maintainer explicitly accepts the custom-instruction update while preserving shipped policies and history.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-12T02:55:00.719Z sha 8cdb7fd :: blocked before merge. :: none
  • reviewed 2026-10-12T03:29:46.893Z sha 8cdb7fd :: needs changes before merge. :: [P2] Update both sorted allowlist expectations for dispatch_action
  • reviewed 2026-10-12T05:59:49.452Z sha f63c37a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T06:14:38.754Z sha f63c37a :: needs changes before merge. :: none
  • reviewed 2026-10-12T07:21:34.494Z sha f63c37a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T09:43:15.727Z sha 4d6e9e6 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T17:43:11.983Z sha 68e3a0b :: needs maintainer review before merge. :: none

Reviewed October 12, 2026, 8:00 PM ET / October 13, 2026, 00:00 UTC (Revision 8).

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: df94595f97d303150dd2abe80312ba98eccd9be5
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/tool-policy-match.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/tool-policy-shared.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 12, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 12, 2026
@steipete steipete self-assigned this Oct 12, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 13, 2026
@steipete
steipete merged commit da14b62 into main Oct 13, 2026
165 of 174 checks passed
@steipete
steipete deleted the fix/tool-search-dispatch-action branch October 13, 2026 03:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…169552)

* fix: Tool Search uses one dispatcher name across providers

Rename the generic dispatcher to dispatch_action and retain read-only historical display plus shipped policy and hook matching. Keep Ollama wire aliases only for directly advertised names that collide with its parser envelopes. Preserve tool_call invocation IDs and event contracts. Builds on openclaw#167933 and the local web-tool report from @lator57-gif in openclaw#145137.

* fix: preserve legacy dispatcher replay beside direct call tools

* test: align sorted allowlists with the dispatcher name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: android App: android ci:no-fail-fast Keep all selected CI matrix jobs running after failures on the next PR run. docs Improvements or additions to documentation extensions: codex extensions: copilot extensions: ollama extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts security-sensitive-changed size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant