Skip to content

fix: support music covers and surface stream errors#197

Merged
NianJiuZst merged 1 commit into
mainfrom
codex/fix-music-sdk-cover-stream-errors
Jul 15, 2026
Merged

fix: support music covers and surface stream errors#197
NianJiuZst merged 1 commit into
mainfrom
codex/fix-music-sdk-cover-stream-errors

Conversation

@NianJiuZst

Copy link
Copy Markdown
Collaborator

What

  • accept the official music-cover and music-cover-free models in sdk.music.generate()
  • validate cover-specific prompt, lyrics, and reference-audio constraints separately from text-to-music generation
  • support both one-step covers (audio_url / audio_base64) and two-step covers (cover_feature_id + replacement lyrics)
  • make the shared audio stream decoder propagate API/business errors and malformed payloads instead of returning an empty successful stream
  • preserve audio carried by the terminal status: 2 stream event and validate streamed hex data
  • document SDK cover usage and add regression coverage

Why

This is a follow-up to #196. The CLI gained the current music models and cover workflow, but the SDK still validated every request as text-to-music generation. As a result, it rejected both official cover models and incorrectly required lyrics for one-step covers.

The shared streaming decoder also skipped JSON parse failures, API error payloads, and terminal frames. A 200 application/json response containing a non-zero base_resp.status_code could therefore finish as a zero-byte “success”.

Impact

  • SDK users can call both official cover models through the existing music generation endpoint.
  • Invalid cover combinations fail locally with actionable usage errors.
  • Music CLI and SDK streaming paths now fail closed on API errors, malformed chunks, invalid hex, and streams with no audio.
  • A non-SSE JSON success containing hex audio is decoded as a safe fallback.

Validation

  • bun test — 400 pass, 0 fail
  • bun run typecheck
  • bun run build:dev
  • bun run lint — 0 errors; 4 pre-existing warnings outside the changed files
  • targeted ESLint on changed TypeScript files — clean
  • git diff --check

@NianJiuZst NianJiuZst marked this pull request as ready for review July 15, 2026 06:08
@NianJiuZst NianJiuZst merged commit 366d6e4 into main Jul 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant