Skip to content

[WIP] Fix failing GitHub Actions job Integration: CMD Tests - #49110

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-integration-cmd-tests
Jul 30, 2026
Merged

[WIP] Fix failing GitHub Actions job Integration: CMD Tests#49110
pelikhan merged 4 commits into
mainfrom
copilot/fix-integration-cmd-tests

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Fix the failing GitHub Actions job "Integration: CMD Tests"
Analyze the Actions logs, identify the root cause of the failure, and implement a fix.
Check run ID: 90837263591
Job URL: https://github.com/github/gh-aw/actions/runs/30532294712/job/90837263591

Copilot AI and others added 2 commits July 30, 2026 10:23
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…llel subtests

Cobra v1.10.2's Commands() method has a non-thread-safe lazy sort. When
t.Parallel() subtests all call rootCmd.Commands() concurrently before the
first sort has completed, multiple goroutines can corrupt the internal
commands slice, causing commands to appear "missing".

Fix by building a command lookup map once (serially) before any subtest
calls t.Parallel(), so Commands() is invoked exactly once and the
resulting map is read-only in all parallel subtests.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan July 30, 2026 10:30
@pelikhan
pelikhan marked this pull request as ready for review July 30, 2026 10:39
Copilot AI review requested due to automatic review settings July 30, 2026 10:39
@pelikhan
pelikhan merged commit 5ada86d into main Jul 30, 2026
19 of 20 checks passed
@pelikhan
pelikhan deleted the copilot/fix-integration-cmd-tests branch July 30, 2026 10:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Attempts to fix flaky command-group integration tests by avoiding Cobra command lookups inside parallel subtests.

Changes:

  • Precomputes command lookup maps before parallel subtests.
  • Replaces repeated command scans with map access.
Show a summary per file
File Description
cmd/gh-aw/command_groups_test.go Precomputes command maps to reduce concurrent Cobra sorting.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

cmd/gh-aw/command_groups_test.go:149

  • This second lookup is built by another top-level test that also calls t.Parallel(), so it can race with the lookup construction in TestCommandGroupAssignments. Moving the call ahead of only the parallel subtests does not prevent concurrent Commands() sorting across the two parent tests; use one shared pre-parallel lookup or make these parent tests run serially.
	commandMap := make(map[string]*cobra.Command, len(rootCmd.Commands()))
	for _, cmd := range rootCmd.Commands() {
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment on lines +76 to +77
commandMap := make(map[string]*cobra.Command, len(rootCmd.Commands()))
for _, cmd := range rootCmd.Commands() {
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants