Repository navigation
fix(qqbot): reject open HTTP error bodies during debug capture - #119466
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 4:19 AM ET / 08:19 UTC. ClawSweeper reviewWhat this changesThe PR makes QQ Bot URL-media downloads return non-OK HTTP errors without waiting for a debug-capture response clone to finish cancellation. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo blocking findings. Current main still awaits a tee-bound cancellation in this QQ Bot path, while this PR applies the existing nonblocking cancellation pattern with a focused native-stream regression test; it remains necessary and ready for maintainer review after a merge-result refresh. Priority: P2 Review scores
Verification
How this fits togetherQQ Bot fetches a supplied media URL through an SSRF-protected downloader before acquiring a QQ token or uploading media. Debug proxy capture clones HTTP responses for redacted diagnostics, so a failed download must not wait on the clone branch before returning its error. flowchart LR
A[QQ Bot media URL] --> B[SSRF-protected fetch]
B --> C[Debug capture clone]
B --> D[QQ Bot downloader]
D --> E{HTTP response OK?}
E -->|No| F[Cancel body without blocking]
F --> G[Return HTTP error]
E -->|Yes| H[Read media and upload]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +68. Total +71 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the owner-local nonblocking cancellation after an exact current-main merge/check refresh, while retaining the existing capture clone reader and SSRF-guard dispatcher cleanup. Do we have a high-confidence way to reproduce the issue? Yes. Current main awaits cancellation at the affected error branch, and the exact-head native Response.clone regression test provides a concrete open-stream path showing why that promise can remain pending. Is this the best way to solve the issue? Yes. The downloader owns the prompt error outcome and must not await tee-bound cleanup; the change preserves best-effort cancellation and the existing dispatcher release rather than adding a fallback or timeout. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 26a58bcd92ba. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
@clawsweeper re-review Real behavior proof with debug capture enabled has been added to the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Punchcard-Session: clear-orchard-lantern-bc
|
@clawsweeper re-review The head changed to replace the synthetic cancellation mock with a native open |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready verification:
Production delta: |
|
Merged via squash.
|
…law#119466) * fix(qqbot): cancel rejected direct-upload body fire-and-forget under debug proxy * test(qqbot): prove capture tee cancellation stays non-blocking Punchcard-Session: clear-orchard-lantern-bc --------- Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes an issue where QQ Bot media uploads from a URL could hang instead of returning an upstream HTTP error when debug proxy capture retained an open clone of the response body.
Why This Change Was Made
downloadDirectUploadUrlnow starts cancellation of a non-OK response body without awaiting the tee-bound cancellation promise, then throws the HTTP error while the existingfinallyblock releases the guarded dispatcher. The regression test uses a native openReadableStream,Response.clone(), and the originalcancel()implementation to prove the capture sibling cannot block the caller.Regression provenance: #110008, squash commit
17643f385085d68d104d216eae1a08785da4b3ec, added the awaited cancellation that becomes pending when debug capture owns the sibling tee branch.User Impact
Operators using QQ Bot URL media uploads receive the upstream HTTP 4xx/5xx failure promptly under debug capture instead of an indefinitely pending upload. No QQ API request or token lookup runs after the download error.
Evidence
await response.body?.cancel()makes the regression test fail on the nextsetImmediateturn because the native tee cancellation is still pending.downloadDirectUploadUrlrejected withDirect-upload media URL returned HTTP 500in 182 ms.node scripts/run-vitest.mjs extensions/qqbot/src/engine/api/media.test.ts src/proxy-capture/runtime.test.tsoxfmt --checkandgit diff --checkpassed.tbx_01kz8d7ynjgbv4q2qdangbbc9bProduction delta:
+4/-1. Test delta:+68/-0. No config, SDK, protocol, storage, migration, or product-boundary change.Punchcard-Session: clear-orchard-lantern-bc