Add retry logic for transient GitHub API errors in live integration test#14799
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…e core mock Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…7fc6ca-f667-439e-8f7f-a9e9f7b783a8
There was a problem hiding this comment.
Pull request overview
Improves resilience of the js-integration-live-api workflow/tests by expanding transient GitHub API error detection and adding retry/backoff around live API file reads.
Changes:
- Extended
isTransientError()to treat “no server is currently available” GitHub API failures as transient. - Wrapped the live GitHub API file reader in
frontmatter_hash_github_api.test.cjswithwithRetry()using an exponential backoff configuration. - Added unit coverage confirming the new transient-error pattern is detected.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| actions/setup/js/frontmatter_hash_github_api.test.cjs | Adds retry wrapper + config for live API reads; injects global.core for retry logging. |
| actions/setup/js/error_recovery.test.cjs | Adds assertions that “no server is currently available” is treated as transient. |
| actions/setup/js/error_recovery.cjs | Adds the new transient error substring pattern to isTransientError(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Retry configuration for live API tests | ||
| const LIVE_API_RETRY_CONFIG = { | ||
| maxRetries: 3, | ||
| initialDelayMs: 1000, |
There was a problem hiding this comment.
LIVE_API_RETRY_CONFIG.initialDelayMs is likely not the actual delay before the first retry with the current withRetry implementation: withRetry multiplies delay at the end of the first failure, so the first retry sleeps initialDelayMs * backoffMultiplier (default 2). If the intent is a 1s first backoff, either pass backoffMultiplier: 1 / adjust initialDelayMs, or change withRetry to increase the delay after sleeping so initialDelayMs is honored for the first retry.
| initialDelayMs: 1000, | |
| initialDelayMs: 1000, | |
| backoffMultiplier: 1, |
| beforeAll(() => { | ||
| // Mock @actions/core for retry logging in test environment | ||
| global.core = { | ||
| info: vi.fn((...args) => console.log(...args)), | ||
| warning: vi.fn((...args) => console.warn(...args)), |
There was a problem hiding this comment.
This test sets global.core in beforeAll but never restores the previous value. Since Vitest may execute multiple test files in the same worker, this can leak logging mocks into other suites. Please save the prior global.core value and restore it in an afterAll/afterEach (or delete global.core if it was unset).
* updated pins * [WIP] Fix integration tests for updated pins (#14791) * Initial plan * Initial plan for fixing integration tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Update integration tests with new action pins Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * [WIP] Fix failing GitHub Actions workflow Integration: Workflow Compiler (#14792) * Initial plan * Update action pin SHAs in runtime integration tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * [WIP] Fix failing GitHub Actions workflow runtime and setup (#14796) * Initial plan * Fix TestRuntimeSetupIntegration by updating setup-node SHA Update the test expectation to use the current SHA for actions/setup-node@v6.2.0 (6044e13b5dc448c55e2357c09f80417699197238) instead of the outdated SHA (395ad3262231945c25e8478fd5baf05154b1d79f). The action_pins.json file was recently updated with newer action SHAs, and this test needed to be synchronized. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Add retry logic for transient GitHub API errors in live integration test (#14799) * Initial plan * Add retry logic for transient GitHub API errors in frontmatter hash test Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Address code review feedback: extract retry config constants and scope core mock Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
The
js-integration-live-apiworkflow was failing on transient GitHub API errors:"No server is currently available to service your request". These errors should be retried automatically.Changes
Extended transient error detection (
error_recovery.cjs)isTransientError()Wrapped API calls with retry logic (
frontmatter_hash_github_api.test.cjs)createRetryableFileReader()wrapper with 3 retries, 1s initial delay, exponential backoffAdded test coverage (
error_recovery.test.cjs)The test now handles temporary GitHub API unavailability without masking real failures.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.