Repository navigation
fix(agents): keep tool result summaries when middleware details exceed shape limits - #147805
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 September 14, 2026, 11:57 AM ET / 15:57 UTC (Revision 3). ClawSweeper reviewWhat this changesPreserves tool-result summaries when optional details exceed existing complexity limits, replacing those details with a truncation marker and adding regression coverage. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main and v2026.9.4 retain the sanitizer gap. The focused fix has convincing before/after production-path evidence, and no actionable correctness findings remain. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's tool-result middleware processes completed tool output before it reaches the model and transcript. Its input sanitizer must preserve useful text while making optional details safe for registered plugin transforms. flowchart TD
A[Completed tool result] --> B{Middleware registered?}
B -->|No| F[Model and transcript]
B -->|Yes| C[Normalize optional details]
C --> D[Ordered plugin transforms]
D --> E{Output valid?}
E -->|Yes| F
E -->|No| G[Safe processing error]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -4, Tests +41. Total +37 across 2 files. View PR surface stats
Review metricsNone. 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 normalization in the shared input sanitizer, preserve summary text and report references, and retain strict validation of plugin-produced replacements. Do we have a high-confidence way to reproduce the issue? Yes. Current source establishes that details below the byte cap but above 1,000 recursive entries fail after pass-through middleware; supplied real-run evidence confirms the symptom. This review did not execute target code. Is this the best way to solve the issue? Yes. Completing the existing sanitizer's contract fixes the shared cause without adding a wiki-specific workaround, relaxing limits, or changing public APIs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c6b8270152bc. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Added the requested real-setup proof (no synthetic payloads, no injected handler). Evidence details are in the updated PR body; summary: What was missing: the earlier proof called What was added: a run of the real path, end to end:
After (fix commit Before (identical script, Not covered: a full live gateway session with a model-driven agent turn (no model credentials in this environment); the run executes from a source checkout with dev-source SDK aliasing (the same aliasing the repository's vitest config applies). CI is green on the current head. |
|
landpr-approve-admin-merge |
|
landpr-approve-unrelated-red |
|
Thanks @LiuwqGit! Proof: A Gateway turn ran
|
* commit '3c08384584f57787a26da9998488233fc15ccf7e': (122 commits) fix(agents): keep tool result summaries when middleware details exceed shape limits (#147805) test: make full-suite fixtures portable across runtimes (#148247) refactor(qa): share unknown confidence results (#148200) chore(android): remove unused test dependencies and duplicate Wear settings (#148231) test: reuse compiled preflight in startup fixtures (#148330) test(wizard): route recovery integration through database forks (#148337) refactor(plugins): simplify provider auth patch recursion (#147933) fix(cli): drain failed web capability output (#148234) refactor(android): remove unused production helpers (#148233) fix(plugins): scope feed integrity to hosted ClawHub (#148220) test(qa): compare Telegram entities semantically (#148219) test(qa): recognize native Slack exec progress rows (#148217) test(cron): distinguish repeated delivery incidents (#148151) test(qa): preserve restart command ownership (#148218) test(qa): isolate bundled skill CLI gateway state (#148150) test(qa): align process lifecycle contracts (#148149) improve(media): reduce metadata fetched during orphan cleanup (#148244) fix(matrix): retain sync state runtime for deferred persistence (#148152) test: deduplicate gateway watch exit fixtures (#148237) refactor(cli): derive daemon status contract from gatherer (#148108) ...
…d shape limits (openclaw#147805) > AI-assisted: yes Closes openclaw#147776 ## What Problem This Solves Fixes `wiki_lint` returning “Tool output unavailable due to post-processing error.” for larger vaults even though the supported CLI lint succeeds. ## User Impact Agents keep the lint summary and report path when optional details exceed existing limits. Smaller results retain their normalized details. No configuration or migration is required. ## Why This Change Was Made The shared incoming-details sanitizer now applies the existing shape check as well as the byte cap, with one truncation-marker return. Middleware replacements still undergo strict validation. Each result stays local to its ordered middleware chain. ## Evidence A real Gateway `chat.send` invoked the registered wiki tool and bundled middleware against isolated vaults. A local provider fixture captured the next request. - Main `20cf6971b89c`: 147 warnings become the post-processing error. - Updated `5b5e84742c21`: the request retains `Issues: 147 total (0 errors, 147 warnings)`; the persisted tool result has `{ truncated: true, originalSizeBytes: 26231 }` and no error. - The ten-page control retains the same full normalized details; CLI lint succeeds for both sizes. - 32 focused tests pass on a fresh merge with main `1b62a56f76bf`. Restoring the old sanitizer makes only the 147-issue regression fail. - Type-aware lint, production/test types, protocol, formatting, line-count, assertion-safety, and unused-export checks pass. ## Consumers Registered middleware receives normalized details. Agent requests receive summary text; host transcripts retain the truncation marker. Validation limits, public types, and cache lifecycles are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #147776
What Problem This Solves
Fixes
wiki_lintreturning “Tool output unavailable due to post-processing error.” for larger vaults even though the supported CLI lint succeeds.User Impact
Agents keep the lint summary and report path when optional details exceed existing limits. Smaller results retain their normalized details. No configuration or migration is required.
Why This Change Was Made
The shared incoming-details sanitizer now applies the existing shape check as well as the byte cap, with one truncation-marker return. Middleware replacements still undergo strict validation. Each result stays local to its ordered middleware chain.
Evidence
A real Gateway
chat.sendinvoked the registered wiki tool and bundled middleware against isolated vaults. A local provider fixture captured the next request.f8cd665c2b44: 147 warnings become the post-processing error.5b5e84742c21: the request retainsIssues: 147 total (0 errors, 147 warnings); the persisted tool result has{ truncated: true, originalSizeBytes: 26231 }and no error.bcfe3383b87d. Restoring the old sanitizer makes only the 147-issue regression fail.Consumers
Registered middleware receives normalized details. Agent requests receive summary text; host transcripts retain the truncation marker. Validation limits, public types, and cache lifecycles are unchanged.