fix(cli): bound docs search API response reads#98188
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 12:55 PM ET / 16:55 UTC. Summary PR surface: Source +5, Tests +29. Total +34 across 2 files. Reproducibility: yes. Current main and the latest release still call Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the focused bounded-read change after normal maintainer and required CI gates, preserving current CLI output for ordinary docs searches. Do we have a high-confidence way to reproduce the issue? Yes. Current main and the latest release still call Is this the best way to solve the issue? Yes. Reusing the existing media-core bounded reader at the docs search response boundary is the narrowest maintainable fix; the provider-specific JSON helper would add the wrong ownership label, and the command keeps its local parser/output behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6cb82eaab865. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5, Tests +29. Total +34 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
560861d to
b3eb350
Compare
|
Merged via squash.
|
…penclaw#98188) (cherry picked from commit f284ce3)
…penclaw#98188) (cherry picked from commit f284ce3)
What Problem This Solves
fetchDocsSearchinsrc/commands/docs.tscallsawait response.json()on the docs.openclaw.ai search API response without a read limit. A large or malicious response could force the CLI to buffer arbitrarily large payloads before JSON parsing, risking OOM.Supersedes #96251 — adds the committed regression test that ClawSweeper requested.
Why This Change Was Made
All external HTTP response reads should use
readResponseWithLimitorreadProviderJsonResponseto cap memory consumption. The docs search command already had a fetch timeout viaAbortControllerbut the response body was unbounded.User Impact
The
openclaw docs <query>command is now protected against oversized search API responses. Normal queries work identically. An oversized response produces a clear error message instead of buffering the entire body.Evidence
Environment: Linux, Node 22, OpenClaw main
Committed tests pass (4/4, including oversized response rejection):
Oversized response test proves the 8 MiB cap is enforced:
Build succeeds (dist compiled, no type errors).
Risk
Low.
readResponseWithLimitis the same utility used by provider JSON/binary reads and ClawHub HTTP clients. The 8 MiB cap is generous for a docs search API response. No config, auth, or API surface changes.🤖 Generated with Claude Code