Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 12:47 AM ET / 04:47 UTC (Revision 2). ClawSweeper reviewWhat this changesTool Search now finds trusted tools through parameter names and descriptions inside composed schemas and tuple items. Merge readiness✅ Ready for maintainer review This repair remains necessary on current main and the latest release. The pinned patch has sufficient behavior proof and no actionable correctness findings. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw Tool Search turns the current policy-filtered tool catalog into searchable metadata. Its shared ranking index feeds discovery in both structured and directory modes before normal tool execution. flowchart TD
A[Available tool catalog] --> B[Visibility filtering]
B --> C[Trusted schema metadata]
C --> D[Bounded schema traversal]
D --> E[Lexical search index]
F[Search query] --> E
E --> G[Ranked tool descriptors]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +83. Total +85 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep one bounded metadata walker serving both discovery modes while preserving trusted-source filtering and existing execution contracts. Do we have a high-confidence way to reproduce the issue? Yes: current-main source deterministically omits orchard/apples metadata inside composition branches, and the contributor records before/after runs through both real control modes. This reviewer did not execute the reproduction. Is this the best way to solve the issue? Yes: extending the existing shared traversal repairs the documented discovery contract without another index, configuration option, or public API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 350e91cf7656. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Verified the actual built Gateway path on current main An explicitly allowed local plugin registers
The first root-level single-branch union fixture was normalized before cataloging and therefore already matched on main; the nested union above preserves the composition at the real indexing boundary and discriminates the fix. The candidate regression file run against current-main production code had 7 failures and 34 passes (22.22s); the candidate passed all 41 tests (23.10s). This includes all three composition keywords, nested schemas, unchanged ranking cases, both untrusted sources remaining untraversed, and bounded cyclic traversal. Live check on the candidate: two real No overlap with Pash/Sarah changes. No source changes were needed on top of @harshitgupta31415's fix, and the guarded push confirmed the existing head. No CI jobs were rerun. CI and ClawSweeper are ready on that exact SHA; the PR is mergeable. |
|
Landed as 805a5be. Thanks @harshitgupta31415, for the report and the fix! |
Fixes openclaw#164024. Tool Search did not index a trusted tool's parameter names or descriptions when they sit under `anyOf`, `oneOf` or `allOf`, so queries matching only those terms found nothing. Composed schemas are now walked with bounded, cycle-safe traversal. Flat-schema matches and ranking order are unchanged, and untrusted MCP and client tools stay unindexed. Proof: on a built Gateway, `tool_search` for terms inside a trusted plugin's nested `anyOf` returned nothing on base and `indexed_resource` on this change. A recursive `$ref` schema completed without indexing unused definitions. The regression tests fail on base (7) and pass here. In a live gpt-5-mini turn, the model called `tool_search` and found the tool. Co-authored-by: Ayaan Zaidi <[email protected]>
Fixes #164024, reported and reproduced by @harshitgupta31415.
What Problem This Solves
Tool Search misses a tool when the query appears only in parameter names or descriptions inside
anyOf,oneOf, orallOfschemas.User Impact
Tools with composed schemas become discoverable through their parameter metadata in both structured search and directory mode. Additional indexed words can affect relative search scores; exact-name priority remains covered by the existing tests.
Why This Change Was Made
The shared metadata walker followed object properties and array items but omitted composition branches. This extends that existing traversal, preserving its depth limit, trusted-source filtering, and cache refresh behavior. The same loop also handles tuple items. Production change: 5 additions, 3 deletions (+2 lines); the added child-schema edges require no separate index, configuration, or public API change.
Evidence
4a0be71e57ab19d08518879dcab11c5e9c798cd6: five added cases failed while all 33 existing ranking tests passed. The miss wasexpected [] to deeply equal ['indexed_resource'].3a6e3673c37a520e6b03be24368ddf5b9c577f51.createToolSearchToolsand the real catalog compaction, search, describe, and call paths. No search/runtime functions are mocked, and discovery never invokes the target tool. The same script failed before the fix and passed after it:0.68.0passed for both changed files on Linux. The Windows native binding was blocked by Application Control; security settings were not changed.git diff --checkpassed. The complete diff was reviewed locally; only the production owner and its regression tests are included. Test delta: +83 lines, including expanding the existing untrusted-source case.The broader Tool Search run passed all 181 tests in four files (273.20s total); core production typecheck and focused lint completed with exit 0 and no diagnostics. The committed-head runtime proof returned
verdict: pass, six passing mode/keyword combinations, and an empty source diff.The full changed-file gate stopped at the Windows SQLite worker ratchet (
1339 -> 2083). Re-running that check with the entire tracked working tree restored to clean base4a0be71e57ab19d08518879dcab11c5e9c798cd6produced byte-identical diagnostic lines and exit 1; the candidate was then restored and verified clean. This baseline failure is unrelated to the metadata repair, and later checks in that gate were not executed. Conflict markers, line-cap, max-lines, and assertion-safety checks passed. Follow-up: investigate the Windows SQLite worker ratchet separately.Changed-test typecheck (
agents-tools) passed in 220.8s. CI run 37096762155 completed successfully on head3a6e3673c37a520e6b03be24368ddf5b9c577f51; all selected test, lint, typecheck, guard, and Gateway checks passed, andopenclaw/ci-gateis green. ClawSweeper review confirmed sufficient behavior proof and no actionable findings on the same head. Ready for maintainer review. The full repository build/test/docs suites have not been run. The original contributor proof was local discovery only; the maintainer Gateway and real-provider checks below extend that evidence.Commands and reproducible runtime proof
node scripts/run-vitest.mjs src/agents/tool-search-ranking.test.ts --maxWorkers=1 node scripts/run-vitest.mjs src/agents/tool-search-ranking.test.ts src/agents/tool-search.test.ts src/agents/tool-search-runtime.test.ts src/agents/tool-search-config.test.ts --maxWorkers=1 node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo node scripts/run-tsgo-core-test-shards.mjs --changed-paths-json '["src/agents/tool-search-ranking.test.ts"]' node scripts/check-changed.mjs --base 4a0be71e57ab19d08518879dcab11c5e9c798cd6 --timed -- src/agents/tool-search-ranking.ts src/agents/tool-search-ranking.test.tsSave the following script outside the checkout and run it from the repository root with
node --import ./scripts/tsx.mjs /absolute/path/behavior-proof.mjs. It exits 1 on the base and 0 with the repair.Maintainer Gateway and live verification
Verified the actual built Gateway path on current main
df883d4cc7bdbfc724cc167ccb2b2e2ecfd727cdand candidate3a6e3673c37a520e6b03be24368ddf5b9c577f51, in isolated Linux containers with Tool Search enabled.An explicitly allowed local plugin registers
indexed_resourcewithpayload.anyOfcontaining an object property namedorchard, described asCollect apples. Neither word appears in the tool name or description. This is an OpenClaw plugin catalog entry, within the documented trusted-schema boundary.tool_searchqueryorchard[]indexed_resourceapples[]indexed_resourcesaffron(flat-schema control)flat_resource,flat_secondaryxylophone(unused$defsbehind recursive$ref)[], completes[], completesThe first root-level single-branch union fixture was normalized before cataloging and therefore already matched on main; the nested union above preserves the composition at the real indexing boundary and discriminates the fix.
The candidate regression file run against current-main production code had 7 failures and 34 passes (22.22s); the candidate passed all 41 tests (23.10s). This includes all three composition keywords, nested schemas, unchanged ranking cases, both untrusted sources remaining untraversed, and bounded cyclic traversal.
Live check on the candidate: two real
gpt-5-minirequests through a passive proxy, both HTTP 200,reasoning_effort: low,max_completion_tokens: 4096. The model calledtool_searchfororchard, receivedindexed_resource, and reported the discovered tool without executing it. Utility jobs were off. An earlier proxy preflight rejected requests missing the explicit reasoning field before any provider call; configuring the model's supported reasoning capability resolved that fixture setup issue. No request/response payloads were rewritten.No overlap with Pash/Sarah changes. No source changes were needed on top of @harshitgupta31415's fix, and the guarded push confirmed the existing head. No CI jobs were rerun. CI and ClawSweeper are ready on that exact SHA; the PR is mergeable.