Skip to content

fix(release): read ffmpeg asset names from BtbN and back off on 429 - #102

Merged
AnnatarHe merged 2 commits into
mainfrom
claude/keen-euler-e2tse0
Dec 5, 2026
Merged

AnnatarHe merged 2 commits into
mainfrom
claude/keen-euler-e2tse0

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Release Snapshot has failed on main every night since 2026-11-28, and on every pull request, in scripts/stage-ffmpeg.ts.

  • Linux and Windows (404). BtbN's latest release keeps only the two newest release branches and dropped n9.0, which the script hard-coded. The asset names now come from the release's own checksums.sha256. SERIES (n9.1) stays the preferred pin; when BtbN drops it, the script stages the newest release series still published, never master, and warns in the log and the run summary. Every archive is checked against the digest the list gives.
  • macOS (429). Both macOS targets asked osxexperts.net at once and retried after 2 s and 4 s, inside the host's 5-second Retry-After. Archives on one host are now fetched one at a time; a 429, a 5xx or a stalled transfer backs off 5/15/45/90 s (or Retry-After if longer); a host is waited on for at most four minutes in total. A 404 is no longer retried.
  • Cache. RAWBACK_FFMPEG_CACHE_DIR keeps digest-pinned archives between runs. The snapshot workflow stores that directory with actions/cache (restore and save split, so a run that got some archives before a refusal keeps them). release.yml is unchanged: a published release always downloads.

The script keeps what it guaranteed before: LGPL static builds, a release series, version-pinned macOS URLs, the stall limit, the size and archive-signature checks, and a report of every failed host.

Still to come on this PR

The SHA-256 pins for the four macOS archives. They will be copied from this PR's first Release Snapshot run, which logs the digest of each download, and added in a follow-up commit. Until then the macOS archives are checked by size and signature only, as on main, and are not cached.

Testing

  • bun run check passes (809 tests, including the 25 new ones in test/stage-ffmpeg.test.ts).
  • bun run scripts/stage-ffmpeg.ts against the real hosts staged Linux x64, Linux arm64 and Windows x64 from n9.1, with digests matching checksums.sha256; the staged Linux ffmpeg -version reports n9.1 with no --enable-gpl.
  • Not run locally: the macOS downloads and bun run build:all. osxexperts.net refuses the machine this was developed on, so this PR's Release Snapshot run is the test for those.

Generated by Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ack off on 429

The Release Snapshot job failed for every target but one:

- BtbN's `latest` release dropped the n9.0 series, so the three hard-coded
  Linux and Windows URLs answered 404. The asset names now come from the
  release's own checksums.sha256. SERIES (n9.1) stays the preferred pin; when
  BtbN drops it, the newest release series still published is staged, never
  master, with a warning. Each archive is checked against the listed digest.
- osxexperts.net answered 429 because both macOS targets asked it at once and
  retried after 2 and 4 seconds, inside its 5-second Retry-After. Archives on
  one host are now fetched one at a time, a 429 waits out Retry-After with a
  5/15/45/90 second backoff, and a host is waited on for at most four minutes.
  A 404 is no longer retried.

RAWBACK_FFMPEG_CACHE_DIR keeps digest-pinned archives between runs, and the
snapshot workflow stores that directory with actions/cache.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014EpZRgCXueUSYRM2TSmhGd
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T09:53:14.447119Z 582b4aa New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The host-budget test listed the requests in the order the targets were
declared, but the two targets are staged concurrently and either can queue
first, which is what happened on the CI runner.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014EpZRgCXueUSYRM2TSmhGd

Copy link
Copy Markdown
Contributor Author

Status of the two failed checks on 245346a:

Build and Test — mine, fixed in 582b4aa. A new test listed requests in target order, but the two macOS targets are staged concurrently and either can reach the host first.

GoReleaser snapshot — the BtbN half is fixed; the macOS half is blocked upstream.

  • Linux x64, Linux arm64 and Windows x64 staged from n9.1, each matching the digest in BtbN's checksums.sha256. The cache restore step ran on the Checklane runner.
  • www.osxexperts.net now answers 404 for ffmpeg80intel.zip and ffmpeg711arm.zip once the 429s are waited out. The same runner pool downloaded ffmpeg80intel.zip at 06:18 UTC today (run 47488216017), and the site's home page was replaced with a "This site can't be reached" placeholder at about 09:12 UTC. So the pinned archives are gone at the source, at least for now; backoff and caching cannot fetch a file the host no longer serves.

main fails the same way, so this is not introduced here. The snapshot job stays red on this PR until the macOS archives have a source again, which needs a decision from the maintainer.


Generated by Claude Code

@shelltime

shelltime Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

☁️ Claude Code cloud · Fix FFmpeg staging in snapshot releases

Diagnosed and fixed the recurring Release Snapshot failures by hardening FFmpeg artifact staging, adding tests, and updating CI and developer documentation.

💰 Cost 🔢 Tokens ⏱️ Duration 🧠 Models 💬 Prompts ✏️ Lines
$18.67 27.1M 7h 14m (21m active) claude-fable-5-2, claude-haiku-5-5 1 +1475 / −244

27.1M tokens: 2.3K input · 139.3K output · 26.3M cache read · 590K cache write

📝 AI summary

Investigated the GoReleaser snapshot failure in the Release Snapshot workflow, tracing it to scripts/stage-ffmpeg.ts and validating upstream FFmpeg artifact behavior with repository inspection, shell commands, and web requests. The staging implementation was revised to handle the release assets used across the five supported Linux, Windows, and macOS targets more reliably and to provide actionable behavior when artifacts cannot be staged.

Added or updated coverage in test/stage-ffmpeg.test.ts, adjusted .github/workflows/release-snapshot.yml so snapshot CI uses the corrected staging flow, and documented the relevant release/development process in docs/development.md. A planning document was also created under /root/.claude/plans/ to capture the implementation approach.

View this session on ShellTime →

Updated 2026-12-05 11:39 UTC by ShellTime · totals for the whole session so far · the session page is visible to its owner

Comment thread scripts/stage-ffmpeg.ts
],
source: {
pinned: [
{ url: 'https://www.osxexperts.net/ffmpeg80intel.zip' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: none of the four macOS pinned archives carries a sha256, so the macOS cache never takes effect. pinned() sets cacheDir = archive.sha256 === undefined ? undefined : staging.cacheDir, so in production nothing is read from or written to RAWBACK_FFMPEG_CACHE_DIR. The cache directory stays empty, hashFiles(...) != '' is false, the Save step is skipped, and the snapshot build still fetches all four archives from osxexperts.net and can still hit the 429s this PR set out to avoid. This also contradicts docs/development.md, which says each archive has "its SHA-256 in the script". The tests pass only because they build pins with sha256 themselves. Fix: add the real digest to each of the four URLs (lines 106, 107, 117 and 118). Alternatively, fail loudly or log when a pinned archive has no digest.

Comment thread scripts/stage-ffmpeg.ts
// Written beside its final name and moved, so a run that is cancelled
// mid-copy cannot leave half an archive for the next one to find.
await mkdir(cacheDir, { recursive: true })
await copyFile(destination, `${kept}.partial`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (optional): writing the cache copy is not best-effort. mkdir, copyFile and rename run after a successful download and verification, so a full disk or unwritable RAWBACK_FFMPEG_CACHE_DIR makes the whole target fail even though the archive is good. Fix: wrap the cache write in try/catch, warn, and return fetched anyway.

Comment thread scripts/stage-ffmpeg.ts
}
const asked = Math.min(result.retryAfterSeconds ?? 0, RETRY_AFTER_CAP_SECONDS)
// Up to a fifth longer, so runs that were refused together do not return together.
return Math.max(backoff, asked) * (1 + jitter / 5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (optional): jitter is applied after the Retry-After cap. A host asking for 120s or more waits up to 144s, which is more than the documented RETRY_AFTER_CAP_SECONDS. Two such waits (288s) exceed HOST_BACKOFF_BUDGET_SECONDS (240), so the second wait is refused. The test only covers random: () => 0. Fix: apply the jitter to the backoff only, or cap after jittering.

Comment thread scripts/stage-ffmpeg.ts

/** Only the seconds form: an HTTP date would need this machine's clock to agree with the host's. */
export function parseRetryAfter(headers: string): number | undefined {
const values = [...headers.matchAll(/^retry-after:[ \t]*(\d+)[ \t]*\r?$/gim)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (optional): --dump-header with --location writes every hop's headers, and this takes the last Retry-After in the file. A Retry-After on an intermediate redirect response is taken as the final answer's. This only matters if a redirect hop sends the header and the final response does not. Fix: only read the final header block, the part after the last blank line.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 582b4aa943

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/stage-ffmpeg.ts
Comment on lines +106 to +107
{ url: 'https://www.osxexperts.net/ffmpeg80intel.zip' },
{ url: 'https://www.osxexperts.net/ffprobe80intel.zip' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add digest pins so the snapshot archive cache can operate

All four production macOS archives omit sha256, so pinned() unconditionally disables caching for them and pruneCache() removes any restored copies. Consequently, setting RAWBACK_FFMPEG_CACHE_DIR in Release Snapshot never saves or reuses an archive: every run still downloads all four files from the rate-limited host, contrary to the new workflow comments and development documentation. Populate the four digest pins before relying on the cache to reduce requests. AGENTS.md requires documentation to describe actual current behavior.

AGENTS.md reference: AGENTS.md:L127-L128

Useful? React with 👍 / 👎.

@AnnatarHe
AnnatarHe merged commit 98017a6 into main Dec 5, 2026
18 of 19 checks passed
@AnnatarHe
AnnatarHe deleted the claude/keen-euler-e2tse0 branch December 5, 2026 11:29
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.

2 participants