fix: isolate summarization subprocess from git repo (ENT-242, ENT-243)#173
Merged
fix: isolate summarization subprocess from git repo (ENT-242, ENT-243)#173
Conversation
Claude Code performs internal git operations (plugin cache, context gathering) that pollute the worktree index with phantom entries from its plugin cache (e.g., tests/claude-code/README.md). This causes "fatal: unable to read <sha>" errors on subsequent git status calls. Fix by fully isolating the subprocess: - Run from os.TempDir() instead of the repo cwd - Strip all GIT_* env vars (git hooks set GIT_DIR which lets the subprocess find the repo regardless of cwd) - Use empty --setting-sources to skip all settings Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Entire-Checkpoint: 3ea54a9f1dde
The CommittedMetadata struct in writeSessionToSubdirectory() was missing the Summary field, causing generated summaries to be silently dropped during condensation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Entire-Checkpoint: 3ea54a9f1dde
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses two condensation/summarization issues in Entire CLI: it isolates the Claude CLI summarization subprocess from the user’s git repository to prevent index corruption (ENT-242), and ensures generated summaries are persisted into committed session metadata (ENT-243).
Changes:
- Run
claude --printfromos.TempDir()and strip allGIT_*environment variables to prevent the subprocess from discovering/modifying the parent repo. - Use an empty
--setting-sourcesvalue to avoid loading user/project/local settings during summarization. - Persist
SummaryintoCommittedMetadatawhen writing session-levelmetadata.json.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/entire/cli/summarize/claude.go | Isolates the Claude summarization subprocess via temp working dir + stripped git env to prevent index pollution. |
| cmd/entire/cli/checkpoint/committed.go | Fixes omission so opts.Summary is written into session-level committed metadata. |
…ence Add tests verifying: - Claude CLI subprocess runs from temp dir with GIT_* env vars stripped - stripGitEnv helper correctly filters environment variables - Summary field persists through WriteCommitted/ReadSessionContent round-trip Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Entire-Checkpoint: 1b7631912f60
georg
approved these changes
Feb 8, 2026
auto-merge was automatically disabled
February 8, 2026 02:49
Head branch was modified
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude --print) was polluting the worktree index with phantom entries from its internal plugin cache (e.g.,tests/claude-code/README.mdwith blob SHA that doesn't exist in the object store), causingfatal: unable to read <sha>errors on subsequentgit statuscalls. Fix isolates the subprocess by running fromos.TempDir(), stripping allGIT_*env vars, and using empty--setting-sources.writeSessionToSubdirectory()was missingSummary: opts.Summaryin theCommittedMetadatastruct literal.Root cause investigation
The original theory (go-git's
worktree.Status()rewriting the index) was wrong —Status()only reads the index, never writes it. The actual cause was theclaude --printsubprocess inheriting the git hook environment (GIT_DIR), which let Claude Code's internal git operations (plugin cache, context gathering) write phantom entries into the worktree index.Confirmed by:
claude --printwith a 15s sleep → index stays cleanclaude --printfrom tmpdir withoutGIT_*env vars → index stays cleanclaude --printfrom tmpdir WITHGIT_*env vars → index still corruptedTest plan
mise run fmt && mise run lint && mise run test:cipasses🤖 Generated with Claude Code
Note
Medium Risk
Touches checkpoint metadata persistence and changes how the summarization subprocess is executed (working directory and environment), which could affect summary generation behavior and any setups relying on inherited git/config state.
Overview
Prevents Claude CLI summarization (
claude --print) from polluting or discovering the caller’s git repo by disabling settings loading (--setting-sources ""), running the subprocess fromos.TempDir(), and stripping all inheritedGIT_*environment variables.Fixes a checkpoint persistence regression by actually writing
WriteCommittedOptions.Summaryinto the session-levelmetadata.json, and adds regression tests covering both summary persistence and the new git-isolation behavior.Written by Cursor Bugbot for commit e23db7a. This will update automatically on new commits. Configure here.