Repository navigation
improve: reuse snapshotted web search result rows - #139162
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 5, 2026, 11:07 AM ET / 15:07 UTC. ClawSweeper reviewWhat this changesReuses the already-snapshotted web-search result array, avoiding a second allocation while preserving model-facing output. Merge readiness✅ Ready for maintainer review Keep open: this useful optimization is absent from current main and preserves the existing output contract. No blocking correctness or security findings. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s managed web-search tool receives provider payloads and normalizes them into results, answers, errors, or raw output. This boundary isolates provider data and applies content safeguards before returning it to the agent. flowchart TD
A[Agent search request] --> B[Managed search provider]
B --> C[JSON snapshot]
C --> D[Validate and classify payload]
D --> E[Bounded results or answer]
D --> F[Error or raw payload]
E --> G[Protected tool output]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -2. Total -2 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use one isolated provider snapshot for validation and bounded projection, retaining raw passthrough and existing content safeguards. Do we have a high-confidence way to reproduce the issue? Not applicable to a functional bug: source confirms the redundant allocation, and the body reports comparative measurements; no benchmark was rerun during this read-only review. Is this the best way to solve the issue? Yes. Removing the second copy at the normalization owner is the narrowest solution; removing the JSON snapshot instead would sacrifice isolation and serialization safeguards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 16903b452113. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: (46 commits) fix(gateway): keep chat metadata responsive across auth refresh (openclaw#139192) fix(doctor): keep Workshop relocation lint read-only (openclaw#139193) perf(ui): retain unchanged forwarded avatar publications (openclaw#139181) fix(config): guide exec policy migration repairs (openclaw#139143) test(i18n): refresh representative Watch key (openclaw#139197) fix(agents): preserve recovered scheduled-run outcomes (openclaw#139037) refactor(acp): simplify pending operation accounting (openclaw#139189) fix(plugin-sdk): harden account scope for pairing requests and challenges (openclaw#139142) perf(gateway): avoid redundant PR landing ancestry checks (openclaw#139186) perf(ui): release captured audio cache leases directly (openclaw#139174) fix(skills): validate names in library forms (openclaw#139184) fix(sessions): reduce cold catalog listing delays (openclaw#139146) perf(cron): scan preserved action output once (openclaw#139163) fix(agents): keep fresh tool results readable under context pressure (openclaw#139165) fix(compaction): heartbeat sessions ignore the active transcript byte cap (openclaw#136533) perf(agents): reuse snapshotted web search result rows (openclaw#139162) fix(onboarding): keep Tauri setup recoverable and verify model results (openclaw#139140) fix(memory): rank indexed sessions by source activity (openclaw#139112) perf(terminal): avoid rebuilding sanitized link fallbacks (openclaw#139159) perf(agents): bound retained tool result projection data (openclaw#139157) ...
What Problem This Solves
Every web-search result list was copied a second time during normalization, including large provider payloads that would ultimately be reduced to ten results or returned through the raw-output branch.
Why This Change Was Made
The normalizer now reuses the result array in its existing JSON snapshot. That snapshot already isolates provider data and converts sparse holes to explicit nulls, so the extra
Array.fromand its obsolete comment are unnecessary. All rows are still validated before result truncation; error precedence, untrusted-content wrapping, and output budgets remain unchanged.User Impact
Web-search output remains identical while avoiding one full result-array allocation per call. Production is 2 lines smaller; tests are unchanged. The benefit is modest for ordinary result counts and more visible for large payloads.
Evidence
Array.fromsamples dropped from about 2.4 MB to zero across 30 calls with 10,000 rows. For five-row results the saved sample was about 33 KB across 500 calls; total allocation noise exceeded that saving.