Repository navigation
fix(docs): cancel non-OK search response body before throwing - #109508
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 1:53 AM ET / 05:53 UTC. Summary PR surface: Source +1, Tests +13. Total +14 across 2 files. Reproducibility: no. not at high confidence: source inspection and the mocked regression establish the cancellation path, but no current-head real HTTP reproduction demonstrates the underlying connection behavior. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Retain the narrow owner-boundary cleanup and add a real loopback HTTP transcript where the docs command receives a partial or stalled 503 response and the server observes peer closure, with private endpoints and network details redacted. Do we have a high-confidence way to reproduce the issue? No, not at high confidence: source inspection and the mocked regression establish the cancellation path, but no current-head real HTTP reproduction demonstrates the underlying connection behavior. Is this the best way to solve the issue? Yes, cancelling the unread body at the fetch owner boundary before preserving the existing error is the narrowest maintainable fix; only transport-level proof remains missing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e13f459a7d5. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +13. Total +14 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
Review history (2 earlier review cycles)
|
1e3368b to
68ad3c5
Compare
When the Cloudflare docs search API returns a non-OK status, fetchDocsSearch threw without cancelling the response body. This could leave the underlying connection open until GC. Cancel the body before throwing, matching the pattern established in reef guard adapters (openclaw#109196) and fetchOpenRouterModels.
68ad3c5 to
0a8da3b
Compare
|
Merged via squash.
|
…aw#109508) When the Cloudflare docs search API returns a non-OK status, fetchDocsSearch threw without cancelling the response body. This could leave the underlying connection open until GC. Cancel the body before throwing, matching the pattern established in reef guard adapters (openclaw#109196) and fetchOpenRouterModels.
…aw#109508) When the Cloudflare docs search API returns a non-OK status, fetchDocsSearch threw without cancelling the response body. This could leave the underlying connection open until GC. Cancel the body before throwing, matching the pattern established in reef guard adapters (openclaw#109196) and fetchOpenRouterModels.
What Problem This Solves
When
fetchDocsSearchreceives a non-OK response from the Cloudflare docs search API, it throws immediately without cancelling the response body. This leaves the underlying HTTP connection open until the response body is garbage-collected, which can delay connection reuse.Why This Change Was Made
Other parts of the codebase already cancel non-OK response bodies before throwing — see
fetchOpenRouterModelsinmodel-scan.ts(finally block) andguard-adapters.ts(#109196). This change applies the same pattern tofetchDocsSearchfor consistency.User Impact
No visible user impact. The fix ensures connections are released promptly on API errors, which can improve responsiveness when the docs search API is degraded.
Evidence
Test:
cancels non-OK docs search response bodies and fails loudlyThe test creates a
Response("unavailable", { status: 503 }), spies onresponse.body.cancel, and verifies:cancelis called exactly once before the error propagatesAll 5 docs command tests pass: