Skip to content

fix: skip LFS smudge filter when cloning from bare cache - #152

Merged
lishuceo merged 3 commits into
mainfrom
feat/claude-session-f2236e
Mar 16, 2026
Merged

fix: skip LFS smudge filter when cloning from bare cache#152
lishuceo merged 3 commits into
mainfrom
feat/claude-session-f2236e

Conversation

@lishuceo

Copy link
Copy Markdown
Owner

Summary

  • Set GIT_LFS_SKIP_SMUDGE=1 env var when cloning from bare cache to workspace, preventing checkout failures on repos with LFS files
  • Bare cache repos don't contain LFS objects, so the smudge filter fails trying to download large files from local path

Test plan

  • Added regression test verifying GIT_LFS_SKIP_SMUDGE=1 is set in clone env
  • All 31 workspace manager tests pass

🤖 Generated with Claude Code

lishuceo and others added 3 commits March 14, 2026 14:40
- Add research doc analyzing why prompt caching hit rate was only ~20%
  in long multi-turn sessions (root cause: CLI explicit breakpoints
  limited to last 2 messages + API 20-block lookback window)
- Add CLAUDE_CODE_EXTRA_BODY={"cache_control":{"type":"ephemeral"}}
  to .env enabling automatic caching (tested: -58% cost reduction)
- Add test scripts for cache optimization and resume scenarios

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bare cache repos don't contain LFS objects, causing checkout to fail
when the smudge filter tries to download large files from a local path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Mar 16, 2026

Copy link
Copy Markdown

Claude finished @lishuceo's task in 57s —— View job


PR Review: fix: skip LFS smudge filter when cloning from bare cache

  • Check for previous review comments
  • Gather context and read changed files
  • Review changes and post findings

✅ Approved — The core fix is correct and well-tested.

Core Fix (confidence: 95)

The 1-line change in src/workspace/manager.ts:158 correctly sets GIT_LFS_SKIP_SMUDGE=1 when cloning from bare cache. This is the right approach — bare caches don't have LFS objects, so the smudge filter would fail trying to resolve them locally. The env var is applied at the execFileSync level via the env option, which is clean and scoped.

The regression test at manager.test.ts:260-267 properly verifies the env var is set on the clone call.

Observation

🟡 Unrelated files in PR (not blocking): This PR bundles 3 unrelated files with the LFS fix:

  • docs/research/prompt-cache-analysis.md — prompt caching cost analysis doc
  • scripts/test-cache-optimization.mjs — cache optimization test script
  • scripts/test-cache-resume.mjs — cache resume test script

These were added in commit 1e09067 ("research: prompt caching cost analysis and optimization") which is unrelated to the LFS smudge fix. Consider splitting into separate PRs for cleaner history, but this is not a blocker.

Summary

The actual fix (GIT_LFS_SKIP_SMUDGE=1 env var + test) is minimal, correct, and well-scoped. No bugs, security issues, or architectural concerns.

@lishuceo
lishuceo merged commit 8dea54e into main Mar 16, 2026
4 checks passed
@lishuceo
lishuceo deleted the feat/claude-session-f2236e branch March 16, 2026 14:44
lishuceo added a commit that referenced this pull request Apr 8, 2026
* research: prompt caching cost analysis and optimization

- Add research doc analyzing why prompt caching hit rate was only ~20%
  in long multi-turn sessions (root cause: CLI explicit breakpoints
  limited to last 2 messages + API 20-block lookback window)
- Add CLAUDE_CODE_EXTRA_BODY={"cache_control":{"type":"ephemeral"}}
  to .env enabling automatic caching (tested: -58% cost reduction)
- Add test scripts for cache optimization and resume scenarios

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: skip LFS smudge filter when cloning from bare cache

Bare cache repos don't contain LFS objects, causing checkout to fail
when the smudge filter tries to download large files from a local path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add regression test for LFS skip smudge env var

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.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.

1 participant