Skip to content

fix: every agent attempt re-hashes unchanged tool descriptions because the report digest cache can never hit - #129145

Merged
steipete merged 5 commits into
openclaw:mainfrom
quangtran88:fix/tool-report-entry-cache-content-key
Aug 31, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
quangtran88:fix/tool-report-entry-cache-content-key

Conversation

@quangtran88

@quangtran88 quangtran88 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Rebuilt tool definitions miss the report's object-keyed cache, so unchanged descriptions are hashed again during prompt preparation. A retained tool can also keep stale summary metadata after Code Mode updates its description.

Cache only the SHA-256 of normalized summary content, bounded to 512 keys of at most 4,096 UTF-16 units. Remove the whole-entry object cache and keep schema statistics with their existing parameter-identity owner. Unchanged reports stay identical; updated descriptions and replaced parameter objects produce current metadata. No persistent store, configuration, or schema changes. Fixes #129116.

Evidence

Before editing, a Node 24.20.0 runtime probe called the actual tool finalizer, reporter, and Code Mode updater on trusted main. Normal hook and abort wrappers rebuilt tool objects while retaining schema objects. Reports stayed byte-equivalent, but SHA-256 calls were 8 on the first report and 5 on the next instead of 2; a retained wrapper also returned the old description hash. A separately authored equivalent repair changed that sequence to 8→2 and returned the current hash. The tested reporter bytes match the published candidate. This synthetic runtime-owner probe did not use a live Gateway session.

The same-host observations for 1,000 actual finalizations and reports were 0.042743 / 0.011746 seconds before/after. Full cold-process times were 33.128 / 124.215 seconds and RSS was 599,556,096 / 482,590,720 bytes. Imports and concurrent host activity dominate the cold runs, so these observations are not a throughput claim.

The authored regression suite failed on unchanged production with three expected failures and one passing oversized-key control. Its local positive run reached the canonical 900-second no-output watchdog before assertions; a process sample showed a filesystem rename wait, and the automatic retry was stopped. Hosted CI closes that gap: exact published head 7fa21e19f17901f671710594cda5ced6b47570d7 passed all four new cases in reporter job 99424422578, with 1,479 passing tests in the full shard. Coverage uses real finalization, the real Code Mode updater, independent schema replacement, and oversized-key bypass. Contributor source was not executed locally; all trusted proof overlays were restored.

CI also exposed a shared test-fixture loader regression before the cancellation supervisor could start: plain Node could not resolve the canonical PID helper's transitive source .js import. Main now contains the equivalent tsx/esm/api import repair for the cancellation-only supervisor/fake-Git branch. The ordinary main merge keeps that fixture verbatim, resolving only a parallel two-line comment edit and removing the fixture from this PR's final diff. Existing real-fixture tests reproduce the loader failure before and pass cancellation, early-exit, sentinel, and identity controls afterward. No production imports, process-identity checks, timeouts, retries, or dependencies change.

That fixture code passed the previously published candidate's Linux CI. Small-43 passed all 159 tests, including base-policy and workflow-sanity cancellation during timeout drainage. Small-45 passed 1,484 tests, including the early-owner-exit case. Small-46 passed 2,151 tests, including prepare and publish TERM-resistant cleanup cancellation in 21.7 and 21.4 seconds. These Linux results close the earlier Mac deadline gap without changing timeouts. Workflow 33371721400 completed successfully; the exact-head rollup has 220 successful checks, 44 skipped, one neutral, and no pending or failed checks.

The latest ClawSweeper request for an after-fix producer trace is addressed by the actual finalizer/report sequence above; a refresh has been requested on the final head in comment 5476852549. Its persisted-cache/schema warning does not apply to this process-local Map. Codex's separate dynamic-tool report owner is unchanged. Production +21/-8 (net +13), regression tests +112/-0, test support +0/-0 after retaining main's fixture. Production growth bounds pure-function reuse while removing the stale whole-entry cache. The complete two-file candidate passed fresh P0 review after main integration; reporter and regression bytes are unchanged from green head 7fa21e19. Trusted formatting and configured private staged scanning also passed. Final published-head native review, guard, artifact validation, and CI have completed successfully. Thanks @quangtran88 for the original fix.

The final ordinary main merge is 68bd798bb2305075ce6b9ff3cd58c3d0debc04b7. Contributor ancestry is preserved, the only conflict keeps main's fixture comments, and the two cache files exactly match the previously tested repair.

Final CI 33377097618 passed on this exact head after one failed-jobs-only rerun. The reporter job passed all four regression cases and 1,479 tests. The rerun job 99450543374 passed 7,585 tests across 646 files; the final rollup has 219 successful checks, 46 skipped, one neutral, and no pending or failed checks.

Named follow-up: the first attempt timed out in an unchanged global-session worker error-payload test at 123.414 seconds; the same case passed the retry in 107.537 seconds, while its main-agent control took 22 ms. Exact CI merge-source comparison and separate job routing found no candidate causal path. Its slow phase remains undiagnosed; this is not a root-cause repair claim. No timeout, assertion, environment or source changes were made for the retry.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@quangtran88
quangtran88 marked this pull request as ready for review August 25, 2026 08:04
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 5:31 AM ET / 09:31 UTC.

ClawSweeper review

What this changes

The PR adds a bounded content-keyed cache for tool-description hashes and regression tests for tool objects rebuilt between prompt-report builds.

Merge readiness

⛔ Blocked until real behavior proof is added - 3 items remain

Keep open. Current main still re-hashes summaries after the object-keyed entry-cache miss, while this branch adds a bounded cache keyed by the exact summary text; the prior retained-bytes concern is resolved. The remaining merge blocker is the contributor’s acknowledged lack of after-fix real runtime proof.

Priority: P2
Reviewed head: d3d8fe50e781c8ac7071bcd1c96604bb678d59d3

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused implementation and regression coverage are sound, but real behavior proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: No after-fix real agent or Gateway trace is attached; add a redacted trace showing rebuilt tools avoid repeat summary digests, then update the PR body for automatic re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: No after-fix real agent or Gateway trace is attached; add a redacted trace showing rebuilt tools avoid repeat summary digests, then update the PR body for automatic re-review.
Evidence reviewed 6 items Current main still has the cache miss: Current main keys full report entries by tool object and hashes the summary after a miss; it has no content-keyed summary cache.
Producer churn makes object identity unsuitable: Tool finalization maps through schema normalization and optional hook, abort, and description wrappers; normalization copies the tool object, so rebuilt attempts ordinarily present distinct identities to the report.
Patch preserves report output while bounding retention: The branch retains the whole-entry WeakMap, caches only the already-trimmed summary digest, limits entries to 512, and bypasses caching for summaries over 4,096 characters.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 98.79 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.7s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4196ms (slowest: built plugin control-plane loads 3474ms)

OpenClaw 2026.8.1 (d3d8fe5) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile ‹name›     Use a named profile (isol
… output truncated …

Assertions:

  • PASS expect_output: Usage: openclaw

How this fits together

Before each agent attempt, OpenClaw finalizes authorized tools and builds a system-prompt report for session metadata. That report hashes tool summaries and then feeds prompt accounting used alongside the model attempt.

flowchart LR
  A[Authorized tools] --> B[Tool finalization]
  B --> C[System prompt report]
  C --> D[Summary digest cache]
  D --> E[Session prompt metadata]
  E --> F[Model attempt]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: No after-fix real agent or Gateway trace is attached; add a redacted trace showing rebuilt tools avoid repeat summary digests, then update the PR body for automatic re-review.
  • Resolve merge risk (P1) - No redacted after-fix agent or Gateway trace yet proves that the real rebuilt-tool path avoids repeated summary hashes; mocked hash-call coverage is supplemental.
  • Complete next step (P2) - The patch needs contributor-supplied real behavior proof before merge; ClawSweeper cannot manufacture that proof from the contributor’s runtime setup.
Agent review details

Security

None.

PR surface

Source +26, Tests +104. Total +130 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 27 1 +26
Tests 1 104 0 +104
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 131 1 +130

Review metrics

Metric Value Why it matters
Production versus test delta production +26 net; tests +104 The added production code is the bounded cache and its retention guard; the test growth covers cache reuse and oversized-description bypass.

Stored data model

Persistent data-model change detected: persistent cache schema: src/agents/system-prompt-report.tool-digest-cache.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #129116
Summary: This PR explicitly implements the source-proven report-cache defect tracked by the canonical issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the bounded content-keyed digest cache only after a real after-fix trace confirms report output is unchanged and rebuilt tools avoid repeated summary hashing.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the bounded content-keyed digest cache only after a real after-fix trace confirms report output is unchanged and rebuilt tools avoid repeated summary hashing.

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

Yes, from source: finalization creates fresh tool identities while current-main report generation keys its entry cache on those identities and re-hashes summaries after each miss; the review did not execute a live agent attempt.

Is this the best way to solve the issue?

Yes. Caching only the pure hash of the already-trimmed summary fixes the broken reuse boundary without conflating schema metadata or retaining full tool wrappers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7da8c19fd021.

Labels

Label changes:

  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This repairs recurring pre-model prompt-preparation work without evidence of an outage, data-loss, or security impact.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No after-fix real agent or Gateway trace is attached; add a redacted trace showing rebuilt tools avoid repeat summary digests, then update the PR body for automatic re-review.

Evidence

What I checked:

  • Current main still has the cache miss: Current main keys full report entries by tool object and hashes the summary after a miss; it has no content-keyed summary cache. (src/agents/system-prompt-report.ts:16, 7da8c19fd021)
  • Producer churn makes object identity unsuitable: Tool finalization maps through schema normalization and optional hook, abort, and description wrappers; normalization copies the tool object, so rebuilt attempts ordinarily present distinct identities to the report. (src/agents/agent-tools.finalize.ts:28, 7da8c19fd021)
  • Patch preserves report output while bounding retention: The branch retains the whole-entry WeakMap, caches only the already-trimmed summary digest, limits entries to 512, and bypasses caching for summaries over 4,096 characters. (src/agents/system-prompt-report.ts:97, d3d8fe50e781)
  • Regression coverage protects both invariants: The added test uses rebuilt tools with shared parameter identities, verifies only prompt hashes remain on the second report build, and verifies oversized summaries are re-hashed rather than retained. (src/agents/system-prompt-report.tool-digest-cache.test.ts:55, d3d8fe50e781)
  • Current-line provenance: The current-main report cache and hash lines trace to Peter Steinberger in available blame history; the shallow checkout cannot establish the original introducing commit. (src/agents/system-prompt-report.ts:16, 36560c6a64c6)
  • Codex dependency gate is not applicable: The patch imports Node crypto and the in-repository map-size helper only; its runtime path is prompt-report accounting, not a Codex protocol, harness, or runtime contract. (src/agents/system-prompt-report.ts:6, d3d8fe50e781)

Likely related people:

  • Peter Steinberger: Current-main blame attributes the report-cache implementation to this author, and available history shows repeated work in the report and agent-tool area. (role: recent area contributor; confidence: high; commits: 36560c6a64c6; files: src/agents/system-prompt-report.ts, src/agents/agent-tools.finalize.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach a redacted after-fix isolated-agent or Gateway trace showing rebuilt tools reuse summary hashes without changing the stored report.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-25T08:12:04.702Z sha ce2e19caf8685f309a780344b763cc7424d88b7f :: needs real behavior proof before merge. :: [P2] Bound the cached description bytes
  • reviewed 2026-08-25T08:53:18.847Z sha ce2e19caf8685f309a780344b763cc7424d88b7f :: needs real behavior proof before merge. :: [P2] Bound the cached description bytes
  • reviewed 2026-08-25T09:05:50.366Z sha 8f62f2f74936a45aa61a77c1934f72cd14c68357 :: needs real behavior proof before merge. :: [P2] Bound retained tool-description bytes

@quangtran88
quangtran88 force-pushed the fix/tool-report-entry-cache-content-key branch from ce2e19c to 8f62f2f Compare August 25, 2026 08:59
…of tool identity

toolReportEntryCache is a WeakMap keyed on the AgentTool object, but
finalizeAgentTools rebuilds every tool on every attempt (normalizeToolParameters
returns a {...tool} copy, then three more wrapper .map passes), so the cache
misses 100% of the time and buildSystemPromptReport re-runs one sha256 per tool
per attempt over an unchanged description.

Add a bounded content-keyed layer for the summary digest, keyed on the exact
string hashed, so it survives the tool-object churn. Byte-identical by
construction. Schema stats deliberately stay on toolSchemaStatsCache so a tool
reusing a name and description with different parameters still reports its own
schemaHash.
The 512-entry limit bounded cardinality only. Keys are the summary text, so a
sequence of large runtime-generated descriptions could pin megabytes for the
process lifetime. Summaries over the length cap still hash, they just never
enter the cache.
@quangtran88
quangtran88 force-pushed the fix/tool-report-entry-cache-content-key branch from 8f62f2f to d3d8fe5 Compare August 26, 2026 09:24
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Aug 26, 2026
@steipete steipete self-assigned this Aug 31, 2026
Remove the stale whole-tool report cache. Reuse only pure summary hashes across rebuilt tool wrappers while keeping schema statistics with the parameter object owner. Bound both retained key size and entry count; cover real finalization, Code Mode updates, schema replacement, and oversized summaries.

Co-authored-by: Tran Quang <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

Replaced the whole-tool object cache with bounded summary-content hashing and retained the existing schema-statistics owner. The actual Node 24 tool finalizer/reporter/Code Mode trace reproduces stale metadata and repeated hashing before the repair, then current metadata and 8-to-2 hash reuse afterward. The body records the local regression watchdog limitation; fresh exact-head hosted execution remains required before landing.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Keep plain-Node fixture actors lightweight while resolving the canonical identity helper and its transitive TypeScript imports for cleanup cancellation. Preserve real process ownership and existing deadlines.
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

The final candidate is now 7fa21e19f17901f671710594cda5ced6b47570d7. Actual finalized-tool/report and Code Mode update traces address the after-fix producer-proof request; all four cache regressions passed on the prior identical owner. This head also repairs the shared plain-Node cancellation fixture's TypeScript loader failure, with existing real process-tree tests showing red before and green after. Production cache state remains process-local; there is no persistent-store/schema change. Full final-candidate independent P0 review is clean. The body records exact evidence and the remaining final-head Linux CI gate.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Keep main's equivalent cancellation-fixture loader verbatim, resolving the parallel explanatory comment while preserving contributor ancestry. The tested reporter and regression bytes remain unchanged.

Co-authored-by: Tran Quang <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

The latest durable review is from August 26 and earlier refreshes failed source verification. Current head 68bd798bb2305075ce6b9ff3cd58c3d0debc04b7 is now fully reviewed with green exact-head CI. The body includes actual tool-finalizer/reporter/Code Mode before-and-after runtime evidence, unchanged report/schema-owner controls, bounded retention, and the removed stale whole-entry cache. It also records the one unrelated slow-test rerun and its unresolved timing limit. Please refresh the current two-file repair and proof.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit 9ec0cbe into openclaw:main Aug 31, 2026
485 of 487 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
…e the report digest cache can never hit (openclaw#129145)

* fix(agents): key the per-tool report digest cache on content instead of tool identity

toolReportEntryCache is a WeakMap keyed on the AgentTool object, but
finalizeAgentTools rebuilds every tool on every attempt (normalizeToolParameters
returns a {...tool} copy, then three more wrapper .map passes), so the cache
misses 100% of the time and buildSystemPromptReport re-runs one sha256 per tool
per attempt over an unchanged description.

Add a bounded content-keyed layer for the summary digest, keyed on the exact
string hashed, so it survives the tool-object churn. Byte-identical by
construction. Schema stats deliberately stay on toolSchemaStatsCache so a tool
reusing a name and description with different parameters still reports its own
schemaHash.

* fix: bound the bytes retained by the tool summary digest cache

The 512-entry limit bounded cardinality only. Keys are the summary text, so a
sequence of large runtime-generated descriptions could pin megabytes for the
process lifetime. Summaries over the length cap still hash, they just never
enter the cache.

* test(ci): load cancellation identity helpers through tsx

Keep plain-Node fixture actors lightweight while resolving the canonical identity helper and its transitive TypeScript imports for cleanup cancellation. Preserve real process ownership and existing deadlines.

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Tran Quang <[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 P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: per-tool report digest cache can never hit — its key is an object rebuilt on every attempt

2 participants