fix(release): unblock dcode-ai publish when a platform is rate limited#46
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe npm publish helper now retries rate-limited publishes without throwing, while the script tracks failed platform and wrapper packages, preserves dependency versions, and reports whether a re-run is required. Changesnpm publish resilience
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant PublishScript
participant npm
participant npmRegistry
PublishScript->>npm: Publish platform or wrapper package
npm->>npmRegistry: Submit package
npmRegistry-->>npm: Return success or E429
npm-->>PublishScript: Return result and retry-after output
PublishScript->>npm: Retry failed rate-limited package
PublishScript-->>PublishScript: Record failures and determine exit status
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/opencode/script/publish.ts`:
- Around line 156-163: Update the dry-run handling around the failures check so
non-empty failures are reported and cause a non-zero exit before printing “dry
run complete.” Preserve the existing success message only when failures is
empty, and ensure both dry-run and publish modes use the failure path
consistently.
- Line 89: Update the fallback delay calculation near parseRetryAfter so it uses
capped exponential backoff instead of attempt * 90_000. Preserve the parsed
Retry-After value when available and cap only the calculated fallback at 300,000
milliseconds.
- Around line 71-74: Update publish so the alreadyPublished(name) registry
preflight handles rejected promises by logging the failure and returning false,
rather than allowing the rejection to escape. Preserve the existing
skip-and-true behavior when the package is already published, and ensure the
failure collector can continue to the wrapper path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 71b6fc88-7b12-4dfa-9fee-af337a8eed3a
📒 Files selected for processing (1)
packages/opencode/script/publish.ts
Address review: publish dcode-ai wrapper before per-platform binaries so a rate limit/timeout never leaves it unpublished; stop alreadyPublished from throwing; treat 'cannot publish over' as success; capped exponential backoff with a Retry-After:0 guard; broaden 429 detection; fail dry-run on any failure.
|
Addressed all review findings (CodeRabbit + our independent reviewer) in 06145e7:
The red |
Issue
npm i -g dcode-ai404s: thedcode-aiwrapper was never published. Everypublish-npmrun fails on the 184MBdcode-ai-windows-x64binary with npmE429(publish rate limit —as user undefinedis npm's rate-limit wording, not an auth failure; 5 of 7 platform packages publish fine with the token).Root cause:
publish.tsis sequential + fail-fast, and the user-facing wrapper publishes last. One throttled platform throws and aborts the run before the wrapper is ever published, so nothing is installable.Registry state confirms it:
dcode-ai-{darwin-arm64,darwin-x64,linux-x64,windows-arm64}@1.0.1are live; onlydcode-ai-windows-x64and thedcode-aiwrapper are missing.Type of change
What changed
publish()no longer throws; it returns success/failure and collects failures.optionalDependenciesat the target version. npm resolves only the current platform's optional dep at install time, so listing a still-rate-limited platform is harmless and self-heals when a re-run publishes it.Retry-Afterwhen present, 8 attempts, capped exponential backoff.Verification
bun typecheck— 30/30 pass.publish.ts.Notes
npm publishscript; validation is the publish workflow itself. A dispatch (dry-run then real) is the next step after merge.dcode-aiis installable in the meantime, and a re-run backfills the platform.Summary by CodeRabbit
New Features
Bug Fixes