Skip to content

fix: emit filter:'' in agent checkout when sparse-checkout is enabled (#35947)#35949

Merged
dsyme merged 4 commits into
mainfrom
dsyme/fix-blobless-clone-agent-checkout
May 30, 2026
Merged

fix: emit filter:'' in agent checkout when sparse-checkout is enabled (#35947)#35949
dsyme merged 4 commits into
mainfrom
dsyme/fix-blobless-clone-agent-checkout

Conversation

@dsyme
Copy link
Copy Markdown
Collaborator

@dsyme dsyme commented May 30, 2026

Summary

Fixes a bug where agent jobs using sparse-checkout would silently fail due to actions/checkout enabling blobless clones when a filter value is not explicitly set. When sparse-checkout is active, blobless clones require persistent credentials for subsequent git fetch calls — credentials that are not available in agent job contexts. This PR emits filter: '' in generated checkout steps whenever sparse-checkout patterns are present, disabling blobless clone behaviour and restoring pull request findability.

Changes

pkg/workflow/checkout_step_generator.go — Bug Fix (high impact)

  • Emits filter: '' in both the default and additional checkout step generators when sparse-checkout patterns are configured.
  • Prevents actions/checkout from implicitly enabling blobless clones that would fail in agent contexts lacking persistent credentials.

pkg/workflow/checkout_manager_test.go — Tests (medium impact)

  • Adds test cases asserting filter: '' is present in checkout steps when sparse-checkout is configured.
  • Adds complementary test cases asserting no filter key is emitted when sparse-checkout is absent.
  • Covers both default and additional checkout step paths.

docs/sparseness.md — Documentation (low impact, new file)

  • New technical reference document explaining the interaction between sparse-checkout and blobless clones.
  • Documents why filter: '' must be explicitly emitted for agent jobs when sparse-checkout is enabled.
  • Covers the difference in behaviour between agent jobs and safe_outputs jobs.

Motivation

actions/checkout enables blobless clones by default when a sparse-checkout pattern list is provided. Blobless clones defer blob fetching and require that git credentials remain available beyond the initial checkout step. Agent jobs do not retain these credentials, causing subsequent git operations (including pull request discovery) to fail. Explicitly passing filter: '' suppresses the blobless clone and ensures a standard full-content sparse checkout that works without persistent credentials.

Testing

  • Unit tests added in checkout_manager_test.go covering the presence and absence of filter: '' under sparse-checkout conditions.
  • No breaking changes. No changes to public APIs or schema.

Generated by PR Description Updater for issue #35949 · sonnet46 1.1M ·

Prevents actions/checkout@v6 from adding --filter=blob:none when
sparse-checkout is specified. Blobless clones require credentials for
lazy blob fetches, but agent jobs use persist-credentials: false,
making offline git operations fail.

Only emits filter:'' when sparse-checkout patterns are configured,
since that is the condition under which actions/checkout would
automatically add the blobless filter.

Fixes #35947
Copilot AI review requested due to automatic review settings May 30, 2026 16:05
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
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 updates the workflow YAML generation for agent-job checkouts to explicitly emit filter: '' in actions/checkout when sparse-checkout patterns are configured, preventing actions/checkout@v6 from implicitly enabling blobless/partial clones that break offline git operations in agent jobs.

Changes:

  • Emit filter: '' for the default checkout when sparsePatterns is non-empty.
  • Emit filter: '' for additional checkouts when sparsePatterns is non-empty.
  • Add/extend unit tests to verify filter: is present only when sparse-checkout is configured.
Show a summary per file
File Description
pkg/workflow/checkout_step_generator.go Adds conditional filter: '' emission for default and additional checkouts when sparse-checkout is used.
pkg/workflow/checkout_manager_test.go Adds assertions covering filter: '' presence/absence based on sparse-checkout configuration.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread pkg/workflow/checkout_step_generator.go Outdated
Comment thread pkg/workflow/checkout_step_generator.go Outdated
dsyme and others added 2 commits May 30, 2026 17:08
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@dsyme dsyme merged commit 2eef4be into main May 30, 2026
19 checks passed
@dsyme dsyme deleted the dsyme/fix-blobless-clone-agent-checkout branch May 30, 2026 16:30
@github-actions
Copy link
Copy Markdown
Contributor

✅ smoke-ci: safeoutputs CLI comment + comment-memory run (26689009788)

Generated by 🧪 Smoke CI for issue #35949 ·

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