Skip to content

fix: canary_go gracefully handles missing test-result artifacts and runs on main only#23612

Closed
Copilot wants to merge 6 commits intomainfrom
copilot/fix-failing-github-actions-workflow-another-one
Closed

fix: canary_go gracefully handles missing test-result artifacts and runs on main only#23612
Copilot wants to merge 6 commits intomainfrom
copilot/fix-failing-github-actions-workflow-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

canary_go crashes with find: 'test-results': No such file or directory when upstream test jobs are cancelled — actions/download-artifact only creates the destination directory when it actually downloads files, so zero matches leaves nothing on disk.

Changes

  • "List downloaded artifacts": add mkdir -p test-results so the directory always exists regardless of download outcome
  • "Extract executed tests": check JSON file count before invoking the extract script; create an empty executed-tests.txt with a warning when no artifacts are present
  • "Compare test coverage": skip the comparison when executed-tests.txt is empty, emitting a clear message instead of a misleading failure
  • Restrict to main branch: added github.ref == 'refs/heads/main' to the if condition so canary_go only runs on pushes to main, not on pull requests or other branches
Original prompt

Fix the failing GitHub Actions workflow canary_go
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 69274171589
Job URL: https://github.com/github/gh-aw/actions/runs/23774798380/job/69274171589



✨ PR Review Safe Output Test - Run 23775212172

💥 [THE END] — Illustrated by Smoke Claude ·

Copilot AI and others added 4 commits March 31, 2026 00:11
Implements the trusted-users feature for the GitHub MCP server guard policy:

- Add TrustedUsers/TrustedUsersExpr fields to GitHubToolConfig
- Add parsing for trusted-users in tools_parser.go (same pattern as blocked-users)
- Add validation for trusted-users in tools_validation.go (requires min-integrity)
- Add EnvVarGitHubTrustedUsers constant in pkg/constants/constants.go
- Update getGitHubGuardPolicies() to include trusted-users in allow-only policy
- Update generateParseGuardVarsStep to pass GH_AW_TRUSTED_USERS_* env vars
- Update parse_guard_list.sh to process trusted-users alongside blocked-users
- Update cache_integrity.go to properly include trusted-users in cache key
- Update main_workflow_schema.json to add trusted-users schema definition
- Add tests in compile_guard_policy_test.go and tools_validation_test.go
- Update frontmatter-full.md and access control specification docs

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd194832-da7e-4ca5-8540-1e7fb73bbdb2

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…acts downloaded

When all test jobs are cancelled (e.g., due to an earlier CI failure), the
`actions/download-artifact` action downloads 0 artifacts and never creates the
`test-results` directory. The subsequent `find test-results` command fails with
"No such file or directory".

Fix by:
1. Creating `test-results` dir explicitly before running `find`
2. Handling the case where no JSON artifacts exist: create empty executed-tests.txt
3. Skipping coverage comparison when no test data is available, with a clear message

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0c4bcdc3-11f9-4f7d-8e37-f9ae067c9647

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix the failing GitHub Actions workflow canary_go fix: canary_go gracefully handles missing test-result artifacts Mar 31, 2026
Copilot AI requested a review from lpcox March 31, 2026 00:54
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot only execute canary-go for the main branch

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude

- name: List downloaded artifacts
run: |
set -euo pipefail
mkdir -p test-results
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.

Good defensive fix — ensuring test-results/ always exists prevents the find command from failing when no artifacts were downloaded. This is a pattern worth documenting in the CI README for future contributors.

fi
./scripts/compare-test-coverage.sh all-tests.txt executed-tests.txt

- name: Upload test coverage report
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.

The empty-file guard with [ ! -s executed-tests.txt ] is a clean way to handle the no-artifacts case. The warning messages are informative and actionable.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/8f58a511-ef49-46a9-a631-b95b810d2e64

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot only execute canary-go for the main branch

Done in 09a0caa — added && github.ref == 'refs/heads/main' to the if condition so canary_go only runs on the main branch.

Copilot AI changed the title fix: canary_go gracefully handles missing test-result artifacts fix: canary_go gracefully handles missing test-result artifacts and runs on main only Mar 31, 2026
Copilot AI requested a review from pelikhan March 31, 2026 01:08
Base automatically changed from copilot/feat-add-trusted-users-config-schema to main March 31, 2026 01:39
@pelikhan
Copy link
Copy Markdown
Collaborator

@pelikhan pelikhan closed this Mar 31, 2026
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