Skip to content

Commit 7fa8abc

Browse files
Optimize Merge Queue with Concurrency and Failure Notifications (#256)
- **Add concurrency to all workflows** - Cancel in-progress runs when new commits arrive - **Protect test summaries from cancellation** - Prevent false failures when workflows are cancelled - **Add merge queue failure notifications** - Post PR comment with failed job details when ejected from queue - **Add Lemonade Server smoke test** - Quick validation before full integration tests ## Changes ### Concurrency All workflows now include: ```yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true ``` ### Cancellation Protection Test summary jobs use robust `if` conditions to handle cancellation gracefully: ```yaml if: >- ${{ always() && !cancelled() && needs.job1.result != 'cancelled' && needs.job2.result != 'cancelled' }} ``` ### Merge Queue Notification New `merge-queue-notify.yml` workflow: - Triggers on workflow completion for merge queue runs - Extracts PR number from merge queue branch name - Posts comment with failed jobs and direct links to logs ### Lemonade Smoke Test New `test_lemonade_server.yml` workflow: - Validates health endpoint returns `context_size` - Tests basic completion endpoint - Runs before Windows/Linux integration tests ### Reusable Start-Lemonade Action New `.github/actions/start-lemonade/` composite action: - Cross-platform (Windows/Linux) - Configurable model, port, context size - Sets UTF-8 encoding automatically ## Test Plan - [x] Verify concurrency cancels old runs on new push - [x] Verify test summaries pass when some jobs are skipped - [ ] Trigger merge queue failure and verify PR comment appears - [x] Verify Lemonade smoke test runs before integration tests - Closes #261 --------- Co-authored-by: kovtcharov-amd <kalin.ovtcharov@amd.com>
1 parent b4696ee commit 7fa8abc

20 files changed

Lines changed: 340 additions & 14 deletions

.github/workflows/docs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
- 'docs/**'
1414
- '.github/workflows/docs.yml'
1515

16+
# Cancel in-progress runs when a new run is triggered
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
19+
cancel-in-progress: true
20+
1621
jobs:
1722
validate:
1823
runs-on: ubuntu-latest

.github/workflows/lint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
merge_group:
1919
workflow_dispatch:
2020

21+
# Cancel in-progress runs when a new run is triggered
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
24+
cancel-in-progress: true
25+
2126
permissions:
2227
contents: read
2328

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: MIT
3+
4+
# Notifies PR authors when their PR fails in the merge queue
5+
# Watches for workflow completions triggered by merge_group events
6+
7+
name: Merge Queue Failure Notification
8+
9+
on:
10+
workflow_run:
11+
workflows:
12+
- "GAIA CLI Tests (All Platforms)"
13+
- "Code Quality (Lint)"
14+
- "Unit Tests"
15+
types:
16+
- completed
17+
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
actions: read
22+
23+
jobs:
24+
notify-on-failure:
25+
name: Notify on Merge Queue Failure
26+
runs-on: ubuntu-latest
27+
# Only run if the triggering workflow was from a merge_group and failed
28+
if: >
29+
github.event.workflow_run.event == 'merge_group' &&
30+
github.event.workflow_run.conclusion == 'failure'
31+
steps:
32+
- name: Post failure comment to PR
33+
uses: actions/github-script@v7
34+
with:
35+
script: |
36+
// Extract PR number from merge queue branch name (e.g., gh-readonly-queue/main/pr-254-...)
37+
const headBranch = context.payload.workflow_run.head_branch || '';
38+
const prMatch = headBranch.match(/pr-(\d+)/);
39+
40+
if (!prMatch) {
41+
console.log('Could not extract PR number from branch:', headBranch);
42+
console.log('This may not be a merge queue run');
43+
return;
44+
}
45+
46+
const prNumber = parseInt(prMatch[1], 10);
47+
const workflowRun = context.payload.workflow_run;
48+
const runUrl = workflowRun.html_url;
49+
const workflowName = workflowRun.name;
50+
51+
// Get the failed jobs for more detail
52+
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
run_id: workflowRun.id,
56+
});
57+
58+
const failedJobs = jobs.jobs.filter(job => job.conclusion === 'failure');
59+
const failedJobsList = failedJobs.length > 0
60+
? failedJobs.map(job => ` - [${job.name}](${job.html_url})`).join('\n')
61+
: ' - Check workflow run for details';
62+
63+
const body = `## Merge Queue Failure
64+
65+
Your PR was removed from the merge queue due to test failures in **${workflowName}**.
66+
67+
**Failed jobs:**
68+
${failedJobsList}
69+
70+
**Full workflow run:** [View logs](${runUrl})
71+
72+
<sub>This comment was automatically generated.</sub>`;
73+
74+
// Check if we already posted a comment for this run to avoid duplicates
75+
const { data: comments } = await github.rest.issues.listComments({
76+
owner: context.repo.owner,
77+
repo: context.repo.repo,
78+
issue_number: prNumber,
79+
});
80+
81+
const existingComment = comments.find(c =>
82+
c.body.includes('Merge Queue Failure') &&
83+
c.body.includes(runUrl)
84+
);
85+
86+
if (existingComment) {
87+
console.log('Comment already exists for this run, skipping');
88+
return;
89+
}
90+
91+
await github.rest.issues.createComment({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
issue_number: prNumber,
95+
body: body,
96+
});
97+
98+
console.log(`Posted failure notification to PR #${prNumber}`);

.github/workflows/test_agent_mcp_server.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
merge_group:
1616
workflow_dispatch:
1717

18+
# Cancel in-progress runs when a new run is triggered
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
21+
cancel-in-progress: true
22+
1823
jobs:
1924
test-mcp-agent:
2025
name: Test MCPAgent (${{ matrix.os }})
@@ -106,7 +111,10 @@ jobs:
106111
name: Test Summary
107112
needs: test-mcp-agent
108113
runs-on: ubuntu-latest
109-
if: always()
114+
# Run always except when workflow or dependency is cancelled
115+
if: >-
116+
${{ always() && !cancelled() &&
117+
needs.test-mcp-agent.result != 'cancelled' }}
110118
permissions: {}
111119

112120
steps:

.github/workflows/test_api.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
merge_group:
1717
workflow_dispatch:
1818

19+
# Cancel in-progress runs when a new run is triggered
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
22+
cancel-in-progress: true
23+
1924
permissions:
2025
contents: read
2126

.github/workflows/test_chat_agent.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
merge_group:
1717
workflow_dispatch:
1818

19+
# Cancel in-progress runs when a new run is triggered
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
22+
cancel-in-progress: true
23+
1924
permissions:
2025
contents: read
2126

.github/workflows/test_chat_sdk.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ on:
2424
merge_group:
2525
workflow_dispatch:
2626

27+
# Cancel in-progress runs when a new run is triggered
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
30+
cancel-in-progress: true
31+
2732
permissions:
2833
contents: read
2934

.github/workflows/test_code_agent.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
merge_group:
1717
workflow_dispatch:
1818

19+
# Cancel in-progress runs when a new run is triggered
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
22+
cancel-in-progress: true
23+
1924
permissions:
2025
contents: read
2126

.github/workflows/test_electron.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
merge_group:
1414
workflow_dispatch:
1515

16+
# Cancel in-progress runs when a new run is triggered
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
19+
cancel-in-progress: true
20+
1621
permissions:
1722
contents: read
1823
pull-requests: write

.github/workflows/test_embeddings.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
merge_group:
1414
workflow_dispatch:
1515

16+
# Cancel in-progress runs when a new run is triggered
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
19+
cancel-in-progress: true
20+
1621
permissions:
1722
contents: read
1823

0 commit comments

Comments
 (0)