Repository navigation
fix(opencode): retry npm publish and skip the main dist manifest - #159
Merged
Merged
Conversation
A release publishes 13 packages concurrently, each a 40-60MB tarball, and the registry regularly times one of them out mid-upload with FETCH_ERROR — aborting the whole release. Retry each publish up to 5 times with linear backoff, and treat a version that appears on the registry after a failed attempt as published, since a timed-out request can still land. Resuming a release (`release --skip-build`) also scanned the main package directory that a previous run generated under dist/, which put codev-code into its own optionalDependencies. Skip that directory when collecting the platform manifests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Why
bun releasefor 1.18.4-5 died partway through with:publish.tsfans all 13 packages out throughPromise.alland every tarball is 40–60MB, so ~640MB of concurrent uploads regularly times one of them out and takes the whole release down with it. Nothing had been published at that point, so the release had to be redone from scratch.What
Retry each
npm publishup to 5 times with linear backoff (10s, 20s, 30s, 40s). After a failed attempt it re-checks the registry before retrying — a timed-out request can still have landed the version, and a blind retry would then fail with "cannot publish over existing version". After 5 attempts it throws naming the package.Skip the main package directory when scanning dist manifests. Found while verifying the above.
publish.tsglobsdist/*/package.jsonto buildoptionalDependencies, and on a re-run that glob picks up thedist/opencodemain-package directory generated by the previous run — socodev-codeends up depending on itself. A fresh build never hits it;release --skip-build(exactly the resume-a-failed-release path this PR exists to support) does. Fixed in the same commit for that reason.Verification
bun typecheckinpackages/opencode— clean.publish.tsagainst the already-published 1.18.4-5dist/: all 13 packages hit thealready publishedearly return, nothing was published, and the regenerateddist/opencode/package.jsonhas 12 optionalDependencies with no self-reference (13 with the self-reference before the fix).codev-code@1.18.4-5on npm is unaffected — it was published from a correct manifest and still lists 12 binaries.DIVERGENCES.mdrow forpackages/opencode/script/publish.tsupdated in the same commit. NoCHANGELOG.mdentry — release tooling, no documented behavior change.Note
Retry is a safety net, not a cure: the uploads still run concurrently, so the retries fire into the same saturated uplink and the first attempts will likely still fail. Serializing the uploads is what actually avoided timeouts when re-releasing 1.18.4-5 by hand. Worth a follow-up.
🤖 Generated with Claude Code