fix: add token-aware retry to issue workflows (#1173)#1173
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4fb47417a
ℹ️ 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".
| }, | ||
| { | ||
| }), | ||
| }), |
There was a problem hiding this comment.
Remove stray closing brace that breaks the test file
This extra }), closes the withEmptyJobs({ ... }) call twice, leaving an unmatched ) in the array literal. That makes the entire test file invalid JavaScript, so any run of this test suite (or any runner that loads the file) will fail to parse before tests execute.
Useful? React with 👍 / 👎.
c4fb474 to
efbdeb2
Compare
There was a problem hiding this comment.
Pull request overview
This PR wires token-aware GitHub API retries and load-balanced tokens into several workflows and utilities, improving resilience to rate limits while extending issue/PR metadata handling and verifier reporting.
Changes:
- Enhance
scripts/check_issue_consistency.pyto infer issue numbers from the head ref, recognize autofix contexts, and restrict header scanning to comments/docstrings; add corresponding tests. - Replace
ghCLI issue calls with Octokit-based, token-aware retry flows in agents workflows (issue optimizer, auto-pilot, issue intake) and gate/autofix paths, including new Node/Octokit setup and load balancer token exports. - Extend verifier CI query behavior/tests to include per-workflow jobs summaries and error fields, and update agents verifier context tests to match.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
verifier-pr-diff.patch |
Fixture patch updated; no functional impact on workflows or scripts. |
tests/scripts/test_issue_consistency_check.py |
Adjust test to treat only comment lines as header issue references and add coverage for extracting issue numbers from the head ref branch name. |
scripts/check_issue_consistency.py |
Add extract_head_ref_issue_numbers, is_autofix_context, more precise header scanning over comments/docstrings, and head-ref/autofix-based fallback logic in main. |
.github/workflows/pr-00-gate.yml |
Introduce load balancer token export, Node/Octokit setup, and token-aware retry/pagination for gate autofix labeling and commit-status posting. |
.github/workflows/autofix.yml |
Switch context resolution to use createTokenAwareRetry/paginateWithRetry and ensure load balancer tokens and Node/Octokit deps are available. |
.github/workflows/agents-issue-optimizer.yml |
Replace gh issue API usage with Octokit + token-aware retry for reading/updating issues and comments; add Node/Octokit and token load balancer setup. |
.github/workflows/agents-bot-comment-handler.yml |
Make the resolver job use token-aware retry when available (falling back to existing retry helpers) for repo/PR lookups. |
.github/workflows/agents-auto-pilot.yml |
Introduce Node/Octokit + token-aware retry for resolving external workflow refs, fetching keepalive state, and performing inline issue formatting/optimization/apply steps via the GitHub API instead of gh. |
.github/workflows/agents-63-issue-intake.yml |
Add Node/Octokit and load balancer setup, and convert LangChain-based mass formatting to use token-aware Octokit for issue reads/updates and labeling. |
.github/scripts/__tests__/verifier-ci-query.test.js |
Update expectations to include job summary/error fields and introduce withEmptyJobs helper, but currently contains a syntax error in one assertion array. |
.github/scripts/__tests__/agents-verifier-context.test.js |
Add withEmptyJobs helper and update CI results expectations to include empty jobs metadata, aligning with the updated verifier CI query output. |
Comments suppressed due to low confidence (1)
.github/workflows/agents-63-issue-intake.yml:296
- This second
Export load balancer tokensstep immediately repeats the same action that was run just above, but with a reduced set of inputs. Running the exporter twice back-to-back is redundant and may overwrite the more complete token configuration from the first call; consider consolidating to a single invocation with the intended inputs.
- name: Export load balancer tokens
uses: ./.github/actions/export-load-balancer-tokens
with:
github_token: ${{ github.token }}
token_rotation_json: ${{ secrets.TOKEN_ROTATION_JSON }}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cat > /tmp/auto_pilot_format_start.md <<'EOF' | ||
| 🤖 **Auto-pilot step $((STEP_COUNT + 1))**: Starting issue formatting... | ||
|
|
||
| Running formatter inline (not via label trigger). | ||
| EOF |
There was a problem hiding this comment.
Because this here-document uses a single-quoted delimiter (<<'EOF'), the $((STEP_COUNT + 1)) expression inside will not be expanded and will appear literally in the comment body. To preserve the dynamic step number in the posted message, switch to an unquoted here-doc delimiter (or otherwise interpolate the step count before writing the file).
| cat > /tmp/auto_pilot_optimize_start.md <<'EOF' | ||
| 🤖 **Auto-pilot step $((STEP_COUNT + 1))**: Analyzing issue for improvements... | ||
|
|
||
| Running optimizer inline (not via label trigger). | ||
| EOF |
There was a problem hiding this comment.
As with the format step, this here-document is single-quoted (<<'EOF'), so the $((STEP_COUNT + 1)) expression will not be interpolated and the literal text will be posted. If you intend to include the actual step number in the progress comment, the here-doc delimiter should be unquoted (or the step count should be substituted before writing the file).
| cat > /tmp/auto_pilot_apply_start.md <<'EOF' | ||
| 🤖 **Auto-pilot step $((STEP_COUNT + 1))**: Applying optimization suggestions... | ||
|
|
||
| Running apply inline (not via label trigger). | ||
| EOF |
There was a problem hiding this comment.
This apply-step progress comment has the same quoting pattern (<<'EOF') as the earlier ones, so the $((STEP_COUNT + 1)) arithmetic expansion will not be evaluated and the literal placeholder will be written. To keep the user-facing comment consistent with the previous behavior (showing the actual step number), use an unquoted here-doc delimiter or otherwise interpolate STEP_COUNT before writing the file.
Automated Status SummaryHead SHA: 9463138
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeAfter merging PR #103 (multi-agent routing infrastructure), we need to: Context for AgentDesign Decisions & Constraints
Related Issues/PRsReferences
Blockers & Dependencies
Tasks
Acceptance criteria
|
🤖 Keepalive Loop StatusPR #1173 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
✅ Codex Completion CheckpointCommit: No new completions recorded this round. About this commentThis comment is automatically generated to track task completions. |
|
Status | ✅ no new diagnostics |
|
Autofix updated these files:
|
* test: update verifier CI expectations * fix: add token-aware retry to issue workflows * fix: indent node heredocs * fix: repair verifier ci query test * chore(codex-autofix): apply updates (PR #1173) * chore(autofix): formatting/lint * fix: avoid heredoc in intake formatter * fix: remove unused intake variable * fix: wrap workflow API calls with retry * docs: add high-volume API audit * fix: extend retry coverage for remediation * docs: refresh audit entries after remediation * fix: wrap belt worker graphql with retry * docs: update audit for gh api cleanup * fix: complete retry and load balancer coverage * fix: address PR review feedback * chore: sync template scripts --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* test: update verifier CI expectations * fix: add token-aware retry to issue workflows * fix: indent node heredocs * fix: repair verifier ci query test * chore(codex-autofix): apply updates (PR #1173) * chore(autofix): formatting/lint * fix: avoid heredoc in intake formatter * fix: remove unused intake variable * fix: wrap workflow API calls with retry * docs: add high-volume API audit * fix: extend retry coverage for remediation * docs: refresh audit entries after remediation * fix: wrap belt worker graphql with retry * docs: update audit for gh api cleanup * fix: complete retry and load balancer coverage * fix: address PR review feedback * feat: add API guardrails and audits * fix: resolve CI failures and agent feedback * fix: correct autopilot YAML indentation * chore(codex-autofix): apply updates (PR #1179) * chore: sync template scripts --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Automated Status Summary
Scope
After merging PR #103 (multi-agent routing infrastructure), we need to:
GITHUB_STEP_SUMMARYoutput so iteration results are visible in the Actions UIContext for Agent
Design Decisions & Constraints
<!-- keepalive-loop-summary -->| github-actions[bot] | NEW: CLI agent iteration tracking | ✅ Keep for CLI agents |<!-- keepalive-state:v1 -->| agents-workflows-bot[bot] | State tracking |<!-- keepalive-round: N -->| stranske | OLD: Instruction comment | ❌ CLI agents dont need this |agent:*label), we should have exactly one updating comment (<!-- keepalive-loop-summary -->) instead of accumulating 10+ comments per PR.Related Issues/PRs
References
Blockers & Dependencies
Tasks
Pipeline Validation
agent:codexlabelGITHUB_STEP_SUMMARY
agents-keepalive-loop.ymlafter agent runConditional Status Summary
buildStatusBlock()inagents_pr_meta_update_body.jsto acceptagentTypeparameteragentTypeis set (CLI agent): hide workflow table, hide head SHA/required checksComment Pattern Cleanup
agent:*label):<!-- gate-summary: -->comment posting (use step summary instead)<!-- keepalive-round: N -->instruction comments (task appendix replaces this)<!-- keepalive-loop-summary -->to be the single source of truthagent:*label):<!-- gate-summary: -->commentagent_typeoutput to detect job so downstream workflows know the modeagents-pr-meta.ymlto conditionally skip gate summary for CLI agent PRsAcceptance criteria
Head SHA: 90cea92
Latest Runs: ✅ success — Gate
Required: gate: ✅ success