Skip to content

Retry rate-limited workflow metadata reads - #76351

Merged
pelikhan merged 5 commits into
mainfrom
copilot/copilotmove-codex-workflows-to-copilot
Nov 10, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/copilotmove-codex-workflows-to-copilot

Conversation

Copilot AI commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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

    • Retry remote metadata reads using the existing bounded backoff policy, restricted to confirmed rate-limit errors.
    • Preserve fail-closed behavior for authorization failures and other non-rate-limit errors.
    const retryConfig = { ...RATE_LIMIT_RETRY_CONFIG, shouldRetry: isRateLimitError };
    await withRetry(() => githubClient.rest.repos.getContent(identity), retryConfig, operation);
  • Regression coverage

    • Verify rate-limit recovery succeeds on retry and ordinary authorization failures are not retried.

Copilot AI linked an issue Nov 10, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits November 10, 2026 00:50
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix activation failure for issue Arborist Retry rate-limited workflow metadata reads Nov 10, 2026
Copilot AI requested a review from pelikhan November 10, 2026 00:52
Comment thread actions/setup/js/markdown_metadata.cjs Outdated
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}`);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use withRetry

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pelikhan
pelikhan marked this pull request as ready for review November 10, 2026 02:17
Copilot AI adaptive review requested due to automatic review settings November 10, 2026 02:17
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

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.

Generated from PR Specification Reviewer · gpt56 · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76351

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

Generated from PR Code Quality Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗️ · routed: sonnet55 high · ~6 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76351

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-10T02:20:50Z
review_event: COMMENT
top_themes: [error contract compatibility]
files_reviewed: [actions/setup/js/error_recovery.cjs, actions/setup/js/markdown_metadata.cjs, actions/setup/js/markdown_metadata_sources.test.cjs, pkg/workflow/schemas/github-workflow.json]
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread actions/setup/js/markdown_metadata.cjs Outdated
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}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 services field.
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");

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: TestSessionParserSourcesIncludeLocalDependencies fails because error_recovery.cjs and github_rate_limit_logger.cjs are not in the go:embed list.
  • Retry budget: about 11.5 minutes worst case on the activation path.
  • Error shape: non-retryable failures lose .status.
  • Scope: the services schema 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 ci failed 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

Comment thread actions/setup/js/markdown_metadata.cjs Resolved
Comment thread actions/setup/js/markdown_metadata.cjs Outdated
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 };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread actions/setup/js/markdown_metadata.cjs Outdated
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}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-retryable and exhausted retry failures now surface the original GitHub error, preserving .status and .response. Fixed in 9cf4be0.

"additionalProperties": {
"$ref": "#/definitions/serviceContainer"
}
"oneOf": [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the unrelated services schema change from this PR. Fixed in 9cf4be0.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/markdown_metadata.cjs:288): address unresolved feedback - Review comment
  3. Review (actions/setup/js/markdown_metadata.cjs:9): address unresolved feedback - Review comment
  4. Review (actions/setup/js/markdown_metadata.cjs:10): address unresolved feedback - Review comment
  5. Review (actions/setup/js/markdown_metadata.cjs:288): address unresolved feedback - Review comment
  6. Review (pkg/workflow/schemas/github-workflow.json:1087): address unresolved feedback - Review comment

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"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits November 10, 2026 04:11
…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>
Copilot AI requested a review from gh-aw-bot November 10, 2026 04:20
@pelikhan
pelikhan merged commit a13f652 into main Nov 10, 2026
109 checks passed
@pelikhan
pelikhan deleted the copilot/copilotmove-codex-workflows-to-copilot branch November 10, 2026 04:44
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw] Issue Arborist: activation failed

4 participants