Skip to content

fix: Remove duplicate Go module cache causing tar conflicts#13942

Merged
pelikhan merged 7 commits intomainfrom
copilot/fix-github-actions-workflow-cache
Feb 5, 2026
Merged

fix: Remove duplicate Go module cache causing tar conflicts#13942
pelikhan merged 7 commits intomainfrom
copilot/fix-github-actions-workflow-cache

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Fix GitHub Actions Workflow Cache Failure

Root Cause Analysis:

  • The "Integration: Workflow Cache" job fails because of duplicate cache restoration
  • Both actions/setup-go@v6 (with cache: true) AND a separate actions/cache@v4 action restore to the same paths (~/go/pkg/mod)
  • This causes tar errors: "Cannot open: File exists" when the second cache tries to extract files that were already restored by setup-go

Fix Implemented:

  • Analyze the current cache configuration in ci.yml
  • Remove the redundant explicit cache action (was at lines 273-282 and 9 other locations)
  • Keep setup-go's built-in caching (it's more efficient and officially recommended)
  • Remove all 10 occurrences of duplicate "Cache Go modules (explicit fallback)" blocks across the CI workflow
  • Validate no other workflows have the same issue (checked ci-coach.lock.yml and go-logger.lock.yml - they cache different paths so no conflict)
  • Store memory about this pattern to prevent future issues
  • Fix missing containsRuntimeImports function causing test compilation failure
  • Format code with gofmt
  • Move helper function to test file to resolve linter warnings

Technical Details:

  • setup-go@v6 with cache: true automatically caches ~/go/pkg/mod and ~/.cache/go-build
  • Adding an explicit actions/cache for the same paths causes a conflict
  • The fix removes redundancy and follows GitHub's recommended approach

Additional Fix:

  • Implemented missing containsRuntimeImports() function for integration tests
  • This function was referenced in tests but never implemented, causing build failures
  • Function detects runtime-import macros with local paths (./, ../) but excludes URLs
  • Moved function to test file to avoid unused function linter warnings

Verification:

  • All 10 redundant cache blocks removed from ci.yml
  • No other workflows have conflicting cache configurations
  • YAML syntax validated successfully
  • All unit and integration tests pass
  • Code formatted with gofmt
  • All linter checks pass
Original prompt

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

The CI workflow was using both setup-go's built-in caching (cache: true)
and explicit actions/cache@v4, causing duplicate cache restoration to the
same paths. This resulted in tar errors "Cannot open: File exists" during
the second cache extraction.

Fixed by removing all redundant "Cache Go modules (explicit fallback)"
actions, as setup-go@v6 with cache: true already handles Go module caching
efficiently.

Fixes Integration: Workflow Cache test failures.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow cache fix: Remove duplicate Go module cache causing tar conflicts Feb 5, 2026
Copilot AI requested a review from pelikhan February 5, 2026 15:47
@pelikhan pelikhan marked this pull request as ready for review February 5, 2026 15:50
Copilot AI review requested due to automatic review settings February 5, 2026 15:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a CI workflow failure caused by duplicate Go module cache restoration. The workflow was attempting to restore the same cache paths twice - once through setup-go@v6's built-in caching and again through explicit actions/cache@v4 steps, resulting in tar extraction conflicts.

Changes:

  • Removed 11 redundant "Cache Go modules (explicit fallback)" blocks that were duplicating the caching already provided by setup-go@v6
  • Retained setup-go@v6 with cache: true as the single source of Go module caching

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

@pelikhan
Copy link
Contributor

pelikhan commented Feb 5, 2026

The function was referenced in runtime_import_checkout_test.go but was never
implemented. This caused build failures in the CI workflow.

The function checks if markdown content contains runtime-import macros with
local file paths (starting with . or ..) and excludes URLs (http/https).

This resolves the compilation error:
  pkg/workflow/runtime_import_checkout_test.go:95:14: undefined: containsRuntimeImports

All integration tests now pass.

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

Copilot AI commented Feb 5, 2026

@copilot fix tests See https://github.com/github/gh-aw/actions/runs/21718275602/job/62640375187?pr=13942

Fixed in 4218fbf. The test was referencing containsRuntimeImports() function that was never implemented. Added the missing function to runtime_detection.go - it detects runtime-import macros with local file paths while excluding URLs. All tests now pass.

Copilot AI and others added 3 commits February 5, 2026 16:01
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Moved the containsRuntimeImports helper function from runtime_detection.go
to runtime_import_checkout_test.go since it's only used in integration tests.

This resolves the unused function linter warning while keeping the function
available for the tests that need it.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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