Skip to content

perf(agents): reuse dynamic tool schemas across attempts - #170673

Merged
steipete merged 4 commits into
mainfrom
dbasync/toolstall2
Oct 13, 2026
Merged

steipete merged 4 commits into
mainfrom
dbasync/toolstall2

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Repeated agent attempts still rebuild dynamic tool schemas and republish stable output schemas when another tool in the catalog changes. This follows up on #170610.

User Impact

Agent attempts reuse immutable tool descriptors across equivalent capability and policy inputs. Tool execution, cancellation, hooks, and authority remain fresh per attempt. No configuration, storage migration, or operator action is required.

Why This Change Was Made

Computer actions/target scope, spawn availability, automation policy, and message capabilities now select bounded factory-owned schema variants. Goal and installed-skill schemas are static constants. Channel-owned schema properties are cloned before publication, and nested published descriptors remain immutable. Collector wrappers reuse schema variants without sharing their execution authority. Finalization retains each unchanged prepared descriptor—including the original output-schema source—even when another catalog member changes.

Removed repeated work and accepted edges:

  • Equivalent resolved factory inputs no longer rebuild schemas. A cache eviction only causes a cold rebuild; unrelated config revisions do not invalidate unchanged schema inputs. Finalization still keys provider/model/config/plugin changes.
  • Stable siblings no longer republish or prewarm descriptors after an unrelated catalog change. Late settlement retains the existing accepted cold-miss behavior.
  • Computer capability refresh selects an immutable factory variant for the current tool. Later attempts resolve their own capabilities; execution authority is never cached.
  • Published custom descriptor snapshots stay detached from later nested source edits; producers must replace the schema root to advertise a changed descriptor.
  • No security checks were removed. Collector availability, cancellation, hooks, and tool execution authority still belong to the current attempt.

Evidence

Focused regressions cover factory hit/miss/invalidation, channel-owned mutation, nested snapshot mutation, mixed-catalog output reuse, capability refresh, and collector revocation with shared schemas. PR CI is the broad test and static proof; local checks are changed-file formatting/lint and diff sanity.

Measure Base Candidate
T1 SQLite calls in touched owners 0 0
Tool/schema/catalog CPU samples (ten warmed turns) 718 386 (−46.2%)
Timer windows ≥8 ms (ten warmed turns) 623 320 (−48.6%)
Warmed SQL statements / requests / MAIN Not measured Not measured

Exactly one final baseline/candidate profile pair completed through the local CPU gate, with ten warmed turns on each revision. Both fixtures completed all turns, RPCs, and shutdown checks with no surviving fixture children. These are raw sample/window observations on a loaded host, not a controlled latency comparison. SQL detail tracing is disabled for this descriptor-only lane. No SQL reduction or local latency claim is made. Earlier GC stacks end at the collector/root, so they cannot identify the allocating owner.

Codex autoreview: two scoped rounds, clean through P2. A hosted review raised a computer capability-refresh issue. A baseline runtime probe confirmed that normalization already clones the source schema before refresh, leaving finalized wrappers detached on the base revision. The proposed envelope correction was ineffective and was removed; live wrapper refresh remains a preexisting follow-up outside this descriptor reuse change. Changed-file formatting, type-aware core lint, and git diff --check pass. Final-head CI passed on 43aaad02f04b33e6b899ed8c3ccfec347b32a133: 46 successful jobs, 26 skipped; required CI/security gates are green. Successful jobs consumed 8906 job-seconds, including 2884 Node test job-seconds. Knip script exports passed with no findings. The initial production/full-tree scans timed out; their sequential retry completed before cancellation and reported unused exports in untouched memory, UI, and session-cache files. No finding names a changed file. Those findings are not claimed as proven inherited; no baseline rerun was performed. Landing follows the explicit instruction to merge on green required CI without waiting for more proof. No proof-slot wait remains. The focused message-schema rerun passed all six tests (7.26 s Vitest, 27.07 s runner wall time). The initial CI test-type errors were corrected; no test reruns were needed on the final head.

LOC: production +163/-51, tests +269/-2, docs +2; total +434/-53 across 18 files. No SDK, update, Doctor, migration, plugin-loading, or service-lifecycle changes; those conditional proof cells do not apply.

@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T06:40:26.491552Z 43aaad0 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Oct 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 545c2c51c8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +129 to +132
tool.parameters = createComputerToolSchema(
availableActions(capabilities?.actions ?? COMPUTER_TOOL_ACTIONS),
targetScope,
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Propagate capability changes to the finalized computer tool

When a paired computer starts with the generic V1 schema and resolveTarget() later discovers V2 actions such as launch_app, this assignment updates only the source tool captured by createComputerTool. finalizeAgentTools normalizes and shallow-copies that tool into hook and Gateway wrappers, so the effective tool used on subsequent model turns retains the old parameters object; the previous in-place update propagated through the shared schema reference. Consequently, newly discovered actions remain unadvertised and can fail schema validation in the real finalized flow even though the direct-tool test passes. The replacement needs to reach the finalized projection or use an explicit invalidation/indirection mechanism.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

Remove the ineffective live-envelope correction. Baseline normalization already detaches finalized schemas, so live wrapper refresh remains a separate existing issue.
@steipete
steipete merged commit d414a80 into main Oct 13, 2026
139 checks passed
@steipete
steipete deleted the dbasync/toolstall2 branch October 13, 2026 16:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged as d414a80, pinned to reviewed head 43aaad0. Required CI and security gates were green; both Codex review rounds were complete.

Exactly one CPU-gated profile pair completed, with ten warmed turns per revision:

Observation Base Head Change
Tool/schema/catalog sample points 718 386 −332 (−46.2%)
Timer windows ≥8 ms 623 320 −303 (−48.6%)
GC sample points 461 207 −254
T1 SQLite calls in touched owners 0 0 0

Both fixtures completed all turns, RPCs, and shutdown checks with no surviving children. This was one pair on a loaded host, so it supports sample/window observations only, not a local latency claim. SQL statements, requests, and MAIN counts were not measured; this descriptor-only change makes no SQL reduction claim and does not require another post-merge SQL pair.

Knip script exports passed. The sequential production/full-tree retry finished before it could be cancelled and reported unused exports only in untouched memory, UI, and session-cache files. These are disclosed findings, not claimed as baseline-proven inherited failures. No additional proof wait or rerun was required under the instruction to land on green required CI. No proof-slot waiter remains.

Follow-ups: computer capability refresh on already-finalized wrappers is preexisting; GC profiles do not identify the allocating owner.

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

Cache bounded immutable dynamic schema variants by their resolved inputs and retain unchanged descriptor/output-schema snapshots across catalog changes. Keep executors, hooks, cancellation, and authority fresh per attempt. Add regressions for reuse, invalidation, nested mutation, and execution authority.
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 size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant