Repository navigation
fix(musicgen): poll slow tracks; re-sign when the poll refuses the POST payment - #195
Merged
Merged
Conversation
The gateway answers a track that outruns its inline window with 202 + poll_url and settles on the first completed poll. MusicGen read the 202 body as the result and failed with "No track URL returned from API" on every slow track, on every chain. It now polls with the shared pollImageJob, like ImageGen. On Arc the first poll was also refused: the music POST signs a 300s requirement and the poll verifies against 600s, which Circle rejects as invalid_payment_requirements. When a poll refuses the POST authorization, MusicGen signs the poll's own 402 challenge (the gateway documents that a fresh signature from the same wallet works). The job settles once, so this cannot double-charge. Verified live on Arc: a 79s track, charged $0.1585 once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while testing every Arc payment path live.
Bug 1, all chains: for a track that outruns the inline window, the gateway answers
202+poll_urland charges nothing until a poll completes. MusicGen treated that202body as the final result and failed withNo track URL returned from API. It now polls using the sharedpollImageJob, the same way ImageGen does.Bug 2, Arc: the first poll was refused with
402 invalid_payment_requirements. The music POST signs a requirement withmaxTimeoutSeconds: 300, but the poll checks against 600, and Circle's facilitator rejects the mismatch. When a poll refuses the POST's authorization, MusicGen fetches the poll's own 402 challenge and signs that instead; the gateway documents that a fresh signature from the same wallet works. The job settles once, so this can't double-charge. The branch is gated onwalletMayPay, like every other signer. The root fix belongs in the gateway (the music POST should use 600, as the image routes do); that's a separate PR.Tests
local.mjs: a202job is polled throughin_progressto completion and the track is saved. Without the fix, this fails with the same error as the live run.arc.local.mjs: replays the live Arc sequence (POST paid at 300s, poll refuses it, poll's own challenge signed fresh with Arc'sUSDCdomain, track saved).npm test: 796 pass.Live on Arc: a 79s, 256 kbps MP3 was generated. The balance fell by exactly $0.1585 (one charge); settlement tx
0x536b3fb9….🤖 Generated with Claude Code