fix: gh aw health always returns "No workflow runs found"#20221
fix: gh aw health always returns "No workflow runs found"#20221
Conversation
…o health metrics Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
|
@copilot Keep the filter, we only want to see agentic workflows here (.lock.yml), not regular actions workflows (.yml). But investigate why, with the filter in place, this might have been emtpy. |
…ter works Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Restored the filter. The root cause was a code regression, not a Timeline:
Fix (def364a): Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Add tests to ensure this cannot happen again. |
… JSON query Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Added in commit
The JSON fields string was also extracted to the named constant |
|
@copilot Only keep fix the string that was missing "path" . Keep changes to the code minimal. |
…WorkflowPath bridge and .lock.yml filter Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Done in |
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression where gh aw health always reported "No workflow runs found" because the path field was accidentally dropped from the gh run list --json query. The WorkflowPath field on WorkflowRun was always empty, causing the .lock.yml suffix filter in fetchWorkflowRuns to discard every run.
Changes:
- Restores
pathto the--jsonfield list inlistWorkflowRunsWithPaginationand adds an unmarshal bridge to map thepathJSON key toWorkflowRun.WorkflowPath(which uses theworkflowPathJSON tag). - Adds a new test file with two regression tests: one verifying the JSON unmarshal bridge and one verifying the
.lock.ymlfilter logic.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pkg/cli/logs_github_api.go |
Adds path back to the --json field list and uses a helper struct during unmarshal to bridge the path → WorkflowPath field name mismatch. |
pkg/cli/logs_github_api_test.go |
New test file with regression tests for the path field unmarshal and the .lock.yml filter logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gh aw healthreported no workflow runs even when runs existed, becauserun.WorkflowPathwas always"", making the.lock.ymlfilter infetchWorkflowRunsalways false and silently discarding every run.Root cause
The
pathfield was accidentally dropped from thegh run list --jsonfield list in commit61cc2d7ac(Jan 4 2026, "Add exit code and stderr logging…"), one day after it had been deliberately added in8c97bcaa0(Jan 3 2026, "Fix missing workflow_path field in logs JSON output"). This was a code regression — not aghversion change.The health command (added Jan 29 2026) relied on
WorkflowPathbeing populated to drive this filter:Since
pathwas absent from the query,run.WorkflowPathwas always""and every run was discarded.Fix
pathis restored to the--jsonfield list inlistWorkflowRunsWithPagination. Becausegh run listoutputs the keypathwhileWorkflowRunserialises it asworkflowPath(for backward compatibility), the unmarshal step uses a local helper struct to bridge the field name difference before the runs are returned. The.lock.ymlfilter infetchWorkflowRunsis preserved as intended.Regression tests
A new test file
pkg/cli/logs_github_api_test.goensures this cannot recur:TestWorkflowRunPathFieldUnmarshal— verifies thepathJSON key is correctly bridged toWorkflowRun.WorkflowPathduring unmarshalTestFetchWorkflowRunsLockYMLFilter— verifies the.lock.ymlfilter includes agentic runs, excludes plain.ymlruns, calculates durations, and rejects emptyWorkflowPath(the pre-fix state)💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.