github / github/copilot-cli

Feature: Apply sparse-checkout at session worktree creation to avoid full-checkout timeouts on large repos

Open
#4,145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:configuration area:sessions
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

Describe the feature or problem you'd like to solve

Apply sparse-checkout at session worktree creation to avoid full-checkout timeouts on large repos

Proposed solution

Summary

When the app creates a new project session, it runs git worktree add, which
checks out the entire working tree. For very large monorepos this checkout
is slow enough to time out, so sessions fail to start.

New worktrees do not inherit sparse-checkout config from the main repo, and
hooks (e.g. PreToolUse) only fire after the worktree exists — so there is
currently no way to avoid the full checkout from the user side.

Problem

  • Repo: very large local repo (working tree in the multi-GB / high-file-count range)
  • git worktree add <path> <branch> materializes the full tree
  • Worktree creation times out → session cannot be created
  • No pre-worktree hook / config exists to scope the checkout

Proposal

Add a config option to scope the checkout when creating session worktrees, e.g.:

// settings.json
{
  "session": {
    "worktree": {
      "sparseCheckout": {
        "enabled": true,
        "cone": true,
        "paths": ["src/app", "libs/shared"]
      }
    }
  }
}
Example prompts or workflows

No response

Additional context

Prior art / related
#2399 — sparse-checkout for plugin installs
#2463 — sparse-checkout for marketplace clones
Both apply sparse-checkout to reduce clone cost, but only for plugins/marketplace,
not for session worktrees. This request covers the session-creation path.

Environment
Copilot CLI version: 1.0.71-2
OS: Windows
Repo: local-only, very large working tree

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the session worktree creation path and the git worktree add invocation, then determine how configuration can be applied before checkout. Done means a session worktree can use the proposed sparse-checkout settings so large repositories avoid materializing the full tree and timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.