Skip to content

fix(minimax): stream music generation responses#84561

Closed
neeravmakwana wants to merge 1 commit into
openclaw:mainfrom
neeravmakwana:fix-minimax-music-polling
Closed

fix(minimax): stream music generation responses#84561
neeravmakwana wants to merge 1 commit into
openclaw:mainfrom
neeravmakwana:fix-minimax-music-polling

Conversation

@neeravmakwana

Copy link
Copy Markdown
Contributor

Summary

  • Switch MiniMax music generation to request streaming hex output and decode returned SSE/audio frames into an MP3 asset.
  • Use the existing music-generation operation deadline for the generation request so streaming or long-running MiniMax responses are not cut off by the 120s per-request fallback.
  • Keep existing URL/inline-audio response handling for MiniMax responses that still return JSON.

Root Cause

MiniMax music generation can take longer than the provider's 120s request fallback. The provider sent one non-streaming generation request and tied the whole operation to that short request timeout, so longer tracks could fail before OpenClaw received usable audio.

Fixes #84506.

Why This Is Safe

The change is limited to the bundled MiniMax music-generation provider. It keeps the same auth resolution, base URL resolution, SSRF/private-network policy, model selection, mp3-only output contract, and existing JSON response fallback paths. Streaming frames are decoded only from MiniMax's response body, and provider base_resp errors continue to fail the request.

Security/runtime controls unchanged: MiniMax credentials still come from the existing provider auth flow, downloads still use the provider download helper, private-network access remains disabled by default, and no prompt-based policy or security behavior was added.

Real behavior proof

Behavior addressed: MiniMax music generation no longer fails at the old 120s request fallback when generation takes longer than that window.

Real environment tested: Local macOS checkout running this branch, using MINIMAX_API_KEY from local .env without printing the key.

Exact steps or command run after this patch: A local node --import tsx script invoked the patched MiniMax provider with minimax/music-2.6, instrumental=true, durationSeconds=130, format=mp3, and timeoutMs=300000. A second local node --import tsx script invoked the patched OpenClaw music_generate tool with minimax/music-2.6, instrumental=true, durationSeconds=20, format=mp3, and saved the generated media.

Evidence after fix: Provider proof logs showed POST https://api.minimax.io/v1/music_generation returned 200 text/event-stream after 119819ms and completed after 159219ms with one audio/mpeg track of 3130558 bytes. Tool proof logs showed local music_generate generated one minimax/music-2.6 audio attachment and saved one audio/mpeg path after a provider request lasting 136518ms plus download.

Observed result after fix: Both live runs completed successfully; the tool run produced a generated audio attachment instead of timing out.

What was not tested: A 240-300 second live MiniMax track was not run to avoid additional provider spend. Telegram/channel delivery was not tested because this PR only changes the MiniMax music provider HTTP flow.

Verification

  • pnpm exec oxfmt --write --threads=1 extensions/minimax/music-generation-provider.ts extensions/minimax/music-generation-provider.test.ts
  • pnpm test extensions/minimax/music-generation-provider.test.ts
  • git diff --check
  • pnpm check:changed
  • Live MiniMax provider proof with durationSeconds=130, redacted logs
  • Live patched OpenClaw music_generate tool proof with durationSeconds=20, redacted logs

Out of Scope

  • Adding a new MiniMax polling endpoint path; a live probe of GET /v1/query/music_generation returned 404, so this PR uses the live-backed streaming contract instead.
  • Changing defaults or behavior for non-MiniMax music providers.
  • Channel delivery, Telegram posting, or generated media UX changes.

Made with Cursor

@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

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.

Summary
This PR changes bundled MiniMax music generation to request streaming hex output, decode streamed/audio frames into an MP3 asset, use a 300s operation deadline, and add provider tests for stream success, stream errors, terminal audio, and JSON fallback.

Reproducibility: no. independent live reproduction was performed in this read-only review. Source inspection confirms the provider-level direct POST used the 120s fallback when no runtime timeout reached it, and the linked issue plus PR body provide the observed timeout and after-fix live-run details.

PR rating
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Summary: Focused provider patch with useful live proof and tests; confidence is good, with some residual uncertainty around longest-duration MiniMax runs.

Rank-up moves:

  • Attach redacted raw provider/tool log excerpts if the existing real-behavior-proof check remains red or maintainers want stronger live evidence.
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.

Real behavior proof
Sufficient (logs): The PR body includes after-fix live MiniMax provider and music_generate tool runs with request duration, response type, byte count, and generated attachment result.

Risk before merge

  • The fix still uses one long-lived MiniMax streaming POST; the contributor reports the async polling endpoint returns 404, but a full 240-300s live track was not tested.
  • I did not independently rerun the paid MiniMax live scenario in this read-only review; the real-behavior proof comes from the PR body’s redacted live-run details.

Maintainer options:

  1. Decide the mitigation before merge
    Land the provider-local streaming fix after required checks if maintainers accept the documented streaming API as the supported MiniMax path; ask for redacted raw live logs only if the proof gate remains disputed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
No repair lane is needed because there are no blocking findings; the next action is maintainer review plus normal CI/proof-gate handling.

Security
Cleared: The diff stays inside the MiniMax provider HTTP path and does not add dependencies, scripts, credential surfaces, or broader network permissions.

Review details

Best possible solution:

Land the provider-local streaming fix after required checks if maintainers accept the documented streaming API as the supported MiniMax path; ask for redacted raw live logs only if the proof gate remains disputed.

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

No independent live reproduction was performed in this read-only review. Source inspection confirms the provider-level direct POST used the 120s fallback when no runtime timeout reached it, and the linked issue plus PR body provide the observed timeout and after-fix live-run details.

Is this the best way to solve the issue?

Yes, this looks like the best supported implementation path: MiniMax documents stream plus hex output for music generation, while the proposed polling endpoint is not in the docs and was reportedly 404 in a live probe. Keeping JSON/audio fallbacks also limits compatibility risk if MiniMax returns the older shape.

Label changes:

  • add P2: This is a normal-priority provider bug fix with limited blast radius to MiniMax music generation.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live MiniMax provider and music_generate tool runs with request duration, response type, byte count, and generated attachment result.
  • add rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🐚 platinum hermit, patch quality is 🐚 platinum hermit, and Focused provider patch with useful live proof and tests; confidence is good, with some residual uncertainty around longest-duration MiniMax runs.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body includes after-fix live MiniMax provider and music_generate tool runs with request duration, response type, byte count, and generated attachment result.

Label justifications:

  • P2: This is a normal-priority provider bug fix with limited blast radius to MiniMax music generation.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🐚 platinum hermit, patch quality is 🐚 platinum hermit, and Focused provider patch with useful live proof and tests; confidence is good, with some residual uncertainty around longest-duration MiniMax runs.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body includes after-fix live MiniMax provider and music_generate tool runs with request duration, response type, byte count, and generated attachment result.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live MiniMax provider and music_generate tool runs with request duration, response type, byte count, and generated attachment result.

What I checked:

  • Current main uses one direct MiniMax music request: The current provider posts to /v1/music_generation with output_format: "url" and timeoutMs: req.timeoutMs ?? DEFAULT_TIMEOUT_MS; DEFAULT_TIMEOUT_MS is 120000ms in the same file. (extensions/minimax/music-generation-provider.ts:193, 99c88629c336)
  • PR switches to documented streaming hex output: The patch adds stream: true, output_format: "hex", a readStreamingTrack() parser for event-stream/audio responses, and deadline-based request/download timeouts. (extensions/minimax/music-generation-provider.ts:117, e4e51bc38595)
  • MiniMax upstream contract supports stream plus hex: MiniMax’s official music OpenAPI exposes stream and output_format, says streaming only supports hex, and documents data.audio hex plus status 1/2 in the response schema.
  • Linked issue now has a live-backed PR note: The related issue discussion links this PR and says the contributor probed GET /v1/query/music_generation and got 404, then verified streaming with a 130s MiniMax provider run and a patched music_generate tool run.
  • Tests cover the new provider behavior: The PR adds focused tests for streaming chunks, stream failure propagation, terminal-only stream audio, and keeps the JSON URL fallback path. (extensions/minimax/music-generation-provider.test.ts:54, e4e51bc38595)
  • Feature history points to MiniMax provider area owners: Current local blame attributes the checked-out MiniMax music provider snapshot to Ayaan Zaidi; GitHub file history also shows recent MiniMax/provider timeout work by steipete and MiniMax portal music/video enablement by tars90percent. (extensions/minimax/music-generation-provider.ts:1, e5cd050e5116)

Likely related people:

  • steipete: GitHub file history shows recent provider HTTP retry/timeout refactors touching this MiniMax music provider path and adjacent provider-operation helpers. (role: recent area contributor; confidence: high; commits: ecdad948b541, 827b0de0ce74, 9f46e9cb8540; files: extensions/minimax/music-generation-provider.ts, extensions/minimax/video-generation-provider.ts, src/media-understanding/shared.ts)
  • tars90percent: The MiniMax portal music/video generation enablement commit appears in the same provider file history and is adjacent to this MiniMax music behavior. (role: adjacent MiniMax contributor; confidence: medium; commits: d5b6667823a4; files: extensions/minimax/music-generation-provider.ts, extensions/minimax/video-generation-provider.ts)
  • Ayaan Zaidi: Local blame for the checked-out MiniMax music provider snapshot points to this broad current-main commit, though the grafted history makes it a weaker routing signal. (role: current snapshot contributor; confidence: low; commits: e5cd050e5116; files: extensions/minimax/music-generation-provider.ts, extensions/minimax/music-generation-provider.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 99c88629c336.

@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 May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Cosmic Lint Imp

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: keeps receipts.
Image traits: location merge queue dock; accessory lint brush; palette amber, ink, and glacier blue; mood sleepy but ready; pose leaning over a miniature review desk; shell soft speckled shell; lighting gentle morning glow; background tiny shells and proof notes.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Cosmic Lint Imp in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@neeravmakwana

Copy link
Copy Markdown
Contributor Author

@clawsweeper hatch

@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper PR egg hatch requested.

I queued a comment sync for this PR. If the egg is hatchable, ClawSweeper will generate the image once and update the existing review comment.
Action: PR egg hatch queued (workflow sweep.yml, event repository_dispatch).
The ASCII egg stays as the fallback.

@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper could not hatch this PR egg yet.

Reason: there is no current durable ClawSweeper review record for this PR, so there is no PR egg state record to update.
Ask for @clawsweeper re-review first, then retry @clawsweeper hatch after the ClawSweeper review comment appears.

@Takhoffman

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 21, 2026
@clawsweeper

clawsweeper Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

🦞🔧
ClawSweeper automerge is enabled.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-05-21 01:58:43 UTC review queued e4e51bc38595 (queued)

@clawsweeper

clawsweeper Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper 🐠 reef update

Thanks for the work here. ClawSweeper could not write to the source branch, so it opened a replacement PR rather than letting the fix drift. attribution still points back here.

Why replacement: ClawSweeper could not update the source PR branch directly; GitHub did not grant sufficient push rights to the bot for that branch.
Replacement PR: #84764
Why close: this run explicitly closes the superseded source PR after the credited replacement PR is open, so review continues in one place.
Closing this source PR because this run explicitly enabled source-PR closeout.
The replacement PR keeps the contributor trail visible for review and changelog credit.
Co-author credit kept:

fish notes: model gpt-5.5, reasoning high; reviewed against cd49fa8.

@clawsweeper clawsweeper Bot closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge extensions: minimax 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: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] MiniMax music_generation provider: use async-task polling instead of single blocking HTTP request

2 participants