-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(ci): skip non-bot review_requested siblings before jobs spend compute #9204
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2517,3 +2517,47 @@ describe('bot comment markers', () => { | |
| expect(ackLine).toContain('"$RUN_URL"'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('review_requested burst coalescing (#8945)', () => { | ||
| // Opening a same-repo PR that touches CODEOWNERS-covered paths auto-requests | ||
| // every owner individually, so one PR open emits one `review_requested` run | ||
| // per owner (observed: five within the same second on #8830/#9142). Only | ||
| // the bot-requested run can reach `review-pr`; the human-requested siblings | ||
| // used to spend an `authorize` job (permission API + runner slot) each | ||
| // before no-op exiting. `authorize` and `review-config` must filter those | ||
| // siblings at the job level so they complete as instant all-skipped runs. | ||
| const doc = parse(workflow); | ||
|
|
||
| const botLoginMatch = doc.jobs['review-config'].steps[0].run.match( | ||
| /bot_login=([A-Za-z0-9-]+)/, | ||
| ); | ||
| const botLogin = botLoginMatch ? botLoginMatch[1] : ''; | ||
|
|
||
| const botRequestedClause = new RegExp( | ||
| [ | ||
| String.raw`\(\s*github\.event_name != 'pull_request_target' \|\|`, | ||
| String.raw`\s*github\.event\.action != 'review_requested' \|\|`, | ||
| String.raw`\s*github\.event\.requested_reviewer\.login == '${botLogin}'\s*\)`, | ||
| ].join(''), | ||
| ); | ||
|
|
||
| it('resolves the bot login from review-config, not a paraphrase', () => { | ||
| expect(botLogin).toBe('qwen-code-ci-bot'); | ||
| }); | ||
|
|
||
| it('filters non-bot review_requested events before authorize spends compute', () => { | ||
| // The same disjunction precheck-pr already applies to fork PRs; mirroring | ||
| // it here covers same-repo PRs, which precheck-pr deliberately skips. | ||
| expect(doc.jobs['authorize'].if).toMatch(botRequestedClause); | ||
| }); | ||
|
|
||
| it('keeps review-config from running for non-bot review_requested events', () => { | ||
| // review-config exists to feed bot_login into review-pr; only the | ||
| // bot-requested run can get there, so every other sibling is pure waste. | ||
| const cond = doc.jobs['review-config'].if; | ||
| expect(cond).toContain("github.event.action == 'review_requested'"); | ||
|
Comment on lines
+2557
to
+2558
Collaborator
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. [Suggestion] These pin tests assert fragments of Pin the full normalized expression rather than fragments, e.g.: expect(cond.replace(/\s+/g, ' ')).toBe(
"github.event_name == 'pull_request_target' && " +
"github.event.action == 'review_requested' && " +
`github.event.requested_reviewer.login == '${botLogin}'`,
);and extend — qwen3.8-max via Qwen Code /review (v0.21.12) |
||
| expect(cond).toContain( | ||
| `github.event.requested_reviewer.login == '${botLogin}'`, | ||
| ); | ||
| }); | ||
| }); | ||
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.
[Suggestion] This new KEEP IN SYNC comment names three sync sites (
precheck-pr.if,authorize.if, and thebot_loginconstant), but the pin tests this PR adds enforce only two — nothing pinsprecheck-pr.if's pre-existingrequested_reviewer.login == 'qwen-code-ci-bot'predicate. — Failure scenario: a future bot-login rename (or a one-sided clause edit) updates the three pinned sites and passes CI, leavingprecheck-pr.ifstale; on a fork PR where the bot is requested for review,precheck-prthen skips,decisionis never'allow_triage',authorize's fork gate fails, and the bot silently stops reviewing fork PRs with no test failing.Pin the third site too so all three fail together on drift:
— qwen3.8-max via Qwen Code /review (v0.21.12)