Skip to content

fix: send the desktop and GitHub tools only after a chat first uses them - #204805

Merged
VACInc merged 10 commits into
openclaw:mainfrom
VACInc:fix/lazy-direct-tools
Nov 25, 2026
Merged

VACInc merged 10 commits into
openclaw:mainfrom
VACInc:fix/lazy-direct-tools

Conversation

@VACInc

@VACInc VACInc commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

High Level TLDR

With Tool Search or Code Mode on (the default for OpenClaw's own runtime and for most frontier models), two heavy tools were still sent on every model request whether or not the chat ever used them: computer (desktop control) and github_publish. Together they were about 13k characters of tool definitions per request, and most of github_publish's size was a long procedural manual in its description.

This PR makes both tools load when the model looks them up, then stay direct: they start in the Tool Search / Code Mode catalog with a short entry. When the model describes one (or tries to reach it through dispatch_action), the next request in the same turn carries its definition, so the model calls it as a normal direct tool, and the session keeps it for the rest of the conversation (across Gateway restarts). It also cuts github_publish's description from about 6.1k to under 800 characters and moves each procedure into the result of the action where the model needs it.

User impact: a default unsandboxed session with Tool Search sends about 13k fewer characters (roughly 3.3k tokens) of tool definitions on every request until it actually uses one of these tools. Screenshots, the PR-preparation turn handoff and all Gateway checks behave as before.

Root Cause

  • shouldCatalogTool in src/agents/tool-search-catalog.ts keeps any catalogMode: "direct-only" tool out of the catalog, so it is sent on every request in every catalog mode.
  • computer (src/agents/tools/computer-tool.ts) is direct-only because catalog bridges serialize nested results as JSON and drop the screenshot image block. It is built whenever the model has vision and a computer transport exists, whether or not anything is paired.
  • github_publish (src/agents/tools/github-publish-tool.ts) is direct-only on unsandboxed sessions and sandboxed sessions that adopt a managed workspace, because prepare_pr / publish with workspacePath yield the turn and a Code Mode exec cannot carry that handoff. That marking was added by feat: prepare existing PRs from ordinary chats #178756 ("feat: prepare existing PRs from ordinary chats"); this PR keeps its handoff requirement and only changes when the definition is sent. Publication availability is set on essentially every non-detached Gateway turn (attempt-gateway-tools.ts), so every unsandboxed agent paid for it.
  • describeGitHubPublishTool was a full manual (per-action workflows, requestId recovery, guest and maintainer eligibility, automations continuation, the re-review comment, landing policy): 6,129 of the tool's 7,161 definition characters.

Both reasons for direct-only are about how a call runs (result shape, turn handoff), not about whether the definition must be sent before the tool is ever used.

What Changed

  1. New catalogMode: "on-demand" (generic; only computer and the yielding github_publish listing use it in this PR):
    • The tool is cataloged with an onDemand descriptor fact; search, describe and directory entries carry call: "loads as a top-level tool once looked up; call it by name, not through dispatch_action or exec", and directory rows are marked [loads on lookup].
    • dispatch_action and Code Mode guest calls never run it: they load it and refuse with a message saying it is now a top-level tool to call by name (ToolSearchRuntime.callEntry), so screenshot results and turn handoffs only ever run through a direct call.
    • Load on lookup. tool_describe (and a refused dispatch_action) call the runner's catalogRef.loadOnDemandTool, which hydrates the entry, adds it to the run's context through a new agent-core loadTool hook on the tool execution context, so the next provider request in the same run sends it, and pins it for the session. A live test of the first version showed why this is needed: models do not call a tool that is missing from their tool list, so loading only on a call by name never fired.
    • The embedded runner's existing deferred-tool resolver (already used by directory mode) also hydrates an on-demand entry when the model calls it by name in tools, directory and Code Mode. The call is a normal direct tool call.
    • The session's next-turn step keeps run-loaded tools. createSessionPrepareNextTurnWithContext reset the tool list to the session's tools on a run's first continuation, which dropped a tool loaded during the first tool batch. It now keeps tools the run loaded for itself (marked by appendRunContextTool). This also keeps a resolved deferred tool for the rest of the run instead of re-resolving it on every call.
  2. Promotion lives in the existing session tool pin. On hydration the definition is appended after the pinned tools (promoteSessionTool) and checkpointed with the existing openclaw.system-prompt transcript entry. On the next attempt the restored pin's names mark those on-demand tools direct before compaction (promotedToolNames), folded into the existing installToolListingPin catalog rebuild. No new state store.
    • Survives turns and Gateway restarts (transcript checkpoint).
    • /new, /reset, compaction and a model change start a new prompt series, so the tool is deferred again until its next use. Compaction was chosen as a reset point because it already rebuilds the provider cache and is where context is reclaimed.
    • Sessions pinned before this change already list both tools in their pin, so they stay direct for the rest of that series: no cache break on upgrade.
  3. Opt-in per runner. Only the embedded attempt sets loadsOnDemandTools. Copilot, Codex app-server, cloud workers and headless catalogs cannot load a tool on its first direct call, so they keep on-demand tools direct exactly as today (Codex and Copilot catalogs treat on-demand like direct-only; the worker wire format maps it to direct-only). The flag is not part of the public plugin SDK parameters.
  4. Transport: on-demand catalog names are passed as deferred tool names, so Chat Completions keeps history calls to them native inside the promoting turn.
  5. github_publish description: a short summary plus one line per offered action (793 chars unsandboxed, 572 without publication, 252 observation-only). The moved guidance now arrives in a next field of each action's result (github-publish-guidance.ts), in both the text and details, because Code Mode guests receive only details; the Gateway payload's own fields are unchanged:
    • publish: accepted is not finished, retain requestId, never resubmit, continuation via automations;
    • readiness: never resubmit an accepted requestId;
    • edit read: send headCommit as expectedHeadCommit with the observed title/body, keep attribution and footer; edit write: read again after an uncertain response;
    • request_review: only @clawsweeper re-review was posted, read comments before retrying;
    • inspect: land only on an explicit request from a person with full operator write access, after review and required checks;
    • prepare_pr / refresh_base / upload_evidence / merge / close: their conflict, review-base and retry rules.
      Eligibility, write access and the busy refusals stay enforced and explained by the Gateway's existing checks and messages; nothing the Gateway enforces changed.

Scope Boundary

  • openclaw (security), sessions_yield, view_image, structured_output, session_project and the delegate tool stay direct-only.
  • With Tool Search and Code Mode off, every tool is direct as before. The CLI/MCP and other harness paths are unchanged.
  • The message tool schema work is a separate change and is not touched here.
  • No Gateway, protocol schema, config or migration changes.

Before / After

Real core tool construction (createOpenClawCodingTools with GitHub publication available, vision model) plus the real embedded surface runtime (createAgentHarnessToolSurfaceRuntimeCore(...).compactTools), default unsandboxed session, no plugins, isolated temp state dir. Sizes are JSON characters of { name, description, parameters } of the provider-visible tools; tokens are chars / 4. Same script and environment on both revisions; sizes were identical across 5 samples per arm.

origin/main 328a438 this PR
Tool Search tools mode, always-sent tool chars 27,411 (~6,853 tok) 14,236 (~3,559 tok)
Code Mode, always-sent tool chars 20,084 (~5,021 tok) 6,909 (~1,727 tok)
github_publish definition chars 7,161 1,821
github_publish description, unsandboxed / no publication / observation-only 6,129 / 2,775 / 500 793 / 572 / 252
computer definition chars 6,014 (always sent) 6,014 (sent only after first use)
Catalog compaction per call, both modes (3 alternating rounds × 500 iterations, 20 warmup) 0.175–0.207 ms 0.231–0.262 ms

The compaction step costs about 0.05 ms more per attempt because the catalog now holds two more large schemas. It runs once per attempt preparation; it is not whole-turn latency.

Prompt cache: the provider tool list changes once, on the request right after the lookup (same turn), by appending the definition after the existing tools; the session pin carries the same order into later turns, so the list then stays byte-identical for the rest of the series. Anthropic defer_loading tool references were not used: OpenClaw's Anthropic transport has no support for them, and adding it is a provider-transport feature beyond this change.

Measurement commands and environment

Linux x64, Node v24.22.1, one host, no Gateway, OPENCLAW_STATE_DIR forced to a fresh temp directory by the script.

# baseline: a detached worktree of origin/main with dependencies installed
node --import ./scripts/tsx.mjs scripts/perf/on-demand-tool-surface-measure.ts --root /path/to/base-checkout --samples 5 --iterations 500
# this PR
node --import ./scripts/tsx.mjs scripts/perf/on-demand-tool-surface-measure.ts --root . --samples 5 --iterations 500

Verification

Regression tests (each fails on origin/main behavior; checked by reverting both tools to direct-only and by disabling the restore step):

  • src/agents/tool-search.on-demand.test.ts: in tools, directory and Code Mode, a default run's direct surface excludes computer and github_publish and the catalog holds both; a promoted tool is direct and out of the catalog; a runner without the opt-in and a headless catalog keep them direct; tool_search shows the call hint; dispatch_action and Code Mode guest calls refuse; the tools and directory prompt directories mark on-demand rows [call directly] and exempt them from the dispatch_action rule, and the Code Mode index marks them [top-level call only; not from exec].

  • attempt-deferred-tool-resolver.test.ts: through the real agent loop, in Tool Search tools mode and Code Mode, a direct call by name loads the deferred tool, the screenshot image block survives in the tool result, and promotion is recorded.

  • attempt-session-runtime-prepare.on-demand.test.ts (shares its SQLite session fixture with the existing history-boundary test through attempt-session-runtime-prepare.test-support.ts): real SQLite-backed session manager plus real tool construction, catalog and attempt preparation, both Tool Search and Code Mode. Turn 1 does not send github_publish; after its first direct call it is sent on the next turn and after another restart, and compaction (Tool Search case) or /reset (Code Mode case) defers it again. The transport receives its name as a deferred tool, and 11 consecutive calls to it before its definition is sent pass the stream's unknown-tool guard (threshold 10) instead of being rewritten into a refusal on the 11th.

  • github-publish-tool.handoff.test.ts: the prepare_pr / workspacePath turn handoff runs through the promoted direct tool in Code Mode.

  • github-publish-tool.test.ts: description length bounds, and the old description's key guidance (requestId retention and no resubmission, read before edit, re-review wording, landing rules) arrives in the matching action results, with text and details carrying the same next and the Gateway payload's fields intact.

  • code-mode.github-publish.test.ts: the real github_publish tool (managed-worktree sandbox) called from Code Mode guest code returns the receipt with its requestId and the publish next guidance in the guest value.

  • src/gateway/github-pr-workspace-preparation.test-support.ts: the prepare_pr result still matches the Gateway result schema once next is set aside.

  • tool-search.on-demand.test.ts (load on lookup): tool_describe and a refused dispatch_action call the runner's loader and the refusal names the direct call; tool_search alone does not load.

  • agent-session-loop-next-turn.test.ts: through a real session, a tool loaded during the first tool batch is sent with the next request. It fails on the old next-turn step and on an agent loop without the loadTool hook.

Test-line budget: +449 net test lines against the 400 allowance, with a 49-line record in config/test-lines-allocations/204805-on-demand-tool-loading.txt. Before the allocation the suite was consolidated: table-driven Tool Search / directory / Code Mode / no-opt-in cases, one SQLite session fixture shared with the existing history-boundary test, one table of github_publish result guidance, reset coverage folded into the SQLite restart test instead of a separate prompt-state case, and a dropped session-tool-listing case that duplicated it. The remaining 27 lines are the three review regressions (11-call stream guard, real-tool Code Mode guidance, prompt-directory marker); cutting them would remove coverage for those fixes. pnpm check:baseline-ratchets passes.

Broader runs: 168 affected test files (Tool Search, Code Mode, prompt state, attempt preparation and streaming, system prompt, computer, github_publish and PR workspace preparation, registration, Copilot tool bridge, Codex dynamic tools, worker computer surfaces): 167 files passed. The one failing file, src/agents/system-prompt-params.test.ts, fails three repository-discovery cases only because this host's test temp directory sits inside an unrelated git checkout, so "no repository" discovery finds that checkout; this PR does not touch that code. pnpm check:changed passed with the dead-export scan skipped; that scan fails identically on origin/main on unused exports in extensions/beam, which this PR does not touch.

Review: $autoreview (Codex, branch mode against origin/main, P0–P1): scoped-clean, no findings, on the first version. The load-on-lookup follow-up (fix: load on-demand tools when the model looks them up) was self-reviewed; pnpm check:changed passed on it (dead-export scan skipped for the same unrelated extensions/beam failure), and the 48 affected test files (808 tests) pass.

Real behavior proof

Live run on a real Gateway (this PR applied to current main, Tool Search tools mode, Opus 5.5 on the direct Anthropic API route, fresh session): asked to inspect this PR read-only with the GitHub tool, the model called tool_describe for github_publish, received the short description with call: "loads as a top-level tool once looked up; ...", then called github_publish directly in the next request of the same run ({action: "inspect_pr", pullRequestUrl: ...}). The Gateway returned the PR's state, author, base and head (head commit matched this branch) plus next: "This read binds nothing and grants no later authority.", and the model answered correctly. Nothing was written to GitHub.

Two earlier live runs found the two gaps this PR now closes: the first version loaded the tool only on a call by name, which models do not make for an undeclared tool (the model ran tool_describe, tried dispatch_action, was refused, and gave up); the second loaded it on lookup, but the embedded runner's continuation resent the session's tool list and dropped it until the next turn. fix: load on-demand tools when the model looks them up and fix: keep a looked-up tool for the rest of the run fix those, each with a regression test that fails on the previous code.

Upgrade: the same Gateway was updated in place from v2026.11.9 (and from earlier revisions of this PR) to current main with this PR. Existing sessions kept working after the restart; sessions pinned before the change keep both tools direct until their next reset, so their provider tool list does not change on upgrade.

The closest feasible path without a live Gateway or model: the real attempt preparation with a real SQLite session transcript (attempt-session-runtime-prepare.on-demand.test.ts), and the real agent loop with the real deferred-tool resolver (attempt-deferred-tool-resolver.test.ts), shown above. Sizes come from the real tool factories and the real surface runtime.

What was not tested

  • Live, first version: with Opus 5.5 on the API route in Tool Search tools mode, the model ran tool_describe for github_publish, would not call the undeclared tool by name, tried dispatch_action, was refused, and gave up. That is the gap the load-on-lookup follow-up closes. A live retest of the final version passed (see Real behavior proof).
  • No measured provider cache hit/miss; the one-change claim comes from the asserted pinned tool order across turns and restarts, not from provider usage numbers.
  • No isolated Gateway end-to-end run through a chat channel.
  • Promotion recorded during a turn that crashes before its checkpoint is written is lost; the model loads the tool again on its next use (accepted, visible and recoverable).

@clawsweeper

clawsweeper Bot commented Nov 24, 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 gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling extensions: codex extensions: copilot size: XL labels Nov 24, 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR loads desktop and GitHub tools on first use, preserves them in the session tool pin, and moves GitHub procedures into action results.

Example: A new unsandboxed vision chat uses Tool Search but has not requested desktop or GitHub work.

  • Before: Every request includes the computer and github_publish definitions.
  • After: Both start in the catalog; their first direct call executes normally and promotes their definition for later turns.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The revised implementation is coherent and resolves the prior findings, but required real-behavior and upgrade proof remain outstanding.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Chats repeatedly send large desktop and GitHub definitions before either capability is needed, increasing model context overhead.
Reason: The reported definition reduction is concrete, the maintainer-authored PR establishes direction, and the change preserves image delivery and yielding calls.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored optimization remains useful, and the revised head addresses all four prior findings without a remaining discrete code defect.

Reviewed head: 34de9f914ac71bb459ad1a819b4e184b9cd2e75d

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted Gateway/model output showing catalog discovery, first direct desktop and GitHub calls, screenshot delivery and prepare handoff, later-turn/restart promotion, and an upgrade from v2026.11.9 preserving existing checkpointed listings and session data.
Agent review details

How this fits together

The agent tool surface converts available tools into provider declarations and discoverable catalog entries; the embedded resolver executes deferred direct calls, while transcript checkpoints preserve the session's tool definitions.

flowchart TD
  A[Chat request] --> B[Tool surface catalog]
  B --> C[Model discovery]
  C --> D[Deferred direct resolver]
  D --> E[Desktop or GitHub execution]
  D --> F[Session tool checkpoint]
  F --> G[Later provider requests]
Loading

Technical review

Best possible solution:

Retain the existing resolver and checkpoint ownership, preserve direct execution contracts, and complete live first-use and existing-session upgrade validation.

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

Current-main source confirms both tools retain direct-only placement and therefore bypass catalog deferral; the supplied measurement exercises real construction and compaction, but no product run was performed during this read-only review.

Is this the best way to solve the issue?

The implementation preserves the reasons for direct execution while using the existing deferred resolver and session pin, and the guidance extraction removes substantial repeated prompt text without changing Gateway authorization.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Desktop direct execution keeps the original intent (4617728: Screenshot image blocks must reach the model intact so desktop actions retain their frame-bound contract.)
  • GitHub preparation handoff keeps the original intent (c1658c0: Preparing an unbound workspace yields the turn, which cannot finish correctly inside Code Mode exec.)
  • Session tool definition pin changes intended behavior with a stated reason (1f7b2f1: Transcript-backed tool definitions preserve provider prompt-cache identity across turns and restarts.)
  • GitHub procedural guidance changes intended behavior with a stated reason (be9444e: Observed agent mistakes required clear publication outcomes, landing limits, and next actions; the PR relocates those instructions to relevant results.)
  • Code Mode result projection keeps the original intent (f7df40b: Guest values must preserve useful model-facing explanations while raw details remain available for contract validation.)
  • Native harness direct placement keeps the original intent (e0791c6: Codex retains a distinct direct namespace; this PR routes the new placement value through that existing path.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +267, Tests +424, Docs +32, Other +140. Total +863 across 37 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 24 367 100 +267
Tests 8 473 49 +424
Docs 3 34 2 +32
Config 0 0 0 0
Generated 0 0 0 0
Other 2 140 0 +140
Total 37 1014 151 +863

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • remove status: ⏳ waiting on author: Current PR status no longer selects a status label.

Label justifications:

  • merge-risk: 🚨 compatibility: The tool metadata contract gains on-demand placement; the maintainer-authored direction includes explicit direct-placement handling for Codex, Copilot, workers, and runners without the opt-in.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

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 (1 earlier review cycle)
  • reviewed 2026-11-24T17:44:34.432Z sha 71f2af4 :: blocked before merge. :: [P2] Include on-demand names in the live stream tool set | [P2] Preserve GitHub guidance in Code Mode result values | [P2] Teach the prompt directory the on-demand call exception | [P2] Resolve the added tests' failing line-budget check

Reviewed November 24, 2026, 9:30 PM ET / November 25, 2026, 02:30 UTC (Revision 2).

@THE-NAVVV THE-NAVVV left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

​

@VACInc

VACInc commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. label Nov 25, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 25, 2026
@VACInc
VACInc force-pushed the fix/lazy-direct-tools branch from 257d203 to 00b539e Compare November 25, 2026 17:28
VACInc and others added 10 commits November 25, 2026 14:16
With Tool Search or Code Mode active, both tools were marked direct-only and
sent on every request whether or not the session ever used them (about 13k
characters per request together). Add an on-demand catalog mode: the tool
starts deferred with a short catalog entry, loads on its first direct call by
name in the embedded runner, and the session tool pin then keeps it direct
for the rest of the prompt series, across restarts. Catalog bridges refuse it,
so screenshots and the prepare handoff still run only through a direct call.
Harnesses that cannot load a tool on use keep it direct.

Replace the github_publish manual with a short summary plus one line per
action, and return each procedure in the result where it applies.
- Add uniquely named on-demand catalog entries to the live stream tool set,
  so the unknown-tool guard no longer refuses repeated computer calls before
  the definition is sent.
- Put github_publish result guidance in details as well as text: Code Mode
  returns only details to the model.
- Mark on-demand rows in the deferred-tool directory and exempt them from the
  dispatch_action guidance in tools and directory modes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
prepare_pr details now carry next for Code Mode, so the workspace fixture validates the Gateway schema on the payload without it.
…ance into Code Mode values

Tool result details stay equal to the Gateway protocol payload, which the gateway schema checks require. Code Mode's value projection now copies a string `next` from the result text, so github_publish guidance still reaches exec guest code.
Models do not call a tool that is missing from their tool list, so loading
computer and github_publish only on a first call by name never happened.
tool_describe and a refused dispatch_action now load the tool: the agent loop
sends its definition with the next request in the same run, and the session pin
keeps it on later turns. The session's next-turn step keeps tools a run loaded
for itself, which also keeps a resolved deferred tool for the rest of the run.
A tool execution context that outlives its call must not keep the run's history
or agent alive. Clear loadTool alongside pendingInput when updates close.
The embedded runner's continuation resends the session's tool list after
each tool batch, which dropped an on-demand tool loaded mid-run, so the
model could not call it until the next turn. The agent loop now keeps tools
a run loaded for itself whenever a continuation or next-turn snapshot
replaces the tool list. Resolved deferred tools keep their previous
behavior.
@VACInc
VACInc force-pushed the fix/lazy-direct-tools branch from 3942f40 to 0a82b8c Compare November 25, 2026 19:18
@VACInc
VACInc merged commit 2323e7a into openclaw:main Nov 25, 2026
158 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
…hem (openclaw#204805)

Computer use and github_publish were sent with every request whenever Tool Search or Code Mode was on (about 13k characters per request), even in chats that never use them.

- New catalogMode "on-demand": both tools start in the Tool Search / Code Mode catalog. Looking one up (tool_describe, or a refused dispatch_action) loads it for the rest of the run, and the session tool pin keeps it on later turns. /new, /reset, compaction and a model change defer it again.
- The agent loop keeps tools a run loaded for itself when a continuation resends the session's tool list.
- github_publish's description drops from about 6.1k to under 800 characters; each action's result carries the guidance it used to hold, in a `next` field.
- Copilot, Codex, cloud workers and headless catalogs keep both tools direct.
tideclaw-bot pushed a commit that referenced this pull request Nov 28, 2026
…ir own exemption (#206801)

With Tool Search on (the default), `agents_wait` and `subagents` are deferred, so the model can reach them only through `dispatch_action`. The tool repeat guard reads the `repeatable` declaration of the called tool, which is `dispatch_action`, not its target. A model that polls its children with the same `agents_wait` call gets a "stop repeating" note at call 3. At call 20 the turn ends with `tool_repeat_limit`, even though these tools exist to be polled.

`isDirectVisibleCatalogTool` (the Tool Search owner of "which trusted tools stay in the provider tool list") now keeps OpenClaw tools that declare `repeatable` visible, unless they are on-demand. The model calls them by name, and the guard reads their own declaration. They stay searchable as before.

- The guard, `dispatch_action` and the worker wire are unchanged. A dispatcher-side fix would need either a new `repeatable` shape in the worker tool protocol schema or a function that cannot cross the worker wire, so the visibility owner takes this.
- Code Mode is unchanged. Its catalog also requires the tool in `directToolNames`, so guest scripts keep calling `agents_wait` as before.
- On-demand tools (`computer`, `github_publish`) stay deferred.
- Cost: `agents_wait` (638 B) and `subagents` (638 B) of tool schema join the tool list when those tools are enabled. That is +1,276 B, stable across turns.

| Check | Tier | Base (`55f3ed64`) | Head |
|---|---|---|---|
| Tool Search `tools` and `directory` modes send `agents_wait` and `subagents`, and keep a plain tool deferred (`tool-search.repeatable.test.ts`) | vitest-source | **fails**: both deferred | passes |
| 25 identical `agents_wait` polls through the real agent loop and guard | vitest-source | **fails**: the tool is not in the list; the only route is `dispatch_action` | passes: 25 run, no note, the turn ends normally |
| Main's only route measured: 25 identical `agents_wait` calls through `dispatch_action` | vitest-source | note at call 3, 19 run, turn ends with `tool_repeat_limit` at call 20 | not the route any more |
| A non-repeatable target repeated through `dispatch_action` still stops at call 20 with `tool_repeat_limit` | vitest-source | passes | passes |
| Prompt-prefix stability, Tool Search on-demand/agent-loop/discovery/directory/catalog suites, system-prompt inventory and cache-prefix suites | vitest-source | | 13 files, 124 tests pass |

A model that still routes a polling tool through `dispatch_action` is counted as `dispatch_action` calls. The tool is now in its tool list, so the dispatcher is not its route.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit afd8195)

Release adaptation: Use an existing trusted OpenClaw catalog predicate to keep repeatable tools model-visible. Stable does not have on-demand catalog tooling, so omit that exclusion and retain the stable directory wording. Keep Code Mode, dispatch_action and the repeat guard unchanged.

Follow-ups: No later pinned-main production changes touch this owner; #204805 is an upstream-only prerequisite for the omitted exclusion, not required by the stable predicate.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
Co-authored-by: sallyom <[email protected]>
(cherry picked from commit 3f00a51)

Companion audit: #204847 participant-limit propagation, #205572 worker exec settings, #204805 deferred tools, #206762 tool-description perf, and #206537 prompt manifest redesign touch neighboring owners but are not prerequisites for stable worker spawn guidance.

Release adaptation: Render the dedicated-worker hint only for worker placement; preserve stable local workflow text and keep both render sites on one delegation section binding, and let the worker hint suppress the duplicate full-surface messaging hint.

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex extensions: copilot gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants