Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/autopilot_step_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _summary_env_details() -> dict[str, str]:
return details


def _write_failure_summary(*, error: Exception, exit_code: int, step_name: str | None) -> None:
def _write_failure_summary(*, error: BaseException, exit_code: int, step_name: str | None) -> None:
summary_path = os.environ.get("AUTOPILOT_METRICS_SUMMARY_PATH")
if not summary_path:
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ jobs:
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: |
.github/scripts/error_classifier.js
Comment thread
stranske marked this conversation as resolved.
Resolved
.github/scripts/github-api-with-retry.js
.github/scripts/token_load_balancer.js
sparse-checkout-cone-mode: false
Expand Down Expand Up @@ -1353,6 +1354,7 @@ jobs:
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: |
.github/scripts/error_classifier.js
.github/scripts/github-api-with-retry.js
.github/scripts/token_load_balancer.js
sparse-checkout-cone-mode: false
Expand All @@ -1366,10 +1368,13 @@ jobs:
const fs = require('fs');
const retryPath = './.github/scripts/github-api-with-retry.js';
const { createTokenAwareRetry } = fs.existsSync(retryPath)
? require(retryPath)
: { createTokenAwareRetry: async () => ({
? require(retryPath)
: { createTokenAwareRetry: async () => ({
withRetry: (fn) => fn(github),
paginateWithRetry: (method, params) => github.paginate(method, params)
paginateWithRetry: async (method, params) => {
const response = await method({ ...params, per_page: params?.per_page || 100 });
return response.data || [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the paginated array contract

When this fallback is used, such as in a consumer checkout that does not materialize .github/scripts/github-api-with-retry.js, github.rest.actions.listWorkflowRuns returns a response whose data is an object containing workflow_runs, not the flattened array returned by the previous github.paginate(...) call. The later runs[0] lookup therefore never finds the latest Gate run and records gate_result_after as not-found even when a run exists; the fallback needs to keep returning the same paginated array shape as the real helper.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

listWorkflowRuns fallback returns the wrong shape here.

github.rest.actions.listWorkflowRuns(...) does not yield a bare array, so return response.data || [] makes runs[0] come back undefined in the fallback path and forces gate_result_after to not-found even when runs exist. Keep this fallback aligned with the retry helper’s “paginated array” contract before indexing it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@templates/consumer-repo/.github/workflows/agents-81-gate-followups.yml`
around lines 1374 - 1376, The `paginateWithRetry` fallback for
`listWorkflowRuns` is returning the wrong shape because
`github.rest.actions.listWorkflowRuns(...)` returns a response object, not a
plain array. Update the fallback so it matches the retry helper’s
paginated-array contract before any `runs[0]` access, using the existing
`paginateWithRetry` helper and the `listWorkflowRuns` call site to keep the
fallback consistent with the rest of the code.

}
}) };
const { withRetry, paginateWithRetry } = await createTokenAwareRetry({ github, core });

Expand Down Expand Up @@ -1551,6 +1556,7 @@ jobs:
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: |
.github/scripts/error_classifier.js
.github/scripts/github-api-with-retry.js
.github/scripts/runtime_ac_merge_guard.js
.github/scripts/token_load_balancer.js
Expand All @@ -1570,7 +1576,10 @@ jobs:
: {
createTokenAwareRetry: async () => ({
withRetry: (fn) => fn(github),
paginateWithRetry: (method, params) => github.paginate(method, params),
paginateWithRetry: async (method, params) => {
const response = await method({ ...params, per_page: params?.per_page || 100 });
return response.data || [];
},
Comment thread
stranske marked this conversation as resolved.
Resolved
}),
};
const { withRetry, paginateWithRetry } = await createTokenAwareRetry({ github, core });
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/test_github_api_retry_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Path("templates/consumer-repo/.github/workflows/agents-72-codex-belt-worker.yml"),
Path("templates/consumer-repo/.github/workflows/agents-73-codex-belt-conveyor.yml"),
Path("templates/consumer-repo/.github/workflows/agents-80-pr-event-hub.yml"),
Path("templates/consumer-repo/.github/workflows/agents-81-gate-followups.yml"),
Path("templates/consumer-repo/.github/workflows/agents-verifier.yml"),
Path("templates/consumer-repo/.github/workflows/agents-verify-to-new-pr.yml"),
Path("templates/consumer-repo/.github/workflows/autofix.yml"),
Expand Down
Loading