Skip to content

fix(google): cancel unread response body on video download error - #110045

Merged
steipete merged 3 commits into
openclaw:mainfrom
Monkey-wusky:fix/google-cancel-video-download-error-body
Jul 29, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
Monkey-wusky:fix/google-cancel-video-download-error-body

Conversation

@Monkey-wusky

@Monkey-wusky Monkey-wusky commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

When downloadGeneratedVideoFromUri receives a non-OK response (e.g. 503), it throws immediately without canceling the response body. The unconsumed stream holds a connection open.

Why This Change Was Made

Follows the same pattern as #109701, #109519, #109728, #110039 — cancel the response body before throwing.

User Impact

No user-facing change. Prevents resource leaks when Google video generation downloads fail with non-OK HTTP status codes.

Evidence

Real HTTP server proof

$ node scripts/proofs/google-video-cancel-proof.mjs
Server: http://127.0.0.1:38965

=== BEFORE (throw without body.cancel) ===
  503 Service Unavailable — body UNCONSUMED, throw immediately
  [server] /generated-video:download?alt=media&key=test → stream completed (no cancel)

=== AFTER (body?.cancel before throw) ===
  503 Service Unavailable
  body?.cancel() executed ✓
  [server] /generated-video:download?alt=media&key=test → client canceled ✓

=== Error message preserved ===
  Thrown: Failed to download Google generated video: 503 Service Unavailable

The proof script simulates a Google direct-URI download endpoint returning 503 with a slow binary stream, then exercises the cancel-before-throw pattern.

Unit test

New test ("cancels response body on non-OK direct URI download before throwing") verifies body.cancel() is called once before the error propagates, using ReadableStream({ cancel }) spy pattern.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 20, 2026, 2:56 AM ET / 06:56 UTC.

Summary
The branch cancels an unread response body before throwing on a non-OK Google generated-video direct download and adds a regression test for that path.

PR surface: Source +1, Tests +40. Total +41 across 2 files.

Reproducibility: yes. source-reproducible with high confidence: current main’s non-OK generated-video download branch throws before consuming or cancelling the response body. The new test also identifies the focused provider call path, although this review did not execute it.

Review metrics: none identified.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal or runtime output that calls the actual Google provider flow with a controlled non-OK streamed download and shows cancellation plus the preserved error.
  • Update the PR body with that evidence; if review does not refresh automatically, ask a maintainer to comment @clawsweeper re-review.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body contains a useful local HTTP-server terminal transcript showing generic streamed-response cancellation, but it does not invoke the patched Google provider flow; add redacted terminal output or logs from that exact path before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The supplied local-server transcript confirms generic stream cancellation but does not demonstrate that the patched provider.generateVideo flow reaches the cancellation on a non-OK generated-video download; retain the real-behavior proof gate before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the minimal cancellation and regression test, then add redacted terminal or runtime output that executes the actual Google provider flow with a controlled non-OK streamed download and shows both cancellation and the preserved error.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] The remaining merge gate is contributor-provided real behavior proof from the exact provider path; an automated repair worker cannot produce evidence from the contributor’s setup.

Security
Cleared: The two-file patch only releases an already-received response body and adds a focused test; it adds no dependencies, permissions, secrets handling, artifact execution, or supply-chain surface.

Review details

Best possible solution:

Keep the minimal cancellation and regression test, then add redacted terminal or runtime output that executes the actual Google provider flow with a controlled non-OK streamed download and shows both cancellation and the preserved error.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible with high confidence: current main’s non-OK generated-video download branch throws before consuming or cancelling the response body. The new test also identifies the focused provider call path, although this review did not execute it.

Is this the best way to solve the issue?

Yes, the cancellation before the existing throw is the narrowest maintainable fix and matches merged cleanup patterns; the remaining gap is evidence that the exact provider path behaves as intended.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 34f942e89db0.

Label changes

Label justifications:

  • P3: This is a small provider resource-leak cleanup with no reported user-facing behavior change or urgent workflow outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body contains a useful local HTTP-server terminal transcript showing generic streamed-response cancellation, but it does not invoke the patched Google provider flow; add redacted terminal output or logs from that exact path before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1, Tests +40. Total +41 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
Tests 1 40 0 +40
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 41 0 +41

What I checked:

  • Current-main behavior: The proposed insertion is immediately before the non-OK error in downloadGeneratedVideoFromUri, so current main still reaches the throw without cancelling response.body; the PR addresses a real, narrow resource-release gap. (extensions/google/video-generation-provider.ts:245, 34f942e89db0)
  • Patch and exact-path test: The branch awaits response.body?.cancel().catch(() => undefined) before preserving the existing error, and its added test invokes provider.generateVideo with a non-OK streamed response and asserts one cancellation. (extensions/google/video-generation-provider.test.ts:371, 8075cba0f6be)
  • Prior comparable cleanup: The discussion links merged response-body cleanup PRs for distinct surfaces, including Google Chat and Microsoft Teams; they support the cancellation pattern but do not make this Google generated-video path redundant. (extensions/google/video-generation-provider.ts:245, b98b8e7313ff)
  • Proof continuity: The prior completed ClawSweeper cycle requested exact provider-path evidence. The updated body still shows a standalone local HTTP stream-cancellation transcript, not a run that invokes the patched Google provider method. (extensions/google/video-generation-provider.ts:245, 8075cba0f6be)
  • Likely ownership route: The supplied PR timeline routed the opened Google video change to xieyongliang, and related public feature-history references associate that person with Google video generation work; this is a routing signal rather than attribution of the defect. (extensions/google/video-generation-provider.ts:245, 34f942e89db0)

Likely related people:

  • xieyongliang: The PR timeline explicitly routed this Google video change to xieyongliang, and available feature-history references connect that person to Google video generation work. (role: likely Google video feature contributor; confidence: medium; files: extensions/google/video-generation-provider.ts, extensions/google/video-generation-provider.test.ts)
  • Monkey-wusky: This contributor has several merged response-body cancellation cleanups on adjacent but distinct OpenClaw surfaces, so they are relevant to the established cleanup pattern beyond this proposal. (role: recent related cleanup contributor; confidence: medium; commits: b98b8e7313ff, 9b238a792788; files: extensions/google/video-generation-provider.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (4 earlier review cycles)
  • reviewed 2026-07-17T14:39:48.182Z sha ac3cfd581e4acdbc86645c21fdafd47e8ce3c596 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-17T14:54:19.052Z sha ac3cfd581e4acdbc86645c21fdafd47e8ce3c596 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-17T15:16:00.731Z sha 5124537b7f14e33f78059f838be69068a7dabcf4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-17T15:58:04.290Z sha 5124537b7f14e33f78059f838be69068a7dabcf4 :: needs real behavior proof before merge. :: none

@Monkey-wusky

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 17, 2026
@Monkey-wusky
Monkey-wusky force-pushed the fix/google-cancel-video-download-error-body branch from ac3cfd5 to 5124537 Compare July 17, 2026 15:10
@Monkey-wusky
Monkey-wusky force-pushed the fix/google-cancel-video-download-error-body branch from 5124537 to 8075cba Compare July 20, 2026 06:51
@steipete

Copy link
Copy Markdown
Contributor

Maintainer verification of @Monkey-wusky's original PR, exact GitHub-signed head bd81605:

  • Exercised the actual registered Google plugin and genuine @google/genai 2.13.0, using a synthetic, authenticated loopback HTTP endpoint (not the live Google service).
  • Real-wire result: 3 authenticated generation requests, 5 authenticated media downloads, 2 independent indefinitely streamed HTTP 503 retry responses, 2 deliberately held Response.clone() tee branches, 2 body cancellations and 2 closed server sockets. Both retries complete without hanging and preserve Failed to download Google generated video: 503 Service Unavailable; successful video bytes and an empty-body 503 are also verified.
  • Fresh Linux Google-plugin suite: 31 files, 466/466 tests passing, including both new fresh-stream/held-tee and null-body regressions.
  • Fresh gpt-5.6-sol xhigh autoreview: clean, no accepted or actionable findings.
  • Exact-head full CI and required gate and Workflow Sanity: both completed successfully.

This directly addresses ClawSweeper's request for evidence from the real provider's controlled streamed-error path. The contributor-authored PR body is intentionally preserved, so the requested proof is recorded here instead of rewriting their submission.

@steipete
steipete merged commit 79e0b55 into openclaw:main Jul 29, 2026
87 of 89 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 29, 2026
* origin/main: (128 commits)
  fix(codex): keep stressed inference turns isolated and observable (#115893)
  feat(skills): review interrupted deep turns in experience review (#115887)
  fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852)
  fix(browser): stabilize atomic download staging (#115892)
  fix(google): cancel unread response body on video download error (#110045)
  refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884)
  fix(test): stop asserting exact video deadline budgets (#115883)
  feat(gateway): expose MCP tool identity in effective tools (#115870)
  fix(skills): verify workshop migration without recovery
  refactor: replace context-engine retry proxy with declared params (#115872)
  fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768)
  fix(codex): harden app inventory invalidation and targeted publishes (#115866)
  fix(browser): uploads fail when the browser runs on a remote node (#115291)
  fix(scripts): keep format-docs output tails UTF-8 safe (#110825)
  fix(skills): recover complete apply transitions
  fix(macos): reap timed-out shell process groups (#115859)
  refactor(ollama): unify model inspection and setup (#115879)
  fix(ui): muted theme text below WCAG AA contrast in webchat (#114586)
  fix(test): restore isolated memory manager tests (#115880)
  fix(skills): revalidate rollback targets
  ...
vincentkoc added a commit that referenced this pull request Jul 29, 2026
…discovery

* origin/main: (72 commits)
  fix(codex): keep stressed inference turns isolated and observable (#115893)
  feat(skills): review interrupted deep turns in experience review (#115887)
  fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852)
  fix(browser): stabilize atomic download staging (#115892)
  fix(google): cancel unread response body on video download error (#110045)
  refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884)
  fix(test): stop asserting exact video deadline budgets (#115883)
  feat(gateway): expose MCP tool identity in effective tools (#115870)
  fix(skills): verify workshop migration without recovery
  refactor: replace context-engine retry proxy with declared params (#115872)
  fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768)
  fix(codex): harden app inventory invalidation and targeted publishes (#115866)
  fix(browser): uploads fail when the browser runs on a remote node (#115291)
  fix(scripts): keep format-docs output tails UTF-8 safe (#110825)
  fix(skills): recover complete apply transitions
  fix(macos): reap timed-out shell process groups (#115859)
  refactor(ollama): unify model inspection and setup (#115879)
  fix(ui): muted theme text below WCAG AA contrast in webchat (#114586)
  fix(test): restore isolated memory manager tests (#115880)
  fix(skills): revalidate rollback targets
  ...
vincentkoc added a commit that referenced this pull request Jul 29, 2026
* origin/main: (95 commits)
  fix(codex): keep stressed inference turns isolated and observable (#115893)
  feat(skills): review interrupted deep turns in experience review (#115887)
  fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852)
  fix(browser): stabilize atomic download staging (#115892)
  fix(google): cancel unread response body on video download error (#110045)
  refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884)
  fix(test): stop asserting exact video deadline budgets (#115883)
  feat(gateway): expose MCP tool identity in effective tools (#115870)
  fix(skills): verify workshop migration without recovery
  refactor: replace context-engine retry proxy with declared params (#115872)
  fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768)
  fix(codex): harden app inventory invalidation and targeted publishes (#115866)
  fix(browser): uploads fail when the browser runs on a remote node (#115291)
  fix(scripts): keep format-docs output tails UTF-8 safe (#110825)
  fix(skills): recover complete apply transitions
  fix(macos): reap timed-out shell process groups (#115859)
  refactor(ollama): unify model inspection and setup (#115879)
  fix(ui): muted theme text below WCAG AA contrast in webchat (#114586)
  fix(test): restore isolated memory manager tests (#115880)
  fix(skills): revalidate rollback targets
  ...
vincentkoc added a commit that referenced this pull request Jul 29, 2026
…d-fingerprint

* origin/main: (36 commits)
  fix(codex): keep stressed inference turns isolated and observable (#115893)
  feat(skills): review interrupted deep turns in experience review (#115887)
  fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852)
  fix(browser): stabilize atomic download staging (#115892)
  fix(google): cancel unread response body on video download error (#110045)
  refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884)
  fix(test): stop asserting exact video deadline budgets (#115883)
  feat(gateway): expose MCP tool identity in effective tools (#115870)
  fix(skills): verify workshop migration without recovery
  refactor: replace context-engine retry proxy with declared params (#115872)
  fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768)
  fix(codex): harden app inventory invalidation and targeted publishes (#115866)
  fix(browser): uploads fail when the browser runs on a remote node (#115291)
  fix(scripts): keep format-docs output tails UTF-8 safe (#110825)
  fix(skills): recover complete apply transitions
  fix(macos): reap timed-out shell process groups (#115859)
  refactor(ollama): unify model inspection and setup (#115879)
  fix(ui): muted theme text below WCAG AA contrast in webchat (#114586)
  fix(test): restore isolated memory manager tests (#115880)
  fix(skills): revalidate rollback targets
  ...
vincentkoc added a commit that referenced this pull request Jul 29, 2026
…-mascot-cadence

* origin/main: (24 commits)
  fix(codex): keep stressed inference turns isolated and observable (#115893)
  feat(skills): review interrupted deep turns in experience review (#115887)
  fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852)
  fix(browser): stabilize atomic download staging (#115892)
  fix(google): cancel unread response body on video download error (#110045)
  fix(skills): verify workshop migration without recovery
  fix(skills): recover complete apply transitions
  fix(skills): revalidate rollback targets
  fix(skills): restore post-commit write failures
  fix(skills): retain rollback for partial writes
  fix(skills): avoid recursive workshop recovery locks
  fix(skills): use bounded config recovery reads
  chore(skills): prune workshop max-lines baseline
  fix(skills): preserve workshop recovery config
  fix(skills): refresh snapshots after apply rollback
  fix(skills): guard workshop rollback recovery
  refactor(skills): drop obsolete workshop lint waiver
  test(skills): assert recovery through retry
  test(skills): prove workshop apply recovery
  fix(skills): avoid recursive workshop target locks
  ...
vincentkoc added a commit that referenced this pull request Jul 29, 2026
…ocess-probes

* origin/main: (56 commits)
  fix(codex): keep stressed inference turns isolated and observable (#115893)
  feat(skills): review interrupted deep turns in experience review (#115887)
  fix: reject malformed UTF-8 in proxy gateway error response bodies (#111852)
  fix(browser): stabilize atomic download staging (#115892)
  fix(google): cancel unread response body on video download error (#110045)
  refactor(ui): give Memory the shared hub header with hoisted agent scope (#115884)
  fix(test): stop asserting exact video deadline budgets (#115883)
  feat(gateway): expose MCP tool identity in effective tools (#115870)
  fix(skills): verify workshop migration without recovery
  refactor: replace context-engine retry proxy with declared params (#115872)
  fix: reject malformed UTF-8 in hosted official plugin catalog feed responses (#111768)
  fix(codex): harden app inventory invalidation and targeted publishes (#115866)
  fix(browser): uploads fail when the browser runs on a remote node (#115291)
  fix(scripts): keep format-docs output tails UTF-8 safe (#110825)
  fix(skills): recover complete apply transitions
  fix(macos): reap timed-out shell process groups (#115859)
  refactor(ollama): unify model inspection and setup (#115879)
  fix(ui): muted theme text below WCAG AA contrast in webchat (#114586)
  fix(test): restore isolated memory manager tests (#115880)
  fix(skills): revalidate rollback targets
  ...
@Monkey-wusky
Monkey-wusky deleted the fix/google-cancel-video-download-error-body branch July 30, 2026 05:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
…nclaw#110045)

* fix(google): cancel unread response body on video download error

* fix(google): safely cancel failed streaming video downloads

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: google P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants