ci(cmux-next): DEV publish retries a release call the rate limit refused
Problem. This follows up cmux#25476. In 40350641729, the first publisher run on main after #25476, the new budget pre-check passed (30 or more calls left). The asset upload one second later was refused anyway: HTTP 403: API rate limit exceeded for installation. Other workflows spend the shared GITHUB_TOKEN budget between the check and the write, so a pre-check alone can't keep the release writes from failing. The release writes need contents: write, and in this job only GITHUB_TOKEN has that.
Change (publish job only): a ghw function wraps every gh call in the publish step: release view, compare, create, upload and edit. If a call is refused for the rate limit, ghw waits for the reset and runs the call again: at most 3 tries and at most an hour of waiting in the step, tracked in one ledger file so subshells count too. Each wait logs a notice on stderr, so captured output stays clean. Any other failure fails the step as before. A refused request did nothing on GitHub's side, so retrying a write is safe. The pre-check stays. The job timeout is already 75 minutes (#25476).
This also closes an existing hole. Before, a rate-limited release view inside not_newer read as "no published commit" and skipped the rollback check.
Trust. No token, permission, environment or secret change.
Test. tests/test_cmux_next_dev_daily_dispatch.py now requires ghw on create, upload, edit and the compare, and refuses a bare gh release upload|edit|create. I also ran a local stub check: a rate-limited call retries and then succeeds with clean stdout, and a non-rate-limit failure returns its exit code without retrying.
Risk. Low. It touches only the publish step's shell.
Agent session: agent session
🤖 Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
- Bug Fixes
- Release publishing now retries up to three times after API rate-limit responses, waiting for the reported reset time plus five seconds or 60 seconds when reset timing is unavailable.
- Retry waits are limited to one hour in total. Publishing returns an error if another attempt is refused, a different error occurs, or no retry wait time remains.
- Release notes and assets continue through the existing publishing flow when uploads and updates succeed.