Skip to content

Add retry and artifact upload to overlay generation#1539

Open
justinegeffen wants to merge 2 commits into
masterfrom
justine-overlay-error-handling
Open

Add retry and artifact upload to overlay generation#1539
justinegeffen wants to merge 2 commits into
masterfrom
justine-overlay-error-handling

Conversation

@justinegeffen

Copy link
Copy Markdown
Contributor

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:

  • The base spec copied and committed to disk
  • The comparison overlay written to disk
  • No `claude-generated-overlays.md` produced
  • The draft PR opened anyway with nothing for a reviewer to look at

Changes

  1. 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.

  2. 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.

  3. 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

  • Sanity: dispatch the workflow with a known-good API version and confirm the artifact appears and contains the expected files.
  • Failure simulation: temporarily set `ANTHROPIC_API_KEY` to an invalid value on a test run. Confirm the failure stub is written, the workflow run is marked as failed, the draft PR still opens, and the artifact is uploaded.

🤖 Generated with Claude Code

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>
@netlify

netlify Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploy Preview for seqera-docs ready!

Name Link
🔨 Latest commit 5a8ccb8
🔍 Latest deploy log https://app.netlify.com/projects/seqera-docs/deploys/6a2718d6b59e470008c256a2
😎 Deploy Preview https://deploy-preview-1539--seqera-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@justinegeffen justinegeffen added the 1. Dev/PM/SME Needs a review by a Dev/PM/SME label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Dev/PM/SME Needs a review by a Dev/PM/SME

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant