Skip to content

fix: repair shared sync gate failures - #2722

Merged
stranske merged 3 commits into
mainfrom
codex/fix-sync-shared-ci-failures
Jun 30, 2026
Merged

fix: repair shared sync gate failures#2722
stranske merged 3 commits into
mainfrom
codex/fix-sync-shared-ci-failures

Conversation

@stranske

@stranske stranske commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • include error_classifier.js in agents-81-gate-followups.yml retry-helper sparse checkouts
  • add agents-81-gate-followups.yml to the retry/sparse-checkout guard test
  • allow autopilot_step_timer failure summaries to accept SystemExit from argparse

Validation

  • /opt/anaconda3/bin/python3.12 -m pytest tests/workflows/test_github_api_retry_standard.py tests/scripts/test_autopilot_step_timer.py tests/scripts/test_autopilot_step_timer_failure_handling.py -q
  • python3 scripts/validate_template_sync.py
  • python3 scripts/validate_template_completeness.py
  • git diff --check

Related to sync/dependency cleanup campaign blockers on Manager-Database#1343 and trip-planner#1506.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability in automation retries and pagination when fallback behavior is used.
    • Expanded failure reporting to handle a wider range of error types without breaking summary generation.
  • Chores

    • Updated workflow coverage so validation checks now include an additional automation workflow.

@stranske stranske added codex codex-automation automation Automation and workflow automation maintenance Maintenance tasks sync labels Jun 30, 2026
@stranske
stranske temporarily deployed to agent-standard June 30, 2026 07:36 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Updates agents-81-gate-followups.yml to include .github/scripts/error_classifier.js in sparse-checkout for three jobs and replaces github.paginate with a direct method call returning response.data || [] in two fallback paginateWithRetry implementations. Changes _write_failure_summary's error annotation from Exception to BaseException. Adds the workflow to the retry standard test suite.

Changes

Workflow retry fallback, sparse-checkout, and type annotation fixes

Layer / File(s) Summary
Sparse-checkout and paginateWithRetry fallback updates
templates/consumer-repo/.github/workflows/agents-81-gate-followups.yml
Adds .github/scripts/error_classifier.js to sparse-checkout in needs-human, metrics, and guarded-merge jobs. Updates the createTokenAwareRetry fallback paginateWithRetry in metrics and guarded-merge to call the method directly with per_page: params?.per_page || 100 and return response.data || [].
Test coverage and type annotation
tests/workflows/test_github_api_retry_standard.py, scripts/autopilot_step_timer.py
Adds agents-81-gate-followups.yml to WORKFLOW_PATHS so it is validated by all retry/sparse-checkout tests. Changes _write_failure_summary error parameter annotation from Exception to BaseException.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • stranske/Workflows#2402: Same pattern of adding .github/scripts/error_classifier.js to sparse-checkout lists in workflow files.

Suggested labels

github:actions

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main goal of fixing shared sync gate failures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-sync-shared-ci-failures

Comment @coderabbitai help to get the list of available commands.

@stranske
stranske temporarily deployed to agent-standard June 30, 2026 07:37 — with GitHub Actions Inactive
@agents-workflows-bot

agents-workflows-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 03dbb4f
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / guard
Required: core tests (3.12): ⏳ pending, core tests (3.13): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 1

Coverage Trend

Metric Value
Current 75.67%
Baseline 85.00%
Delta -9.33%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
scripts/issue_dedup_smoke.py 0.0% 4
scripts/runner_lib/__main__.py 0.0% 3
scripts/validate_template_sync.py 0.0% 77
scripts/langchain/topic_splitter.py 19.1% 57
tools/codex_log_analyzer.py 19.6% 140
scripts/repo_review_round2_runner.py 25.1% 344
scripts/prune_agent_stubs.py 39.7% 26
scripts/repo_review_round1_runner.py 40.7% 133
tools/ensure_workflow_timeout_variables.py 42.1% 74
scripts/sync_label_docs.py 42.9% 64
tools/ci_failure_triage.py 44.2% 123
scripts/repo_review_backlog_scan.py 45.3% 116
scripts/repo_review_body_writer.py 46.5% 86
tools/codex_session_analyzer.py 47.9% 59
scripts/create_verifier_labels.py 48.3% 58

Low Coverage Files (<50.0%)

File Coverage Missing
scripts/issue_dedup_smoke.py 0.0% 4
scripts/runner_lib/__main__.py 0.0% 3
scripts/validate_template_sync.py 0.0% 77
scripts/langchain/topic_splitter.py 19.1% 57
tools/codex_log_analyzer.py 19.6% 140
scripts/repo_review_round2_runner.py 25.1% 344
scripts/prune_agent_stubs.py 39.7% 26
scripts/repo_review_round1_runner.py 40.7% 133
tools/ensure_workflow_timeout_variables.py 42.1% 74
scripts/sync_label_docs.py 42.9% 64
tools/ci_failure_triage.py 44.2% 123
scripts/repo_review_backlog_scan.py 45.3% 116
scripts/repo_review_body_writer.py 46.5% 86
tools/codex_session_analyzer.py 47.9% 59
scripts/create_verifier_labels.py 48.3% 58

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

@stranske
stranske temporarily deployed to agent-standard June 30, 2026 07:37 — with GitHub Actions Inactive

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7e67f5bb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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 👍 / 👎.

@stranske

stranske commented Jun 30, 2026

Copy link
Copy Markdown
Owner Author

Runner dispatch state for autofix on PR #2722. Do not edit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with 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.

Inline comments:
In `@templates/consumer-repo/.github/workflows/agents-81-gate-followups.yml`:
- Around line 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.
- Around line 1283-1286: This change should not be applied locally in
agents-*.yml workflows; it needs to be made in the upstream source of truth in
stranske/Workflows and then synced back. Update the relevant workflow there,
using the synced workflow path and the .github/sync-manifest.yml-managed
process, then pull the generated change into
templates/consumer-repo/.github/workflows/agents-81-gate-followups.yml rather
than patching this consumer file directly.
- Around line 1579-1582: The current paginateWithRetry fallback only returns the
first API page, so the workflow can miss items when used by issues.listForRepo
and pulls.listFiles. Update the paginateWithRetry helper to actually iterate
through all pages (or delegate to the client’s pagination support) instead of
calling the method once, and make sure the call sites in the agent job continue
to receive the full aggregated results for automerge PRs and changed files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b89fbb7b-8249-4786-abae-0b0e4cfd34ce

📥 Commits

Reviewing files that changed from the base of the PR and between fd8335c and ae4f5fc.

📒 Files selected for processing (3)
  • scripts/autopilot_step_timer.py
  • templates/consumer-repo/.github/workflows/agents-81-gate-followups.yml
  • tests/workflows/test_github_api_retry_standard.py

Comment on lines +1374 to +1376
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.

🎯 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.

@stranske
stranske temporarily deployed to agent-standard June 30, 2026 09:31 — with GitHub Actions Inactive
@stranske
stranske enabled auto-merge (squash) June 30, 2026 09:32
@stranske
stranske merged commit ff79b33 into main Jun 30, 2026
49 checks passed
@stranske
stranske deleted the codex/fix-sync-shared-ci-failures branch June 30, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Automation and workflow automation codex codex-automation maintenance Maintenance tasks sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants