fix(gate): dedupe in-flight issue formatting - #2981
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. |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 2 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe issue-format workflows now use ChangesIssue format lease handling
Worker attempt metadata
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant FormatGuard
participant GitHubIssueLabels
participant OptimizerWorkflow
participant IssueFormatScript
FormatGuard->>GitHubIssueLabels: Check trusted marker and agents:format lease
FormatGuard->>GitHubIssueLabels: Acquire agents:format lease
FormatGuard->>OptimizerWorkflow: Dispatch optimizer
OptimizerWorkflow->>IssueFormatScript: Run issue_format.py with python3
IssueFormatScript-->>OptimizerWorkflow: Return format result
OptimizerWorkflow->>GitHubIssueLabels: Remove agents:format after failure or cancellation
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
a6a3d9d to
3317cb2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6a3d9d647
ℹ️ 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 adjusts the issue-format guard/optimizer handoff to prevent duplicate optimizer dispatches while a prior dispatch is still “in flight”, and standardizes validator execution to python3 for the issue_format.py contract checks in both the source workflows and the consumer templates.
Changes:
- Treat a trusted format-guard marker +
agents:formatas an in-flight lease (skip duplicate optimizer dispatches while the label is still present). - Retry optimizer dispatch when the trusted marker exists but the
agents:formatlabel is absent. - Run
issue_format.pyvalidators viapython3in both source and template optimizer workflows, and update tests accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/workflows/test_agents_issue_optimizer_format_trigger.py |
Updates assertions to cover python3 validator usage and new in-flight dedupe behavior. |
templates/consumer-repo/.github/workflows/agents-issue-optimizer.yml |
Switches issue_format.py validator calls from python to python3. |
templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml |
Changes dispatch dedupe logic to treat label presence as the in-flight lease and adjusts label-add ordering. |
.github/workflows/agents-issue-optimizer.yml |
Switches issue_format.py validator calls from python to python3. |
.github/workflows/agents-issue-format-guard.yml |
Changes dispatch dedupe logic to treat label presence as the in-flight lease and adjusts label-add ordering. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Automated Status SummaryHead SHA: b284230
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Low Coverage Files (<50.0%)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
Closer review disposition (head
|
12b5dec to
c47b48b
Compare
Closer advance — rebased onto current mainPrevious head: Review threads were resolved against the pre-rebase head with lease-failure evidence; rebase preserved:
Validation: Do not merge until ≥7 minutes from this exact head push and a fresh green/zero-thread re-read. |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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 @.github/workflows/agents-issue-format-guard.yml:
- Around line 151-155: Tighten the trusted_marker identity check so only the
exact login github-actions[bot] is accepted, and validate the immutable account
ID when that field is available. Apply the same change to the trusted_marker
logic in both .github/workflows/agents-issue-format-guard.yml (lines 151-155)
and templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml
(lines 151-155), preserving the existing dispatch behavior for trusted versus
untrusted markers.
In @.github/workflows/agents-issue-optimizer.yml:
- Around line 722-731: Update the cleanup step containing “Release failed format
lease” in .github/workflows/agents-issue-optimizer.yml lines 722-731 so its if
condition uses failure() || cancelled() while preserving the existing step and
phase checks. Apply the same cancellation-safe condition to the corresponding
cleanup step in
templates/consumer-repo/.github/workflows/agents-issue-optimizer.yml lines
540-550.
In `@tests/workflows/test_agents_issue_optimizer_format_trigger.py`:
- Around line 35-36: Update the assertions in the test covering both workflow
files to match each complete issue_format.py command, including python3, the
script path, and the corresponding /tmp/formatted_body.md or
/tmp/updated_body.md argument. Ensure both commands are independently asserted
for each workflow so interpreter, script, and input/output paths cannot vary
without failing the test.
- Around line 39-50: Extend
test_format_guard_deduplicates_inflight_optimizer_dispatch to assert the
consumer guard contains the marker literal and duplicate-dispatch skip message,
matching the root guard checks. For both workflow contents, verify the trusted
marker write occurs after the successful gh workflow run command, ensuring
failed dispatches cannot write the marker.
- Around line 58-62: Strengthen the assertions in the lease-control tests for
guard and consumer_guard so they validate control flow rather than substring
order: require failed lease acquisition to exit before dispatch, dispatch to
occur only in the successful branch, and cleanup to include the agents:format
phase and gh issue edit --remove-label "agents:format" command. Apply the same
checks to both workflow implementations.
🪄 Autofix
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: aa1a12b3-1211-4f77-b036-d8e28ad9f5dd
📒 Files selected for processing (6)
.github/workflows/agents-issue-format-guard.yml.github/workflows/agents-issue-optimizer.ymlconfig/template-drift-allowlist.txttemplates/consumer-repo/.github/workflows/agents-issue-format-guard.ymltemplates/consumer-repo/.github/workflows/agents-issue-optimizer.ymltests/workflows/test_agents_issue_optimizer_format_trigger.py
Require exact github-actions[bot] identity (id 41898282) for trusted markers, release agents:format on failure or cancellation, and harden format-trigger assertions for both workflow copies. Co-authored-by: Cursor <cursoragent@cursor.com>
Closer disposition — CodeRabbit threads on
|
|
Runner dispatch state for autofix on PR #2981. Do not edit. |
|
Runner dispatch state for codex on PR #2981. Do not edit. |
|
Autofix updated these files:
|
There was a problem hiding this comment.
Actionable comments posted: 4
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)
195-208: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winBoth format guards keep the
agents:formatlease after a failed dispatch. Each guard acquires the lease beforegh workflow runand exits on dispatch failure. No optimizer run starts, so the optimizer cleanup step never releases the label, and the issue keeps a lease with no in-flight work.
.github/workflows/agents-issue-format-guard.yml#L195-L208: remove theagents:formatlabel in the dispatch-failure branch beforeexit 1, and warn if the removal fails.templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml#L195-L208: apply the identical failure-path release so the template stays in sync.As per coding guidelines: "Any change to workflows that consumers use must be reflected in BOTH
.github/workflows/(main workflow) andtemplates/consumer-repo/.github/workflows/(template)".🤖 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 195 - 208, Both format guards must release the agents:format lease when optimizer dispatch fails: in .github/workflows/agents-issue-format-guard.yml lines 195-208 and templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml lines 195-208, remove the label in the gh workflow run failure branch before exit 1 and emit a warning if label removal fails, keeping both workflow files identical.Source: Coding guidelines
🤖 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 @.github/workflows/agents-issue-format-guard.yml:
- Around line 143-172: Update the retry handling used by the trusted_marker
lookup so retry diagnostics are written to stderr instead of stdout, including
the logging path in createTokenAwareRetry or its configured core logger. Keep
stdout limited to the final true/false value emitted by the Node script,
preserving dispatch behavior after successful retries.
In `@templates/consumer-repo/.github/workflows/agents-issue-optimizer.yml`:
- Around line 109-121: Remove the “Install load balancer dependencies” step
because the subsequent setup-api-client action already installs both
`@octokit/rest` and `@octokit/auth-app` at pinned versions. Keep the existing “Setup
API client” step and its configuration unchanged.
- Around line 21-27: Update the concurrency group expression in the workflow’s
concurrency configuration to include inputs.issue_number before falling back to
github.run_id, ensuring workflow_dispatch runs for the same issue share a
concurrency group while preserving existing issue-event behavior.
- Around line 357-391: Fix the Python heredoc block around issue_dedup by
normalizing all statements to consistent module-level indentation so it parses
and can write /tmp/dedup_comment.md. Remove the unconditional || true from the
heredoc invocation and explicitly capture the Python exit status, emitting a
GitHub Actions ::warning:: while preserving the workflow’s intended continuation
behavior when execution fails.
---
Outside diff comments:
In @.github/workflows/agents-issue-format-guard.yml:
- Around line 195-208: Both format guards must release the agents:format lease
when optimizer dispatch fails: in
.github/workflows/agents-issue-format-guard.yml lines 195-208 and
templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml lines
195-208, remove the label in the gh workflow run failure branch before exit 1
and emit a warning if label removal fails, keeping both workflow files
identical.
🪄 Autofix
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: 386f3b2c-0575-4303-b903-771f75be5cf4
📒 Files selected for processing (4)
.github/workflows/agents-issue-format-guard.ymltemplates/consumer-repo/.github/workflows/agents-issue-format-guard.ymltemplates/consumer-repo/.github/workflows/agents-issue-optimizer.ymltests/workflows/test_agents_issue_optimizer_format_trigger.py
Restore the consumer issue-optimizer sparse-checkout contract after a root-copy sync broke LLM-client discovery, and share concurrency, cancel-safe lease release, dedup indentation, and stderr retry logging. Co-authored-by: Cursor <cursoragent@cursor.com>
Closer recovery (2026-08-08T11:39Z)Exact head: Root causePrior closer sync replaced Fixes on this head
Validation
Merge gateDo not merge until ≥7 minutes after this exact head push and a re-read shows required checks green with active non-outdated review threads = 0. Zizmor “secrets: inherit” threads on format-guard are standing pattern noise, not fixed here. |
|
Resolved the two active zizmor secrets findings on the current head: both source and consumer format guards now pass only |
Closer verifier disposition — skipped (no acceptance criteria)Agents Verifier run Skip reason (durable): Evidence:
Closer treats this as terminal verifier disposition for #2981 (skip ≠ pending). |
Fixes the active review findings on the current consumer sync wave. A trusted format-guard marker plus agents:format is now treated as an in-flight lease, preventing duplicate optimizer dispatches; absent labels retry the handoff. Validator calls use python3 in the source and consumer-template optimizers.\n\nValidation: python3 -m pytest tests/workflows/test_agents_issue_optimizer_format_trigger.py -q (4 passed).\n\nThe broader test_workflow_llm_installs.py suite has one unrelated local Python 3.9 incompatibility (dataclass(slots=True)); 32 tests passed and 2 skipped.
Summary by CodeRabbit
Bug Fixes
Tests