ci: make crates.io publish idempotent and retry index lag#735
Merged
Conversation
The publish job ran six `cargo publish` commands unguarded under `set -e`.
Two failure modes broke it:
1. Partial release: if a later crate fails, the already-uploaded crates
can't be re-published — a re-dispatch aborts immediately on the first
`cargo publish` ("crate version already uploaded").
2. Index lag: a dependent crate (e.g. icx -> ic-utils) can fail to
resolve a just-uploaded dependency until the crates.io index catches
up, which can take a minute or two.
Both hit the 0.48.0 release: ic-transport-types, ic-agent, ic-identity-hsm,
and ic-utils published, then `icx` failed to resolve `ic-utils = ^0.48.0`
because the index hadn't surfaced it yet.
Wrap each publish in a helper that treats "already uploaded/exists" as
success (idempotent re-runs) and retries other failures up to 6x with a
30s backoff (rides out index lag). Re-dispatching now finishes icx and
icx-cert without re-publishing the four crates already live.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
✅ No security or compliance issues detected. Reviewed everything up to 72f7710. Security Overview
Detected Code Changes
|
There was a problem hiding this comment.
Pull request overview
This PR updates the crates.io publish GitHub Actions workflow to be resilient to partial publishes and crates.io index lag by making publishing idempotent and adding retry/backoff behavior.
Changes:
- Add a
publish()helper that treats “already uploaded/exists” as success to allow safe re-dispatch after partial releases. - Retry failed publishes up to 6 times with a 30s backoff to tolerate crates.io index propagation delays.
- Keep publish order dependency-first to reduce resolution failures between crates.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Don't sleep 30s after the last attempt fails — it only delayed the job's failure. Gate the backoff on there being another attempt to come, and include attempt count in the messages. Addresses Copilot review feedback on #735. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
raymondk
approved these changes
Jul 5, 2026
raymondk
approved these changes
Jul 5, 2026
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.
What
Make the Publish to crates.io workflow idempotent and resilient to crates.io index lag.
Why — the 0.48.0 release half-failed
The publish job ran six
cargo publishcommands unguarded underset -e. During the 0.48.0 release (run):ic-transport-types,ic-agent,ic-identity-hsm,ic-utilsuploaded 0.48.0cargo publish -p icxthen failed:failed to select a version for the requirement ic-utils = "^0.48.0"—ic-utils 0.48.0had been uploaded ~60s earlier but hadn't yet appeared in the crates.io index (cargo's built-in wait timed out, then the resolve hard-failed).icx-certnever ran.Two brittleness sources:
cargo publish -p ic-transport-typesnow errors with "crate version already uploaded" andset -ekills the step.Fix
Wrap each publish in a helper that:
Order (dependencies before dependents) is unchanged.
Rollout
The Identity team's blocker is already resolved —
ic-agent 0.48.0andic-transport-types 0.48.0are live. After merging this, re-dispatch the workflow: it will skip the four published crates and publishicx+icx-cert(both currently still at 0.47.3).