Repository navigation
fix(qqbot): add timeout to remote media URL fetches - #103018
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 6:08 AM ET / 10:08 UTC. Summary PR surface: Source +9, Tests +37. Total +46 across 5 files. Reproducibility: yes. at high source confidence. Current main routes inbound attachments and outbound URL fallback through a QQBot helper with no response-header deadline, while the supplied stalled-HTTPS run exercised the production path and expected timeout outcome after the fix. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Land the QQBot-owned 120-second response-header deadline through the existing shared media runtime, preserving current HTTPS, SSRF, progressing-body, and null-return behavior. Do we have a high-confidence way to reproduce the issue? Yes at high source confidence. Current main routes inbound attachments and outbound URL fallback through a QQBot helper with no response-header deadline, while the supplied stalled-HTTPS run exercised the production path and expected timeout outcome after the fix. Is this the best way to solve the issue? Yes. A response-header-only deadline is the narrowest maintainable solution because it reuses the canonical runtime, does not cap healthy progressing bodies, and keeps QQBot-specific policy in the owning plugin. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7bb59c451122. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +37. Total +46 across 5 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 (4 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Updated the PR body with exact-head real behavior proof for The new proof uses the built-in QQBot adapter and production Known proof limitation is explicit in the body: certificate verification was disabled only for the local self-signed TLS harness. The timeout, SSRF, built-in adapter, media runtime, HTTPS connection, abort, and null-return path are exercised. |
ea09988 to
2a5ab12
Compare
|
ClawSweeper update for latest head
Validation on the current head: I tried to rerun the exact stalled HTTPS harness at the new head, but this container cannot add the RFC2544 loopback alias used by the previous accepted proof ( Please rerun the review on the latest head. |
|
@clawsweeper re-review Latest head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…edia-fetch-timeout # Conflicts: # extensions/qqbot/src/bridge/bootstrap.test.ts
|
Maintainer review: merge-ready. Clean review; this fixes a real QQBot remote-media header stall at the existing owner boundary by forwarding a 120-second response-header-only deadline through the shared guarded-media runtime. This is the narrow fix: it preserves HTTPS/SSRF behavior and does not cap slow-but-progressing response bodies. No breaking change; the only behavior tightening is that stalled header fetches now fail instead of hanging. Exact head: |
* fix(qqbot): add timeout to remote media URL fetches * fix(qqbot): use response header media timeout --------- Co-authored-by: llagy009 <[email protected]>
What Problem This Solves
QQBot remote media downloads accepted HTTPS media URLs and delegated them through the platform media adapter without a response-header deadline. If a remote media host accepted the connection but never sent headers, inbound attachment handling or outbound remote-media send preparation could wait indefinitely.
Why This Change Was Made
The shared media runtime now has a
responseHeaderTimeoutMscontract for stalled-header protection. This PR wires QQBot's media adapter contract through to that runtime and givesdownloadFile()a 120s response-header deadline while preserving the existing HTTPS and SSRF policy checks.This deliberately does not use
timeoutMsfor the QQBot 120s deadline, becausetimeoutMscaps the complete fetch/body operation and can break slow-but-progressing media downloads after headers arrive.User Impact
QQBot media URLs that stall before response headers now fail and return
nullthrough the existing error path instead of wedging the media pipeline forever. Slow response bodies can continue through the existing media runtime body handling after headers arrive.Evidence
Exact head:
2a5ab12210ce48a1925620a7bcc621de2daa7716Current-head validation:
node scripts/run-vitest.mjs extensions/qqbot/src/engine/utils/file-utils.test.ts extensions/qqbot/src/bridge/bootstrap.test.ts-> 2 files, 7 tests passed.node_modules/.bin/oxfmt --check --threads=1 extensions/qqbot/src/engine/adapter/types.ts extensions/qqbot/src/bridge/bootstrap.ts extensions/qqbot/src/bridge/bootstrap.test.ts extensions/qqbot/src/engine/utils/file-utils.ts extensions/qqbot/src/engine/utils/file-utils.test.ts-> passed.node_modules/.bin/oxlint --threads=1 extensions/qqbot/src/engine/adapter/types.ts extensions/qqbot/src/bridge/bootstrap.ts extensions/qqbot/src/bridge/bootstrap.test.ts extensions/qqbot/src/engine/utils/file-utils.ts extensions/qqbot/src/engine/utils/file-utils.test.ts-> passed.git diff --check-> clean.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental false --pretty false-> passed.env -u OPENAI_API_KEY -u OPENAI_ORG_ID -u OPENAI_PROJECT_ID .agents/skills/autoreview/scripts/autoreview --mode local-> passed with no findings.Current-head behavior coverage:
extensions/qqbot/src/engine/utils/file-utils.test.tsassertsdownloadFile()passesresponseHeaderTimeoutMs: 120_000together withQQBOT_MEDIA_SSRF_POLICYto the platform adapter.extensions/qqbot/src/bridge/bootstrap.test.tsasserts the built-in bridge adapter forwardsresponseHeaderTimeoutMsthrough toreadRemoteMediaBuffer().src/media/fetch.tson currentmainowns the response-header timer and clears only that timer after headers arrive; this PR does not add a duplicate core media path.Previously accepted real behavior proof:
fb6cf168380c2894040fc279aa1bfa203b8e95e7, the local stalled HTTPS harness exercised productiondownloadFile()fromextensions/qqbot/src/engine/utils/file-utils.ts, the built-in adapter fromextensions/qqbot/src/bridge/bootstrap.ts, the media runtime, the SSRF guard, a real HTTPS/TLS connection, and the production 120000ms abort path.https://media.qq.com:<port>/redacted/photo.png, mappedmedia.qq.comto198.18.0.1, enabled the QQBot RFC2544 SSRF allowance, withheld response headers, observed the client abort after the 120s deadline, returneddownloadFile.result=null, and wrote zero files.ip addr add 198.18.0.1/32 dev loreturnedRTNETLINK answers: Operation not permitted. The current-head focused tests above cover the code difference from that accepted proof: the 120s deadline now lands inresponseHeaderTimeoutMsinstead oftimeoutMs.What was not tested: live QQBot traffic. No QQBot token, media ID, or secret was used.