-
Notifications
You must be signed in to change notification settings - Fork 0
fix(opencode-review): scope concurrency to opencode-review-target only #1786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,44 +20,6 @@ on: | |
| # publish stale evidence or wait on an impossible verdict. | ||
| types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] | ||
|
|
||
| concurrency: | ||
| # Scoped by repository + PR number ONLY (not head SHA) with | ||
| # cancel-in-progress: false -- by explicit user directive on 2026-09-03, | ||
| # refined after review from two peer sessions to fully close the race this | ||
| # is actually protecting against, not just trade one failure mode for | ||
| # another. | ||
| # | ||
| # History: head-SHA scoping was added for Devin Review's `#1568` finding -- | ||
| # GitHub cancels whichever run is currently active in a concurrency group | ||
| # when a new one starts, with no notion of "older"/"newer", so a delayed, | ||
| # out-of-order run for an older head could cancel the authoritative run | ||
| # already active for a newer head. Scoping by head SHA gave each push its | ||
| # own group so this couldn't happen -- but it also meant rapid successive | ||
| # pushes to the SAME PR no longer shared a group at all, so they stopped | ||
| # cancelling each other's in-flight runs and instead queued up | ||
| # independently, directly worsening the self-inflicted queue-thrashing | ||
| # pattern this org measured directly (236/300 cancelled runs attributed to | ||
| # concurrent push volume; see internal memory | ||
| # project_queue_thrashing_self_inflicted_2026_09_03). | ||
| # | ||
| # The actual fix is not to re-key the group but to stop cancelling within | ||
| # it: with cancel-in-progress: false, a late-arriving run for an older head | ||
| # never preempts whichever run is already active, at any arrival order -- | ||
| # the #1568 race is structurally impossible here, not just less likely. | ||
| # The now-queued older-head run still gets a turn once the active run | ||
| # finishes, but by then the poll step's own live-head/live-state | ||
| # revalidation (re-run every iteration, already required for correctness | ||
| # regardless of this setting) sees the head has moved and self-exits within | ||
| # one poll_interval_seconds instead of running to completion or publishing | ||
| # stale evidence. Plain repo+PR-number scoping also means rapid pushes | ||
| # naturally serialize through one queue instead of spawning N independent | ||
| # per-head groups, which is what actually bounds queue depth here. | ||
| group: >- | ||
| opencode-review-bootstrap-${{ | ||
| github.event.pull_request.base.repo.full_name || github.repository }}-${{ | ||
| github.event.pull_request.number || github.run_id }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
@@ -291,6 +253,64 @@ jobs: | |
| name: opencode-review | ||
| needs: [coverage-evidence] | ||
| runs-on: ubuntu-24.04 | ||
| # Job-level (not workflow-level) on purpose: a workflow-level concurrency | ||
| # block applies to the ENTIRE run as a unit -- every job in the file, | ||
| # including the structurally-separate cancel-superseded-opencode-review-runs | ||
| # job below. That created a real deadlock (Devin Review, 2026-09-03, | ||
| # confirmed independently by two peer sessions before I acted on it): with | ||
| # cancel-in-progress: false, a new push's ENTIRE run -- cleanup job | ||
| # included -- could not even start until the group freed up, which only | ||
| # happens when the older run's own opencode-review-target job finishes. | ||
| # Since OpenCode/Noema inference deliberately has no wall-clock deadline, | ||
| # a long-running older-head review could then block the newer head's | ||
| # review indefinitely -- the opposite of what this design is supposed to | ||
| # fix. Scoping the group to ONLY this job (the one that actually runs the | ||
| # long dispatch+poll) leaves cancel-superseded-opencode-review-runs | ||
| # completely unblocked: it starts immediately on every push and cancels | ||
| # the older run via a direct Actions API call, which releases this job's | ||
| # own concurrency slot for the new push's instance -- no deadlock, and the | ||
| # #1568 stale-cancels-fresh race stays structurally closed (see | ||
| # cancel-in-progress below) at the same time. | ||
| concurrency: | ||
| group: >- | ||
| opencode-review-bootstrap-${{ | ||
| github.event.pull_request.base.repo.full_name || github.repository }}-${{ | ||
| github.event.pull_request.number || github.run_id }} | ||
| # Scoped by repository + PR number ONLY (not head SHA) with | ||
| # cancel-in-progress: false -- by explicit user directive on | ||
| # 2026-09-03, refined after cross-session review to fully close the | ||
| # race this is actually protecting against, not just trade one | ||
| # failure mode for another. | ||
| # | ||
| # History: head-SHA scoping was added for Devin Review's `#1568` | ||
| # finding -- GitHub cancels whichever run is currently active in a | ||
| # concurrency group when a new one starts, with no notion of | ||
| # "older"/"newer", so a delayed, out-of-order run for an older head | ||
| # could cancel the authoritative run already active for a newer head. | ||
| # Scoping by head SHA gave each push its own group so this couldn't | ||
| # happen -- but it also meant rapid successive pushes to the SAME PR | ||
| # no longer shared a group at all, so they stopped cancelling each | ||
| # other's in-flight runs and instead queued up independently, | ||
| # directly worsening the self-inflicted queue-thrashing pattern this | ||
| # org measured directly (236/300 cancelled runs attributed to | ||
| # concurrent push volume; see internal memory | ||
| # project_queue_thrashing_self_inflicted_2026_09_03). | ||
| # | ||
| # The actual fix is not to re-key the group but to stop cancelling | ||
| # within it: with cancel-in-progress: false, a late-arriving run for | ||
| # an older head never preempts whichever run is already active, at | ||
| # any arrival order -- the #1568 race is structurally impossible | ||
| # here, not just less likely. The now-queued older-head run still | ||
| # gets a turn once the active run finishes, but by then the poll | ||
| # step's own live-head/live-state revalidation (re-run every | ||
| # iteration, already required for correctness regardless of this | ||
| # setting) sees the head has moved and self-exits within one | ||
| # poll_interval_seconds instead of running to completion or | ||
| # publishing stale evidence. Plain repo+PR-number scoping also means | ||
| # rapid pushes naturally serialize through one queue instead of | ||
| # spawning N independent per-head groups, which is what actually | ||
| # bounds queue depth here. | ||
| cancel-in-progress: false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Delayed events cancel current reviews When a stale event arrives while the current-head job is pending, Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Concurrency evidence is not durable
The queue-thrashing rationale cites internal memory instead of a repository or Project record. Preserve the measurement and methodology in a durable source.
Was this helpful? React with 👍 or 👎 to provide feedback.