Skip to content

add retry logic for transient GitHub API errors during PR creation (Issue #1478)#1479

Open
konard wants to merge 5 commits into
mainfrom
issue-1478-5fc2faa92a88
Open

add retry logic for transient GitHub API errors during PR creation (Issue #1478)#1479
konard wants to merge 5 commits into
mainfrom
issue-1478-5fc2faa92a88

Conversation

@konard

@konard konard commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1478

The gh pr create command in solve.auto-pr.lib.mjs could fail with transient GitHub server errors (e.g., "Something went wrong while executing your query") during service disruptions, causing the entire solve session to abort without any retry attempt.

Root Cause

On 2026-03-24, a confirmed GitHub service disruption caused the gh pr create GraphQL mutation to return a 500-class error. The Cyrillic characters in the PR title ("update враг снайпер") were initially suspected but ruled out — GitHub's API fully supports UTF-8/Cyrillic in PR titles.

The code already had retry logic for:

  • Compare API eventual consistency (lines 571-624)
  • PR verification eventual consistency (lines 1206-1259)

But the gh pr create command itself had no retry logic for transient server errors.

Changes

  • src/solve.auto-pr.lib.mjs: Added retry loop with exponential backoff (3 attempts, 5s/10s/15s delays) for transient GitHub API errors during PR creation. Non-transient errors (auth, validation, "No commits between") still fail immediately.
  • tests/test-pr-creation-retry-1478.mjs: 24 tests covering transient error detection, retry behavior, backoff timing, and the original bug scenario.
  • docs/case-studies/issue-1478/: Full root cause analysis with timeline, evidence, and references to GitHub status page and cli/cli issues.
  • .changeset/pr-creation-retry-1478.md: Changeset for patch release.

Test plan

  • All 24 new tests pass (node tests/test-pr-creation-retry-1478.mjs)
  • Transient errors (GraphQL 500, 502, 503, 504, network errors) are correctly detected
  • Non-transient errors (auth, validation) are NOT retried
  • Retry backoff follows correct timing (5s, 10s, 15s)
  • Original bug scenario (exact error message from issue) triggers retry and succeeds

🤖 Generated with Claude Code

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #1478
@konard konard self-assigned this Mar 25, 2026
konard and others added 3 commits March 25, 2026 09:50
…ssue #1478)

The `gh pr create` command could fail with transient GitHub server errors
(e.g., "Something went wrong while executing your query") during GitHub
service disruptions. The code had no retry mechanism for these errors,
causing immediate failure. This adds exponential backoff retry (up to 3
attempts with 5s/10s/15s delays) for transient server errors, following
the same pattern used for compare API and PR verification retries.
Also adds case study documentation with root cause analysis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
24 tests covering:
- Transient error detection (GraphQL errors, 502/503/504, network errors)
- Non-transient error exclusion (auth, validation, permissions)
- Retry logic with exponential backoff (5s, 10s, 15s)
- Original bug scenario reproduction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] PR creation failed: GraphQL: Something went wrong while executing your query on 2026-03-24T20:09:47Z. Please include C494:160A:1899070D:156DE0AF:69C2EF89 when reporting this issue. add retry logic for transient GitHub API errors during PR creation (Issue #1478) Mar 25, 2026
@konard
konard marked this pull request as ready for review March 25, 2026 09:53
@konard

konard commented Mar 25, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.537043
  • Calculated by Anthropic: $2.980201 USD
  • Difference: $-0.556842 (-15.74%)

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (1592KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Mar 25, 2026

Copy link
Copy Markdown
Contributor Author

✅ Ready to merge

This pull request is now ready to be merged:

  • CI workflows exist but were not triggered for this commit
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

konard added a commit that referenced this pull request Mar 25, 2026
21 tests covering:
- Exact PR #1479 false positive scenario reproduction
- Grace period boundary conditions (0s, 119s, 120s, 300s)
- Null commit date edge case
- Workflow file PR trigger parsing patterns
- Backward compatibility with issue #1466 (action_required)
- End-to-end scenarios (fork PRs, paths-ignore, schedule-only)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
konard added a commit that referenced this pull request Mar 26, 2026
Downloaded PR #1479 details including statusCheckRollup (confirms lint and
check-file-line-limits failures at 09:56:11, CI started at 09:55:18),
PR comments showing the false positive "Ready to merge" timeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant