Skip to content

Gate the git-lfs probe: skip the git-lfs fork when the repo has no LFS attributes #142

Description

@blooop

Question

The git-lfs probe runs unconditionally on every workspace-clone preparation: _lfs_tracked_files (worktree/workspace_clone.py:114-131) does shutil.which("git-lfs") plus a git lfs ls-files --name-only subprocess, then _has_lfs_pointers opens the first 23 bytes of every tracked file — even for the overwhelmingly common repo with no LFS at all. Gate it so a non-LFS repo pays (at most) one cheap local check instead of a git lfs fork.

Shape of the fix (refine test-first): before forking git lfs, check whether the clone can possibly use LFS — e.g. .gitattributes (tracked or top-level) mentioning filter=lfs — and skip the whole probe when it can't. The existing deliberate choice at workspace_clone.py:350-352 (do NOT gate on is_new_workspace, so a previously failed pull isn't permanent) must be preserved: the gate must be a property of the repo content, not of launch history.

Done when:

  • A failing test first: repo without LFS attributes → no git lfs subprocess is spawned (extend the spawn-count seam or mock at the subprocess boundary).
  • A repo WITH filter=lfs attributes still probes and materializes exactly as today (existing tests stay green).
  • Cold-path only — no behavior change on warm launches (there is none today; keep it that way).
  • CI green (pixi run ci, check py310).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions