Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Investigation Plan

  • Examine the GitHub Actions failure logs
  • Identify the root cause: path.resolve() creates absolute paths which break GitHub API file reader
  • Fix the path resolution in frontmatter_hash_pure.cjs
  • Add integration tests to reproduce the issue
  • Verify the fix works locally and in CI

Root Cause

The processImportsTextBased function uses path.resolve(baseDir, importPath) to compute import paths. When baseDir is a relative path like .github/workflows and we're in a working directory, path.resolve creates an absolute filesystem path like /home/runner/work/gh-aw/gh-aw/.github/workflows/shared/gh.md.

This absolute path is then passed to the GitHub API file reader, which expects repository-relative paths like .github/workflows/shared/gh.md. The GitHub API fails to fetch the file, causing imports to be skipped, which changes the frontmatter hash.

Solution

Replaced path.resolve with path.join for import path resolution. This preserves the relative nature of paths when using the GitHub API reader.

Changes Made

  1. Fixed path resolution in frontmatter_hash_pure.cjs:

    • Changed path.resolve(baseDir, importPath) to path.join(baseDir, importPath)
    • This ensures paths remain repository-relative for GitHub API compatibility
  2. Added integration tests in frontmatter_hash_github_api.test.cjs:

    • Test that verifies all GitHub API requests use repository-relative paths (not absolute)
    • Test that verifies hash computation produces identical results with filesystem and GitHub API readers
    • Uses smoke-codex.md workflow which has imports to test the full path resolution flow

Testing

All tests pass:

  • frontmatter_hash_pure.test.cjs (25 tests)
  • frontmatter_hash_github_api.test.cjs (12 tests including 2 new tests)
  • check_workflow_timestamp_api.test.cjs (21 tests)
Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/21580838664/job/62177654751#step:4:1

The lock file is up to date and the fronmatter hashes should matc. Investigate what is happening and add integration tests to reproduce this issue.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Use path.join instead of path.resolve to preserve repository-relative paths
when computing frontmatter hashes with the GitHub API file reader. This fixes
the issue where absolute filesystem paths were being passed to the GitHub API,
causing import files to fail loading and producing incorrect hash values.

Add integration tests to verify that:
- All paths passed to GitHub API are repository-relative (not absolute)
- Hash computation produces identical results with filesystem and GitHub API readers

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review February 2, 2026 07:51
@pelikhan pelikhan merged commit 4bb08bc into copilot/update-workflow-hash-check Feb 2, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/investigate-fronmatter-hashes branch February 2, 2026 07:52
Copilot AI requested a review from pelikhan February 2, 2026 07:52
Copilot stopped work on behalf of pelikhan due to an error February 2, 2026 07:52
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.

2 participants