ci(verify): give each CodeBuild job a unique runner label - #2229
Conversation
Every CodeBuild job in a run shares the codebuild-agentcore-e2e label and CodeBuild registers each runner with all labels its job requested, so a runner created for the Windows job also satisfies the plain Linux job. GitHub then runs the Linux job on Windows and the Windows job never gets a runner. A per-job label makes each job match only its own runner. https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-action-runners-update-labels.html
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nice diagnosis. The runner-label superset problem is a well-documented CodeBuild/GitHub Actions failure mode, and the fix — a unique per-job label appended to each entry in the verify.yml matrix — is the standard remediation AWS recommends. Both runner JSON arrays are valid, the Windows entry preserves image:windows-1.0 for image selection, and the two new labels (verify-linux, verify-windows) will be ignored by CodeBuild for build configuration while forcing GitHub's routing to be unambiguous.
One thing worth keeping in mind (already called out in the PR description, so no change needed here): any future job that joins the same workflow run and requests only the base codebuild-agentcore-e2e-<run>-<attempt> label can still be picked up by the verify-linux runner. If more CodeBuild jobs get added later, they'll each need their own unique label too.
No source changes, no test/telemetry surface — safe to merge.
|
Claude Security Review: no high-confidence findings. (run) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2229 +/- ##
=========================================
Coverage 96.97% 96.97%
=========================================
Files 559 559
Lines 38581 38581
=========================================
Hits 37412 37412
Misses 1169 1169 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Gives the Linux and Windows
verifymatrix jobs a unique runner label (verify-linux,verify-windows) so GitHub cannot route one job to the runner CodeBuild created for the other.Every CodeBuild job in a workflow run shares the
codebuild-agentcore-e2e-<run_id>-<attempt>label, and CodeBuild registers each ephemeral runner with every label its job requested. The Windows runner therefore carries{base, image:windows-1.0}, a superset of the plain Linux job's{base}. When the Windows runner registers while the Linux job is still queued, GitHub hands it the Linux job. The Linux runner that arrives next has only{base}, so the Windows job never matches and sits queued until someone cancels and reruns.Attempt 1 of the three runs reported in Slack shows exactly this pattern. In each, the Windows job was queued a few seconds before the Linux job, was cancelled without ever getting a runner, and a plain-label Linux job failed on a CodeBuild runner:
AWS documents this failure mode and recommends a unique custom label per job: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-action-runners-update-labels.html. CodeBuild ignores labels it does not recognize for build configuration but still registers them on the runner, so
verify-linuxandverify-windowsonly affect routing.Any future CodeBuild job added to a run that also calls
verify.ymlneeds its own label too, otherwise a plain-label job can still be picked up by theverify-linuxrunner and strand the Linux verify job.Originally opened as #2222 into the #2206 branch. Rebased onto
refactorafter #2206 merged, so CI on this PR exercises the new labels directly.Related Issue
N/A. CI routing fix for the runner mis-assignment reported in Slack. Follows #2206, which introduced
verify.yml.Documentation PR
N/A
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsrunnervalue as JSON with the expressions substitutedverify.ymlwith the new labels; each CodeBuild job should land on its own runnerSource tests were not run because this change only touches workflow runner labels.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.