Skip to content

[CI Failure Doctor] CI Failure Investigation - Run #37890 #18440

@github-actions

Description

@github-actions

Summary

The test job and the Integration: CLI Update Command job both fail on main at commit 78ecf47823d96945c35bf6868cea2cc31dbd8e2c. The unit failures stem from tests that assume legacy behavior: the PR transfer subcommand test insists on a local --verbose flag and the action pin sorting test checks for exactly 37 entries, while the integration test still expects gh aw update to error when no workflows have a source field despite the new graceful-path behavior.

Failure Details

Root Cause Analysis

  1. TestNewPRTransferSubcommand calls cmd.Flags().Lookup("verbose"), but the transfer subcommand does not register a local --verbose flag—the flag comes from the root command (cmd/gh-aw/main.go sets a persistent --verbose/-v). The inherited flag is therefore not visible through cmd.Flags().Lookup, so the test fails at pr_command_test.go:187 with "Expected --verbose flag to exist".
  2. TestGetActionPinsSorting expects getActionPins() to return 37 entries, but pkg/workflow/data/action_pins.json now contains 38 pins (the embedded JSON is being marshaled once in getActionPins()), so the length assertion fails with "getActionPins() returned 38 pins, expected 37".
  3. TestUpdateCommand_NoMergeFlag asserts that gh aw update --no-merge --verbose should error when no workflows contain a source field, but UpdateWorkflows now prints an info message and returns nil when the scan yields zero workflows (see pkg/cli/update_workflows.go lines 31‑39). The integration test therefore reports An error is expected but got nil even though the behavior change is intentional.

Failed Jobs and Errors

  • test: Fails because pr_command_test.go:187 cannot find a local --verbose flag, and action_pins_test.go:302 sees 38 pins instead of 37 (the embedded data has grown). The earlier failure message was pr_command_test.go:187: Expected --verbose flag to exist, and the later message was action_pins_test.go:302: getActionPins() returned 38 pins, expected 37.
  • Integration: CLI Update Command: TestUpdateCommand_NoMergeFlag fails with Error: An error is expected but got nil. and the command output ℹ no workflows found with source field, because the code now exits gracefully when there are no source workflows.
Investigation Findings
  • The root persistent --verbose flag defined in cmd/gh-aw/main.go is inherited by the pr transfer subcommand, but the unit test only looks at cmd.Flags(), so it misses the inherited flag. The test should either register its own verbose flag or inspect inherited flags.
  • getActionPins unmarshals the embedded JSON from pkg/workflow/data/action_pins.json and sorts all entries; the file currently lists 38 entries, so a hard-coded expectation of 37 in TestGetActionPinsSorting is obsolete.
  • UpdateWorkflows now bails out with a success return value when no workflows with a source field are found, printing no workflows found with source field. TestUpdateCommand_NoMergeFlag should assert that the command succeeds (and optionally check for the info message) rather than expecting a failure.

Recommended Actions

  • Update TestNewPRTransferSubcommand to look for the inherited --verbose flag (e.g., via cmd.InheritedFlags() or cmd.PersistentFlags()) or register the flag locally so the lookup succeeds.
  • Relax TestGetActionPinsSorting so it does not depend on a rigid count of 37 entries—either bump the expected count to 38 when new pins are added or assert on sorted order/field validity instead.
  • Refresh TestUpdateCommand_NoMergeFlag to reflect the new graceful path when no workflows have a source field; it should assert that the command exits cleanly and prints the expected info message rather than failing.

Prevention Strategies

Keep CLI tests aligned with how flags are registered (local vs. inherited) and avoid hard-coded counts derived from embedded data files so they don't break whenever the data set changes.

AI Team Self-Improvement

  • When testing CLI flag availability, check inherited flags or confirm the command registers the flag locally before asserting.
  • Prefer assertions about the shape/sorting of data-driven lists rather than exact sizes that will break whenever the data set changes.
  • When regression fixes adjust exit paths (e.g., returning success instead of failure), update the corresponding integration tests to assert on the new success path instead of expecting the old failure.
Historical Context
  • Search repo:github/gh-aw label:cookie "[CI Failure Doctor]" "Run #37890" returned no results, so this failure is not already tracked.

🩺 Diagnosis provided by CI Failure Doctor

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d
  • expires on Feb 27, 2026, 3:17 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    cookieIssue Monster Loves Cookies!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions