Repository navigation
Retry rate-limited workflow metadata reads - #76351
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| async function readRemoteMarkdownMetadata(githubClient, identity) { | ||
| if (!githubClient?.rest?.repos?.getContent) throw new Error("Compiler Markdown metadata requires the source repository's GitHub client"); | ||
| const { data } = await githubClient.rest.repos.getContent(identity); | ||
| const { data } = await withRetry(() => githubClient.rest.repos.getContent(identity), MARKDOWN_METADATA_RETRY_CONFIG, `read compiler Markdown metadata for ${identity.owner}/${identity.repo}`); |
There was a problem hiding this comment.
Already implemented in 7e5d5b5: the metadata fetch uses withRetry with RATE_LIMIT_RETRY_CONFIG, restricted to isRateLimitError. Authorization failures are not retried. Revalidated all 133 targeted tests; no additional changes needed.
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
The retry implementation is narrowly scoped and the rate-limit regression test is useful. I found one compatibility concern: remote metadata failures are now wrapped by withRetry, which drops the original Octokit status/response fields unless callers unwrap originalError; please preserve or document that error contract.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| async function readRemoteMarkdownMetadata(githubClient, identity) { | ||
| if (!githubClient?.rest?.repos?.getContent) throw new Error("Compiler Markdown metadata requires the source repository's GitHub client"); | ||
| const { data } = await githubClient.rest.repos.getContent(identity); | ||
| const { data } = await withRetry(() => githubClient.rest.repos.getContent(identity), MARKDOWN_METADATA_RETRY_CONFIG, `read compiler Markdown metadata for ${identity.owner}/${identity.repo}`); |
There was a problem hiding this comment.
Wrapping this fetch in withRetry changes every non-rate-limit failure from the original Octokit error into a new Error without its status/response fields, so callers can no longer classify authorization or not-found failures directly.
💡 Preserve the error contract while adding retries
withRetry's enhanceError stores the underlying exception only as originalError; code handling loadMarkdownMetadata failures therefore needs a new, undocumented unwrapping path. Either preserve the original error properties when rethrowing non-retryable failures or add an explicit compatibility wrapper/contract and regression coverage for status and response fields.
There was a problem hiding this comment.
I now rethrow the original GitHub error from the retry wrapper, preserving its status and response fields; the regression test asserts the original error identity. Fixed in 9cf4be0.
There was a problem hiding this comment.
🟡 Changes recommended
The new import references dependencies missing from the embedded metadata bundle, causing MODULE_NOT_FOUND at load time and failing the dependency-inclusion test.
1 open issue
What changed in this PR
This PR adds bounded retries for rate-limited workflow metadata reads, addressing the activation failure reported in #76350 while preserving fail-closed behavior for other errors.
Changes:
- Reuse the existing backoff policy with a rate-limit-only retry predicate.
- Add regression coverage for rate-limit recovery and authorization failures without retries.
- Separately allow expressions in the workflow schema’s job-level
servicesfield.
| File | Description |
|---|---|
pkg/workflow/schemas/github-workflow.json |
Allow expressions as job-level service definitions. |
actions/setup/js/markdown_metadata.cjs |
Retry remote metadata reads on rate-limit errors. |
actions/setup/js/markdown_metadata_sources.test.cjs |
Verify recovery and preserve authorization-failure coverage. |
actions/setup/js/error_recovery.cjs |
Export the rate-limit error predicate. |
Review effort: Balanced (auto)
| const { createHash } = require("node:crypto"); | ||
| const { isDeepStrictEqual } = require("node:util"); | ||
| const { parseLockFileHeaders, parseMarkdownJSON } = require("./lock_file_headers.cjs"); | ||
| const { withRetry, RATE_LIMIT_RETRY_CONFIG, isRateLimitError } = require("./error_recovery.cjs"); |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /codebase-design. Requesting changes: the Go embed test fails, and the retry changes need a decision on budget and error shape.
📋 Key Themes & Highlights
Key Themes
- Blocking:
TestSessionParserSourcesIncludeLocalDependenciesfails becauseerror_recovery.cjsandgithub_rate_limit_logger.cjsare not in thego:embedlist. - Retry budget: about 11.5 minutes worst case on the activation path.
- Error shape: non-retryable failures lose
.status. - Scope: the
servicesschema change is unrelated to the PR.
Positive Highlights
- ✅ Retries are narrowed to
isRateLimitError, so authorization failures still fail closed. The existing 403 test asserts a single call. - ✅ The rate-limit test uses fake timers and checks both the retry count and the decoded result.
Verification
- Go embed test: fails on this PR; passes with the embed fix above (temporary edit reverted).
- Retry paths: exercised directly in Node. A rate-limit error retries and succeeds, and a plain 403 is not retried.
- Vitest was not run:
npm cifailed on a sandbox TLS certificate, so the changed JS test file is unverified.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| const { isDeepStrictEqual } = require("node:util"); | ||
| const { parseLockFileHeaders, parseMarkdownJSON } = require("./lock_file_headers.cjs"); | ||
| const { withRetry, RATE_LIMIT_RETRY_CONFIG, isRateLimitError } = require("./error_recovery.cjs"); | ||
| const MARKDOWN_METADATA_RETRY_CONFIG = { ...RATE_LIMIT_RETRY_CONFIG, shouldRetry: isRateLimitError }; |
There was a problem hiding this comment.
[/codebase-design] Worst-case activation delay: RATE_LIMIT_RETRY_CONFIG backs off about 30 s, 60 s, 120 s, 240 s, then 240 s. That is roughly 11.5 minutes plus up to 25 s of jitter before the error surfaces. Metadata reads run on the activation path, so confirm that budget is acceptable or use a shorter dedicated config.
💡 Why it matters
A persistent rate limit would hold activation for the full budget before failing. A smaller maxRetries or maxDelayMs for metadata reads fails faster while still covering short bursts. Either way, record the choice in a comment on the constant.
@copilot please address this.
There was a problem hiding this comment.
Metadata reads now use a dedicated two-retry configuration capped at 60 seconds per delay, limiting activation wait to about 90 seconds plus jitter. Fixed in 9cf4be0.
| async function readRemoteMarkdownMetadata(githubClient, identity) { | ||
| if (!githubClient?.rest?.repos?.getContent) throw new Error("Compiler Markdown metadata requires the source repository's GitHub client"); | ||
| const { data } = await githubClient.rest.repos.getContent(identity); | ||
| const { data } = await withRetry(() => githubClient.rest.repos.getContent(identity), MARKDOWN_METADATA_RETRY_CONFIG, `read compiler Markdown metadata for ${identity.owner}/${identity.repo}`); |
There was a problem hiding this comment.
[/codebase-design] withRetry rethrows non-retryable failures as a new Error, so callers lose .status and .response. The updated 403 test now asserts originalError instead of the raw error. No current caller reads those fields, but this is a contract change for readRemoteMarkdownMetadata.
💡 Suggested fix
Either document in the JSDoc that failures surface as a wrapped error with originalError, or unwrap originalError where a caller needs the HTTP status. Keep the fail-closed behavior either way.
@copilot please address this.
There was a problem hiding this comment.
Non-retryable and exhausted retry failures now surface the original GitHub error, preserving .status and .response. Fixed in 9cf4be0.
| "additionalProperties": { | ||
| "$ref": "#/definitions/serviceContainer" | ||
| } | ||
| "oneOf": [ |
There was a problem hiding this comment.
[/codebase-design] This services schema change (oneOf with stringContainingExpressionSyntax) is unrelated to the rate-limit fix. The PR body does not mention it, and no test covers it.
💡 Suggested fix
Split it into its own PR with a schema test. Or explain in the PR body why it belongs here, and add a test that accepts an expression-valued services while still rejecting invalid service objects.
@copilot please address this.
There was a problem hiding this comment.
Reverted the unrelated services schema change from this PR. Fixed in 9cf4be0.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "28b4539c8afb18b09b7fee941ad99a8b0482af79",
"kind": "requested",
"schema_version": "1",
"state": "16fbf483b2103eb5867749960d9388855d98748606843ab97aa1d9aa8cf3bfb3",
"work": [
"2ad3e65430d3ca23ada106b0373c69b51707aec7ddea5850f57eaa99986d138b",
"34c1ecd9979e4e0c3875185c5e9607f4fc66d3c1e04c5db2b6fc0b13fb4a6e04",
"51b3de970dc2b2b252976c8c5174d5acdb6bfcb2fb25128b46eece398bd5b526",
"9fdae164312f9fa22c3db934f2bf4b83ce3a153bf958d31205aaf732e8849d8f",
"d084978b48952552b133df976459b496952c04f8d4a327d109142bb87080418d"
],
"workflow": "pr-sous-chef"
}
|
…odex-workflows-to-copilot Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |

Issue Arborist activation failed when fetching immutable workflow metadata received a GitHub installation API rate-limit response. The failed fetch stopped initialization before the agent started.
Rate-limit handling
Regression coverage