Skip to content

fix: refactor cache-checkout to use actions/cache@v4 with fallback#26702

Merged
keithwillcode merged 2 commits intomainfrom
devin/fix-cache-checkout-propagation-1768071212
Jan 10, 2026
Merged

fix: refactor cache-checkout to use actions/cache@v4 with fallback#26702
keithwillcode merged 2 commits intomainfrom
devin/fix-cache-checkout-propagation-1768071212

Conversation

@keithwillcode
Copy link
Contributor

What does this PR do?

Fixes cache propagation delay issues with Blacksmith's distributed cache that were causing CI failures.

Root cause: The Prepare job saves the cache, but subsequent jobs starting ~14 seconds later couldn't find it because the cache hadn't propagated yet in Blacksmith's distributed system. The previous implementation used separate actions/cache/save@v4 and actions/cache/restore@v4 with fail-on-cache-miss: true, which caused immediate failures.

Solution: Refactored cache-checkout to use actions/cache@v4 (combined save/restore) with a fallback to do the checkout if cache miss occurs. This matches the pattern used by cache-build and cache-db which don't have this issue.

Changes:

  • Refactored cache-checkout action to use actions/cache@v4 instead of separate save/restore
  • Added fallback checkout step when cache miss occurs (using same sparse-checkout config as dangerous-git-checkout)
  • Removed mode input (no longer needed)
  • Updated all 19 workflow files to use the simplified cache-checkout action
  • Removed separate dangerous-git-checkout step from pr.yml Prepare job (now handled by cache-checkout)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - CI workflow changes only.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works. N/A - CI workflow changes can only be tested by running the actual CI pipeline.

How should this be tested?

  1. Create/update a PR to trigger the CI workflow
  2. Observe the Prepare job - it should save the cache on first run (cache miss triggers checkout)
  3. Observe subsequent jobs (type-check, lint, etc.) - they should either:
    • Hit the cache and skip checkout, OR
    • Miss the cache and perform checkout via the fallback step (instead of failing)
  4. Verify all CI jobs complete successfully

Checklist

  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings

Human Review Checklist

  • Verify the fallback checkout uses correct ref (github.event.pull_request.head.sha) in all workflow contexts
  • Confirm cache key format is unchanged for backward compatibility
  • Run CI on this PR to validate the fix works

This fixes cache propagation delay issues with Blacksmith's distributed cache.

The previous implementation used separate save/restore actions with
fail-on-cache-miss: true, which failed when the cache wasn't immediately
available after being saved by the Prepare job.

The new implementation uses actions/cache@v4 (combined save/restore)
with a fallback to do the checkout if cache miss, matching the pattern
used by cache-build and cache-db which don't have this issue.

Changes:
- Refactored cache-checkout action to use actions/cache@v4
- Added fallback checkout step when cache miss occurs
- Removed mode input (no longer needed)
- Updated all workflows to use the simplified cache-checkout action

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@keithwillcode keithwillcode self-assigned this Jan 10, 2026
@keithwillcode keithwillcode added this to the v6.1 milestone Jan 10, 2026
@keithwillcode keithwillcode marked this pull request as ready for review January 10, 2026 19:21
@keithwillcode keithwillcode requested a review from a team as a code owner January 10, 2026 19:21
@keithwillcode
Copy link
Contributor Author

@graphite-app graphite-app bot added core area: core, team members only foundation labels Jan 10, 2026
@keithwillcode
Copy link
Contributor Author

@keithwillcode keithwillcode enabled auto-merge (squash) January 10, 2026 19:23
@keithwillcode keithwillcode added the High priority Created by Linear-GitHub Sync label Jan 10, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 20 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name=".github/actions/cache-checkout/action.yml">

<violation number="1" location=".github/actions/cache-checkout/action.yml:20">
P1: Missing fallback for `ref` parameter will break this action in non-PR contexts (e.g., `workflow_dispatch`). The cache key correctly uses `${{ github.event.pull_request.head.sha || github.sha }}` but the checkout `ref` lacks the same fallback.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

!node_modules
!**/node_modules
key: git-checkout-${{ github.head_ref || github.ref_name }}-${{ github.event.pull_request.head.sha || github.sha }}
ref: ${{ github.event.pull_request.head.sha }}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 10, 2026

Choose a reason for hiding this comment

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

P1: Missing fallback for ref parameter will break this action in non-PR contexts (e.g., workflow_dispatch). The cache key correctly uses ${{ github.event.pull_request.head.sha || github.sha }} but the checkout ref lacks the same fallback.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/actions/cache-checkout/action.yml, line 20:

<comment>Missing fallback for `ref` parameter will break this action in non-PR contexts (e.g., `workflow_dispatch`). The cache key correctly uses `${{ github.event.pull_request.head.sha || github.sha }}` but the checkout `ref` lacks the same fallback.</comment>

<file context>
@@ -1,33 +1,26 @@
-          !node_modules
-          !**/node_modules
-        key: git-checkout-${{ github.head_ref || github.ref_name }}-${{ github.event.pull_request.head.sha || github.sha }}
+        ref: ${{ github.event.pull_request.head.sha }}
+        fetch-depth: 2
+        sparse-checkout-cone-mode: false
</file context>

Fix confidence (alpha): 10/10

Suggested change
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
Fix with Cubic

@github-actions
Copy link
Contributor

Devin AI is addressing Cubic AI's review feedback

New feedback has been sent to the existing Devin session.

View Devin Session

@keithwillcode keithwillcode merged commit bf4cdf6 into main Jan 10, 2026
105 of 110 checks passed
@keithwillcode keithwillcode deleted the devin/fix-cache-checkout-propagation-1768071212 branch January 10, 2026 19:26
@github-actions
Copy link
Contributor

E2E results are ready!

Anshumancanrock pushed a commit to Anshumancanrock/cal.com that referenced this pull request Jan 12, 2026
…alcom#26702)

This fixes cache propagation delay issues with Blacksmith's distributed cache.

The previous implementation used separate save/restore actions with
fail-on-cache-miss: true, which failed when the cache wasn't immediately
available after being saved by the Prepare job.

The new implementation uses actions/cache@v4 (combined save/restore)
with a fallback to do the checkout if cache miss, matching the pattern
used by cache-build and cache-db which don't have this issue.

Changes:
- Refactored cache-checkout action to use actions/cache@v4
- Added fallback checkout step when cache miss occurs
- Removed mode input (no longer needed)
- Updated all workflows to use the simplified cache-checkout action

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview – cal-companion January 13, 2026 08:22 Inactive
@vercel vercel bot temporarily deployed to Preview – dev January 13, 2026 08:23 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only foundation High priority Created by Linear-GitHub Sync ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants