Add retry and artifact upload to overlay generation#1539
Open
justinegeffen wants to merge 2 commits into
Open
Conversation
The inline Python heredoc that calls the Anthropic API in generate-openapi-overlays.yml previously had no error handling. A 429, a 5xx, a connection timeout, or a malformed response left the workflow in a confusing half-done state: the base spec was copied and the comparison overlay was written to disk, but no claude-generated-overlays.md appeared and the draft PR was opened anyway with nothing for a reviewer to look at. Three improvements: 1. Retry transient Anthropic errors (RateLimitError, APIConnectionError, APITimeoutError, InternalServerError) up to 4 times with exponential backoff (10s, 20s, 40s). Non-retryable errors (e.g. 400 bad request) fail fast. 2. On final failure, write claude-generated-overlays.md as a stub explaining what happened and how to retry — so the draft PR carries visible evidence of the failure instead of a missing file. Mark the step continue-on-error so the draft PR still opens with the partial state (base spec, comparison, analysis JSON), which is more useful to a maintainer than nothing. 3. Always upload base spec + comparison overlay + analysis JSON + whatever claude-generated-overlays.md exists as a workflow artifact (14-day retention) so the run is debuggable even if the PR step skips. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for seqera-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Summary
Hardens the Claude API call in generate-openapi-overlays.yml so transient API failures don't leave the workflow run in a half-done state.
Problem
The inline Python heredoc that calls `anthropic.messages.create` had no error handling. A 429, a 5xx, a connection timeout, or a malformed response left:
Changes
Retry with backoff. Retries `RateLimitError`, `APIConnectionError`, `APITimeoutError`, and `InternalServerError` up to 4 attempts with exponential delays (10s → 20s → 40s). Non-retryable API errors (e.g. 400 Bad Request) fail fast.
Failure stub. On final failure, write `claude-generated-overlays.md` as a placeholder explaining what happened and how to retry. The draft PR still opens with the partial state (base spec, comparison overlay, analysis JSON), which is more useful to a maintainer than nothing.
Always-upload artifact. Add an `actions/upload-artifact` step that captures the base spec, comparison overlay, analysis JSON, and whatever `claude-generated-overlays.md` exists. 14-day retention. Runs whether the Claude call succeeded or failed.
Test plan
🤖 Generated with Claude Code