Skip to content

fix(providers): enforce canonical binary response ownership - #117281

Merged
steipete merged 1 commit into
mainfrom
codex/qa400-provider-binary-canonical-three
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa400-provider-binary-canonical-three

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

BytePlus video, Runway video, and MiniMax music could report successful generated media when a provider-owned download actually returned HTTP-200 JSON, problem JSON, HTML, or zero bytes. MiniMax's minimax and minimax-portal aliases shared the same affected music owner.

Why This Change Was Made

Validate the response at each existing provider-owned binary-download boundary with the canonical public provider HTTP validator, reject empty media after the existing bounded reader, and cancel unread invalid response bodies before their transport is released. Preserve provider-specific byte-limit and timeout errors, accepted audio/video/octet-stream/missing media types, request authentication, MiniMax retry behavior, and the recently landed MiniMax streaming-completion and strict-hex handling.

The only shared changes expose the existing real validator through existing test-only mocks; no production Plugin SDK surface, provider policy, configuration, or transport-security contract changes.

User Impact

Generated BytePlus and Runway videos and MiniMax music now fail clearly when an upstream download is not valid nonempty media, instead of returning corrupt or empty successful output. Rejected unfinished response streams release their sockets promptly.

Evidence

  • Frozen baseline: 51c41c25c8c3fdb9340415b41c8faf1a44c18b45; immutable candidate: 240421a0639abb0f641adb432cdd407abb0ef4f5.
  • Actual complete-provider, CA-verified HTTPS + real HTTP CONNECT proxy + unmodified native fetch: baseline reproduced 16 malformed-media successes while 24 valid/cap/strict-hex/stream-completion controls passed; immutable candidate passed all 44 cases across BytePlus, Runway, MiniMax, and MiniMax Portal, with 98 HTTPS requests and 68 real CONNECT tunnels.
  • All four genuinely never-ending malformed response sockets closed, including both guarded MiniMax aliases.
  • OPENCLAW_VITEST_FS_MODULE_CACHE=0 OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/byteplus/video-generation-provider.test.ts extensions/runway/video-generation-provider.test.ts extensions/minimax/music-generation-provider.test.ts extensions/minimax/video-generation-provider.test.ts — four files, 65 tests passed.
  • Targeted oxfmt --check across all eight existing changed files and git diff --check both passed.
  • Official vendor contracts: BytePlus video output, Runway generated outputs, and MiniMax music output formats.
  • Current main ee320a6e411479a23faa89a75463ff1b15630afc merges cleanly into synthetic tree 923e2e8fc8eb2b7adb73e448873d68d7054bbdc4.
  • Exact-head hosted checks and structured autoreview are tracked separately and must complete before landing.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:35 AM ET / 07:35 UTC.

ClawSweeper review

What this changes

The PR validates BytePlus and Runway video downloads plus MiniMax music downloads so non-media or empty successful responses fail clearly and rejected unread streams are canceled.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

The patch is still necessary: current main contains the shared binary-response contract, but the three provider-owned download paths still accept HTTP-200 JSON, text, and empty bodies as generated media. The PR applies the existing contract at the correct owner boundaries with focused regression coverage; it remains open because it is current, maintainer-labeled, and exact-head checks are still running. Likely related people: Peter Steinberger (high confidence) and Vincent Koc (high confidence).

Priority: P2
Reviewed head: 240421a0639abb0f641adb432cdd407abb0ef4f5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong real-behavior evidence and focused regression coverage support a normal merge review once exact-head verification completes.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides after-fix real transport evidence across the affected providers, including malformed-response rejection and socket closure; redact any sensitive proxy or endpoint details in future posted artifacts.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix real transport evidence across the affected providers, including malformed-response rejection and socket closure; redact any sensitive proxy or endpoint details in future posted artifacts.
Evidence reviewed 5 items Current-main defect remains: The current MiniMax URL-download path verifies only HTTP status, then derives a MIME type and returns readResponseWithLimit bytes without rejecting text/JSON content or an empty body; the proposed patch applies the corresponding validation at this and the BytePlus and Runway boundaries.
Canonical contract: The shared provider contract rejects JSON and text responses and defines a binary response as non-empty after bounded reading. The PR calls its validator while retaining each provider's established timeout and overflow wording.
Focused patch and coverage: Commit 240421a adds validation/cancellation and empty-body rejection only at BytePlus video, Runway video, and MiniMax music download owners, plus regression tests covering JSON, problem JSON, HTML, empty media, and unread-body cancellation.
Findings None None.
Security None None.

How this fits together

Provider plugins poll a vendor generation API and then download the vendor-owned media URL. The downloaded response is converted into an attachment returned to the agent, so validation must reject non-media content before attachment creation.

flowchart LR
  A[Generation request] --> B[Provider task API]
  B --> C[Generated media URL]
  C --> D[Provider download boundary]
  D --> E[Binary response validation]
  E --> F[Bounded media reader]
  F --> G[Agent attachment output]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is mergeable but behind current main, and several exact-head build, lint, and compact-check lanes were still running in the supplied context; merge only after those required checks complete against the reviewed head.
Agent review details

Security

None.

PR surface

Source +42, Tests +229. Total +271 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 52 10 +42
Tests 3 229 0 +229
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 281 10 +271

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: extensions/minimax/music-generation-provider.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused provider-owner repair after exact-head checks complete, keeping the existing per-provider timeout, retry, byte-limit, authentication, and missing-content-type behavior intact.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused provider-owner repair after exact-head checks complete, keeping the existing per-provider timeout, retry, byte-limit, authentication, and missing-content-type behavior intact.

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

Yes, source reproducible: current main's affected download owners accept an HTTP-successful response and return bounded bytes without applying the shared non-text/non-JSON and non-empty binary invariant. The PR body also records a real transport reproduction, but this read-only review did not rerun it.

Is this the best way to solve the issue?

Yes. Applying the existing canonical binary validator at each provider-owned download boundary is narrower and more maintainable than adding a new shared policy layer, while the local empty-body checks preserve provider-specific timeout and size-limit errors.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The patch repairs malformed generated-media handling with limited blast radius across three optional provider integrations.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix real transport evidence across the affected providers, including malformed-response rejection and socket closure; redact any sensitive proxy or endpoint details in future posted artifacts.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix real transport evidence across the affected providers, including malformed-response rejection and socket closure; redact any sensitive proxy or endpoint details in future posted artifacts.

Label justifications:

  • P2: The patch repairs malformed generated-media handling with limited blast radius across three optional provider integrations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix real transport evidence across the affected providers, including malformed-response rejection and socket closure; redact any sensitive proxy or endpoint details in future posted artifacts.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix real transport evidence across the affected providers, including malformed-response rejection and socket closure; redact any sensitive proxy or endpoint details in future posted artifacts.

Evidence

What I checked:

  • Current-main defect remains: The current MiniMax URL-download path verifies only HTTP status, then derives a MIME type and returns readResponseWithLimit bytes without rejecting text/JSON content or an empty body; the proposed patch applies the corresponding validation at this and the BytePlus and Runway boundaries. (extensions/minimax/music-generation-provider.ts:100, edfeec49e7a7)
  • Canonical contract: The shared provider contract rejects JSON and text responses and defines a binary response as non-empty after bounded reading. The PR calls its validator while retaining each provider's established timeout and overflow wording. (src/agents/provider-http-errors.ts:405, edfeec49e7a7)
  • Focused patch and coverage: Commit 240421a adds validation/cancellation and empty-body rejection only at BytePlus video, Runway video, and MiniMax music download owners, plus regression tests covering JSON, problem JSON, HTML, empty media, and unread-body cancellation. (extensions/byteplus/video-generation-provider.ts:197, 240421a0639a)
  • Related main history: Current main already includes the prior MiniMax producer-owner repair, but the current download helper still lacks content and empty-body validation; this PR covers the remaining provider-owned response boundary rather than duplicating that landed work. (extensions/minimax/music-generation-provider.ts:100, 51c41c25c8c3)
  • Real behavior proof: The PR body records an after-fix run through real HTTPS provider endpoints and an HTTP CONNECT proxy: baseline had 16 malformed-media successes; the candidate passed 44 cases and closed four never-ending malformed response sockets. The supplied artifact manifest contains only an unrelated failed example.com media fetch, so this assessment relies on the PR's recorded live-output evidence rather than local media. (240421a0639a)

Likely related people:

  • Peter Steinberger: Authored the immediately preceding merged MiniMax producer-owner validation repair, which current main contains; he also authored the proposed follow-on fix. (role: recent area contributor; confidence: high; commits: 51c41c25c8c3; files: extensions/minimax/music-generation-provider.ts, src/agents/provider-http-errors.ts)
  • Vincent Koc: History shows him on the original bounded generated-track and generated-video download work and on the current provider implementation lineage. (role: original download-path contributor; confidence: high; commits: 036298fbaec0, 9e002c12ac7a, 42c313976ef0; files: extensions/minimax/music-generation-provider.ts, extensions/byteplus/video-generation-provider.ts, extensions/runway/video-generation-provider.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the in-progress exact-head build, lint, and compact-check lanes to complete before merging.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit 870c6b2 into main Aug 1, 2026
129 of 137 checks passed
@steipete
steipete deleted the codex/qa400-provider-binary-canonical-three branch August 1, 2026 08:05
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 1, 2026
* origin/main: (41 commits)
  test(ci): update memory helper routing expectation (#117295)
  fix(canvas): emit successful control results in JSON mode (#117297)
  fix(imessage): settle native inbound reply delivery (#117282)
  fix(agents): reject invalid UTF-8 LSP responses (#117271)
  fix(line): centralize card and template message alt text (#117280)
  fix(release): validate candidates before Docker publication (#117252)
  fix(media): validate provider-owned generated media downloads (#117281)
  fix(feishu): restore custom HTTPS API domains (#117278)
  fix(models): reuse prepared plugin metadata (#117131)
  fix(agents): stop fallback after delivered-but-failed attempts (#114628)
  fix(memory): reuse targeted session corpus snapshot (#117247)
  fix(matrix): reconcile durable sends after response loss
  test(release): repair full validation regressions (#116931)
  fix(linux-canvas): report socket watcher fallback (#109502)
  fix(codex): preserve authoritative turn completion (#117185)
  fix(canvas): preserve widgets across derived-name collisions (#117132)
  fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (#117206)
  fix(msteams): prevent duplicate final replies (#116398)
  fix(doctor): session SQLite restore installs an empty session index over the valid archive (#117221)
  fix(plugins): preserve workspace plugins across CLI and control UI (#117265)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main: (41 commits)
  test(ci): update memory helper routing expectation (openclaw#117295)
  fix(canvas): emit successful control results in JSON mode (openclaw#117297)
  fix(imessage): settle native inbound reply delivery (openclaw#117282)
  fix(agents): reject invalid UTF-8 LSP responses (openclaw#117271)
  fix(line): centralize card and template message alt text (openclaw#117280)
  fix(release): validate candidates before Docker publication (openclaw#117252)
  fix(media): validate provider-owned generated media downloads (openclaw#117281)
  fix(feishu): restore custom HTTPS API domains (openclaw#117278)
  fix(models): reuse prepared plugin metadata (openclaw#117131)
  fix(agents): stop fallback after delivered-but-failed attempts (openclaw#114628)
  fix(memory): reuse targeted session corpus snapshot (openclaw#117247)
  fix(matrix): reconcile durable sends after response loss
  test(release): repair full validation regressions (openclaw#116931)
  fix(linux-canvas): report socket watcher fallback (openclaw#109502)
  fix(codex): preserve authoritative turn completion (openclaw#117185)
  fix(canvas): preserve widgets across derived-name collisions (openclaw#117132)
  fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (openclaw#117206)
  fix(msteams): prevent duplicate final replies (openclaw#116398)
  fix(doctor): session SQLite restore installs an empty session index over the valid archive (openclaw#117221)
  fix(plugins): preserve workspace plugins across CLI and control UI (openclaw#117265)
  ...
chenyangjun-xy added a commit to chenyangjun-xy/openclaw that referenced this pull request Aug 2, 2026
…, HTML, or empty bodies

Google video, fal video, and fal image provider-owned downloads could report
successful generated media when the download actually returned HTTP-200 JSON,
problem JSON, HTML, or zero bytes. Sibling providers (BytePlus video, Runway
video, MiniMax music) were already covered by openclaw#117281.

Add assertProviderBinaryResponseContent before reading each binary body and
reject empty bodies so malformed downloads fail loudly instead of surfacing as
successful generated media. Cancel each rejected body so the underlying socket
is released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: byteplus extensions: minimax maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant