Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/qwen-autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,15 @@ jobs:
runs-on: 'ubuntu-latest'
timeout-minutes: 5
concurrency:
group: 'qwen-autofix-route'
cancel-in-progress: true
# Cron ticks dedupe among themselves (a newer tick supersedes a queued
# one). Dispatches and review/issue events each route independently:
# under runner backlog a route job can sit QUEUED for minutes, and the
# old shared cancel-in-progress group let any newer event kill pending
# full scans — observed as hours of scan starvation during review-event
# storms. Route is a seconds-long job, so unique groups cost nothing.
group: "${{ github.event_name == 'schedule' && 'qwen-autofix-route-cron' || format('qwen-autofix-route-{0}', github.run_id) }}"
Comment thread
wenshao marked this conversation as resolved.
Resolved
cancel-in-progress: |-
${{ github.event_name == 'schedule' }}
permissions:
contents: 'read'
outputs:
Expand Down Expand Up @@ -1152,7 +1159,11 @@ jobs:
--arg round "${ROUND}" --arg wm "${EFF_WM}" \
'. + [{pr: $pr, branch: $branch, issue: $issue, round: $round, watermark: $wm}]' \
<<< "${TARGETS}")"
break # one PR per scheduled scan
# Fan out: emit EVERY eligible PR. The address matrix bounds
Comment thread
wenshao marked this conversation as resolved.
Resolved
# simultaneity (max-parallel) and the per-PR concurrency groups
# prevent duplicate same-PR runs, so one scan drains the whole
# backlog instead of serving a single newest-first target per tick
# (which starved older PRs for hours when cron ticks were sparse).
done

COUNT="$(jq 'length' <<< "${TARGETS}")"
Expand Down
23 changes: 19 additions & 4 deletions scripts/tests/qwen-autofix-workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('qwen-autofix workflow', () => {
expect(workflow).toContain('.[0:10] | map(. + {autofixTier: 1})');
});

it('runs scheduled autofix as a 10-minute single-target worker', () => {
it('runs scheduled autofix as a 10-minute multi-target fan-out worker', () => {
expect(workflow).toContain("cron: '*/10 * * * *'");
expect(workflow).not.toContain("cron: '0 0,12 * * *'");
expect(workflow).not.toContain("cron: '0 4,8,16,20 * * *'");
Expand All @@ -215,7 +215,13 @@ describe('qwen-autofix workflow', () => {
expect(reviewScanJob).toContain('isCrossRepository');
expect(reviewScanJob).toContain('not an open in-repo main-targeting PR');
expect(reviewScanJob).toContain('.isCrossRepository != true');
expect(reviewScanJob).toContain('break # one PR per scheduled scan');
// Fan-out: one scan emits EVERY eligible PR (no single-target break). The
// address matrix's max-parallel bounds simultaneity and per-PR concurrency
// groups prevent duplicate same-PR runs; a single-target break starved
// older PRs for hours whenever cron ticks were sparse.
expect(reviewScanJob).not.toContain('break # one PR per scheduled scan');
expect(reviewScanJob).toContain('Fan out: emit EVERY eligible PR');

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] Follow-up only: this assertion pins explanatory prose rather than behavior, so a harmless comment rewording fails the suite while neighboring checks already cover the fan-out controls. Remove this literal-comment assertion or replace it with an executable loop behavior check.

— Codex GPT-5 via Qwen Code /review

expect(workflow).toContain("max-parallel: 3");
expect(reviewScanJob).toContain('statusCheckRollup');
expect(reviewScanJob).toContain('HAS_PENDING_CHECKS');
expect(reviewScanJob).toContain('N_FAILED_CHECKS');
Expand Down Expand Up @@ -303,8 +309,17 @@ describe('qwen-autofix workflow', () => {
"ASSIGNEE_LOGIN: '${{ github.event.assignee.login }}'",
);
expect(workflow).toContain("permissions:\n contents: 'read'");
expect(routeJob).toContain("group: 'qwen-autofix-route'");
expect(routeJob).toContain('cancel-in-progress: true');
// Route concurrency: cron ticks share one group and supersede each other,
// but dispatches and review/issue events get unique per-run groups — a
// shared cancel-in-progress group let any newer event kill pending full
// scans while route jobs sat queued behind runner backlog.
expect(routeJob).toContain(
"group: \"${{ github.event_name == 'schedule' && 'qwen-autofix-route-cron' || format('qwen-autofix-route-{0}', github.run_id) }}\"",
);
expect(routeJob).toContain(
"cancel-in-progress: |-\n ${{ github.event_name == 'schedule' }}",
);
expect(routeJob).not.toContain("group: 'qwen-autofix-route'");
expect(workflow).toContain(
'gh api "repos/${REPO}/collaborators/${SENDER_LOGIN}/permission"',
);
Expand Down
Loading