Skip to content

CLI: wait out a deploy's 502s for requests safe to repeat - #78

Merged
Adambomb210 merged 1 commit into
mainfrom
claude/cli-retry
Nov 13, 2026
Merged

Adambomb210 merged 1 commit into
mainfrom
claude/cli-retry

Conversation

@Adambomb210

Copy link
Copy Markdown
Collaborator

Part of zero-downtime deploys (with #76 and patchworklabsorg/infra#103, #104): the krater CLI waits out the moment a deploy switches releases.

  • A GET or an estimate (POST …/jobs/estimate) that gets 502, 503 or 504 from the proxy is retried after 1, 2, 4 and 8 s (about 15 s in all), with one "trying again" line on stderr.
  • Any request that couldn't connect at all is retried the same way: nothing reached Krater, so even a submit is safe to send again.
  • A submit or any other change that gets a 502 is never sent again. Krater may already have queued it before the proxy gave up. The docs say to check krater jobs first.
  • wait and logs -f keep their own longer patience on top.
  • run passes its injectable sleep to the client, so tests don't sleep for real.

Tests: new cli/tests/test_api_retry.py covers a read waiting out a deploy, the estimate, a submit not repeated after a 502, a refused connection repeated, giving up after 4 retries, and a 404 not retried. Two wait/logs -f tests were updated: the client now absorbs the 5xx and the refused connection first. All 170 CLI tests pass.

🤖 Generated with Claude Code

A deploy on weft used to give about 60 s of 502s, and even with blue/green there's a moment of switching.
The API client now tries a GET or an estimate again after 1, 2, 4 and 8 s when the proxy answers
502/503/504, and any request that couldn't connect (nothing reached Krater). A submit or other change that
gets a 502 is never sent again: Krater may already have queued it. `wait` and `logs -f` keep their own
longer patience on top. `run` passes its injectable sleep to the client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Adambomb210
Adambomb210 merged commit c61c315 into main Nov 13, 2026
12 checks passed
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.

1 participant