Repository navigation
fix: explain how to call deferred tools after a direct call - #201488
Conversation
Return dispatcher recovery guidance without executing or exposing deferred tools in structured Tool Search mode. Keep directory hydration and Code Mode behavior unchanged at the extracted execution boundary. Co-authored-by: vincentkoc <[email protected]>
Worked on by: - @vincentkoc Co-authored-by: vincentkoc <[email protected]> OpenClaw-Publication: 47f1dc88-d37c-473f-9bf1-55e3840c6ed0
|
🦞👀 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. What this changesThis PR directs models that call deferred tools directly to retry through dispatch_action. Example: In structured Tool Search mode, a model calls sessions_list({}) directly.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current diagnostic gap through the existing resolver, preserves execution ownership, and introduces no concrete correctness defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe embedded agent runner resolves structured model tool calls against registered tools and the current deferred catalog, returning recovery errors while dispatch_action retains deferred execution. flowchart TD
A[Model tool call] --> B[Agent loop]
B --> C[Registered tool lookup]
C --> D[Deferred resolver]
D --> E[Current catalog lookup]
E --> F[Recovery guidance]
F --> A
A --> G[dispatch_action]
G --> H[Existing tool execution]
Technical reviewBest possible solution: Retain the focused resolver repair and existing dispatcher execution path, crediting the earlier contribution. Do we have a high-confidence way to reproduce the issue? Current-main resolver wiring and the agent-loop fallback establish the failure path; the linked issue supplies deterministic CLI and Gateway reproductions, inspected without execution. Is this the best way to solve the issue? The existing deferred-resolution hook is the appropriate owner: the added branch explains the documented dispatcher route without executing the target, and the extracted module preserves the existing recovery and hydration boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6615c148e4b7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +39, Tests +85, Docs +3. Total +127 across 4 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 18, 2026, 5:40 PM ET / 22:40 UTC. |
Closes #186716
What Problem This Solves
A model that calls a deferred tool directly in structured Tool Search mode gets only “Tool not found,” even though the tool is available through discovery. That gives it no actionable way to recover in the same turn.
User Impact
The embedded harness now tells the model to call
dispatch_actionwith the tool name inidand its parameters inargs. The rejected direct call does not execute or expose the tool. Unknown, filtered, ambiguous, and exact-ID-only names keep their existing behavior. No configuration, defaults, permissions, executor, or native-harness behavior changes.Why This Change Was Made
The existing deferred-tool resolver was installed only for Code Mode and directory mode. It now also handles recovery when the structured dispatcher is actually registered, using the same current catalog lookup and returning guidance before tool adaptation.
The resolver moves intact into one named execution-boundary module so the capped preparation source and test suite do not grow past their limits. Code Mode guidance and directory hydration retain their existing owner and hooks; there is no second execution path or new state. Simplification pass: production +39 net lines (mostly the extracted boundary’s typed input), regression +85 lines, documentation +3 lines.
Evidence
Tool probe_write not foundinstead of dispatcher guidance. The final focused regression verifies the guidance, no direct execution or provider exposure, unchanged filtered/unknown rejection, and exactly one real file write throughdispatch_action.pnpm buildpassed again at published headdb16310f5ddf9086622cca30a0a63e5e56357c30(1m 47.9s; clean build inputs). Core production and agents-other test typecheck leaves passed.git diff --checkpassed.c5ef395ba7204c83240074b584e97f550a3aab7d, with the catalog, agent loop, and client-tool assembly supplied as context: GPT-6.1 Sol, P0–P2, scoped-clean; no actionable findings. The reviewer did not run tests. Hosted ClawSweeper also reported no actionable patch findings at the published head.Real isolated Gateway recovery proof
Passed at the published head through the repository's compiled Gateway test lane, using
createOpenClawTestInstance, its standard authenticated synthetic test client, and a local scripted model provider. This exercises the actual Gateway and embedded agent; it is not a live third-party-model test.The provider first emitted a direct
sessions_listcall. It received the recovery error, followed that guidance withdispatch_action, and received the real session-list result. The target remained absent from all three provider tool declarations, and the turn completed without rerouting:The Gateway proof took 7.064 seconds; its test lane completed in 14.56 seconds including preparation. Earlier source-only startup and operator-CLI attempts hit worker-ownership and attribution guards. The standard compiled synthetic test fixture supplied the successful proof without disabling either safeguard. The previous end-to-end verification gap is resolved; no source push or CI rerun was needed.
Thanks to @xyrolle for the report and proposed recovery approach in #186718, and @vincentkoc for requesting the repair.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by