Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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.
.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,25 @@ 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 perPage = params?.per_page || 100;
const items = [];
let page = params?.page || 1;
while (true) {
const response = await method({ ...params, per_page: perPage, page });
const data = response?.data;
const pageItems = Array.isArray(data)
? data
: Object.values(data || {}).find((value) => Array.isArray(value)) || [];
items.push(...pageItems);
if (pageItems.length < perPage) break;
page += 1;
}
return items;
}
}) };
const { withRetry, paginateWithRetry } = await createTokenAwareRetry({ github, core });

Expand Down Expand Up @@ -1551,6 +1568,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 +1588,22 @@ jobs:
: {
createTokenAwareRetry: async () => ({
withRetry: (fn) => fn(github),
paginateWithRetry: (method, params) => github.paginate(method, params),
paginateWithRetry: async (method, params) => {
const perPage = params?.per_page || 100;
const items = [];
let page = params?.page || 1;
while (true) {
const response = await method({ ...params, per_page: perPage, page });
const data = response?.data;
const pageItems = Array.isArray(data)
? data
: Object.values(data || {}).find((value) => Array.isArray(value)) || [];
items.push(...pageItems);
if (pageItems.length < perPage) break;
page += 1;
}
return items;
},
Comment thread
stranske marked this conversation as 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