fix(agents): cap issue-format optimizer retries - #2998
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
📝 WalkthroughWalkthroughThe format-guard workflows now track trusted optimizer attempts, enforce a three-attempt limit, correlate accepted runs by issue title, and preserve attempt markers across ambiguous dispatch failures. Documentation, tests, and worker metadata were updated. ChangesFormat-guard retry control
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Issue
participant FormatGuardWorkflow
participant GitHubActions
participant IssueLabels
Issue->>FormatGuardWorkflow: unchanged non-conforming body
FormatGuardWorkflow->>Issue: inspect trusted attempt markers
FormatGuardWorkflow->>GitHubActions: dispatch format optimizer
GitHubActions-->>FormatGuardWorkflow: accepted run or ambiguous CLI result
FormatGuardWorkflow->>Issue: record numbered attempt marker
FormatGuardWorkflow->>IssueLabels: pause after third attempt
Possibly related issues
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Runner dispatch state for autofix on PR #2998. Do not edit. |
🤖 Keepalive Loop StatusPR #2998 | Agent: Codex | Iteration 0/12 Current State
🔍 Failure Classification| Error type | infrastructure |
|
Keepalive Work Log (click to expand)
|
|
Runner dispatch state for codex on PR #2998. Do not edit. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 864a97bd84
ℹ️ 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.
Pull request overview
This PR introduces a sequential attempt cap to the agents-issue-format-guard routing logic to prevent unbounded re-dispatching to the issue optimizer, and updates workflow-text assertions to ensure the cap machinery is present in both the root workflow and the consumer template.
Changes:
- Add a format-guard attempt counter derived from prior
<!-- format-guard:... -->markers and stop routing once a fixed maximum is reached, applyingagents:auto-pilot-pause. - Emit a one-time “attempt cap” marker/comment when automated formatting is exhausted.
- Extend the existing workflow YAML text-based test to assert the attempt-cap logic is present and positioned before dispatch.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/workflows/test_agents_issue_optimizer_format_trigger.py | Adds assertions that the attempt-cap variables/marker/comment exist in both workflow copies and appear before the optimizer dispatch call. |
| templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml | Adds attempt counting + cap behavior (pause label + exhaustion comment) to prevent unbounded sequential optimizer retries in consumer templates. |
| .github/workflows/agents-issue-format-guard.yml | Mirrors the same attempt counting + cap behavior in the root workflow copy. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/agents-issue-format-guard.yml (1)
303-309: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winIncrease and test the accepted-dispatch probe limit.
Line 306 limits the probe to 20 runs. During a burst, the accepted dispatch can fall outside this result set. The workflow then releases
agents:formatand can dispatch the optimizer again. Use the required limit of 100 and assert it in the workflow contract test.
.github/workflows/agents-issue-format-guard.yml#L303-L309: change--limit 20to--limit 100.templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml#L303-L309: apply the same synchronized limit.tests/workflows/test_agents_issue_optimizer_format_trigger.py#L63-L87: assert that both workflows contain--limit 100.🤖 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 @.github/workflows/agents-issue-format-guard.yml around lines 303 - 309, Increase the accepted-dispatch probe limit from 20 to 100 in both workflow files, .github/workflows/agents-issue-format-guard.yml lines 303-309 and templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml lines 303-309. Update tests/workflows/test_agents_issue_optimizer_format_trigger.py lines 63-87 to assert that both workflows contain --limit 100.
🤖 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.
Outside diff comments:
In @.github/workflows/agents-issue-format-guard.yml:
- Around line 303-309: Increase the accepted-dispatch probe limit from 20 to 100
in both workflow files, .github/workflows/agents-issue-format-guard.yml lines
303-309 and
templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml lines
303-309. Update tests/workflows/test_agents_issue_optimizer_format_trigger.py
lines 63-87 to assert that both workflows contain --limit 100.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a93ca531-29b5-4420-9ee3-848dd7f3f3d7
📒 Files selected for processing (5)
.github/workflows/agents-issue-format-guard.ymldocs/ci/WORKFLOWS.mdlangsmith-fleet-worker-attempt.jsontemplates/consumer-repo/.github/workflows/agents-issue-format-guard.ymltests/workflows/test_agents_issue_optimizer_format_trigger.py
Provider Comparison ReportProvider Summary
📋 Full Provider Details (click to expand)openai
anthropic
Agreement
DisagreementNo major disagreements detected. Unique Insights
🔍 LangSmith Traces |
Closer disposition: verifier CONCERNS = false positive vs current mainAudited provider-comparison CONCERNS (comment at 2026-08-09T02:30:56Z) against live Claims vs current main
Disposition
Closer agent: cursor | round 2026-08-09T02:40:19Z |
Closes #2991
Automated Status Summary
Scope
Loop safety in the
agents-issue-format-guard<->agents-issue-optimizerhandshake:templates/consumer-repo/.github/workflows/agents-issue-format-guard.ymland.github/workflows/agents-issue-optimizer.yml. The goal is that no single issue can be routed to the optimizer without bound, whatever the validator's verdict.Context for Agent
Related Issues/PRs
Tasks
templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml:62-67, reading thestatefield already fetched at:59-60(for example[[ "$(jq -r '.state // "" | ascii_downcase' issue.json)" == "closed" ]]setsexempt=true), so no validation, comment, or dispatch occurs for closed issues.run-name:to.github/workflows/agents-issue-optimizer.ymlso every run carries the issue number regardless of trigger — e.g.Agents Issue Optimizer #${{ github.event.issue.number || inputs.issue_number }}— makingdisplayTitlecorrelatable for bothissuesandworkflow_dispatchruns.contains($issue)toendswith($issue)at.github/workflows/agents-issue-optimizer.yml:150andtemplates/consumer-repo/.github/workflows/agents-issue-format-guard.yml:245, so#4640is not counted against#464.--limit 100to thegh run listcall at.github/workflows/agents-issue-optimizer.yml:144-146, so the one-hour window is not truncated by the 20-run default.templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml:121-269: count prior<!-- format-guard:markers on the issue and, at or above a fixed maximum, applyagents:auto-pilot-pause, post one comment recording that automated formatting is exhausted, and stop dispatching instead of routing again.Acceptance criteria
pytest tests/workflows/test_issue_optimizer_recursion_guard.py::test_recursion_guard_counts_workflow_dispatch_runspasses. The test feeds the guard'sjqfilter a fixture of fiveworkflow_dispatchrun records for one issue inside the window (the shape captured above), asserts the computed count is5so the-gt 3branch trips, and includes a#4640record that must NOT be counted against#464.contains($issue)in place ofendswith($issue)and remove therun-name:line sodisplayTitleis the bare workflow name, confirmtest_recursion_guard_counts_workflow_dispatch_runsFAILS with a computed count of0(the exact production symptom), then revert and confirm it passes again.pytest tests/workflows/test_issue_format_guard.py::test_closed_issue_is_exemptpasses: given anissue.jsonfixture with"state": "CLOSED", the resolve step setsexempt=trueand no dispatch occurs.pytest tests/workflows/test_issue_format_guard.py::test_routing_stops_at_attempt_cappasses: given an issue whose comments already carry the maximum number of<!-- format-guard:markers, the routing step appliesagents:auto-pilot-pauseand performs nogh workflow rundispatch.Summary by CodeRabbit
Bug Fixes
Documentation