-
Notifications
You must be signed in to change notification settings - Fork 185
Description
What happened?
initial_attribution in checkpoint metadata (entire/checkpoints/v1) always shows agent_lines: 0 and agent_percentage: 0, regardless of actual agent contribution.
Three independent bugs in the PostCommit condensation pipeline cause this. They often trigger together.
Bug 1 — Wrong baseline for detecting non-agent files
CalculateAttributionWithAccumulated() finds user-only files by diffing baseTree (session start) against headTree (after commit). When unrelated commits exist between session start and the current commit, all files from those intermediate commits are misclassified as "user edits," inflating totalUserAdded.
The comparison should use parentTree (the commit's immediate parent) instead of baseTree.
Where: manual_commit_attribution.go:226 — getAllChangedFilesBetweenTrees(baseTree, headTree)
Bug 2 — Stale sessions claim unrelated commits
findSessionsForWorktree() returns all sessions including ENDED ones. HandleCondenseIfFilesTouched triggers condensation whenever FilesTouched is non-empty, without verifying that the committed files actually overlap with the session's shadow branch.
HandleCondense already has this check (filesOverlapWithContent() for non-ACTIVE sessions), but HandleCondenseIfFilesTouched was missing it. ENDED sessions with carry-forward files produce zero-attribution checkpoints that overwrite valid ones.
Where: manual_commit_hooks.go — HandleCondenseIfFilesTouched
Bug 3 — Double condensation overwrites correct results
When multiple sessions exist in the same worktree, both react to the same commit. The first condensation calculates correct attribution and advances AttributionBaseCommit to HEAD. A second condensation of the same session then sees baseTree == headTree, produces an empty diff, and overwrites the correct result.
Where: manual_commit_hooks.go — condenseAndUpdateState
Steps to reproduce
entire enable(manual-commit strategy).- Start an agent session, let it create files.
- From another terminal, make an unrelated commit (triggers Bug 1).
- Stop the first session, start a new one in the same directory.
- Let the new session write code, then commit.
- Check
metadata.jsononentire/checkpoints/v1—agent_percentageis0.
To trigger all three bugs:
- The first (now ENDED) session still has
FilesTouchedentries. - PostCommit processes the ENDED session first → zero-attribution checkpoint (Bug 2). The active session condenses correctly, but gets condensed again via the stale session path (Bug 3), overwriting the correct result.
Entire CLI version
v0.4.5
OS and architecture
Darwin 24.5.0 arm64
Agent
Claude Code
Strategy
manual-commit (default)
Terminal
WezTerm
Logs / debug output
# Pattern in .entire/logs/entire.log:
# First condensation — correct:
post-commit: session 743d4b39 agent_lines:396 human_added:539 agent_pct:42.36
# ENDED session fires (Bug 2) — zero:
post-commit: session a62ddd7e agent_lines:0 human_added:0 agent_pct:0.00
# Same session condensed again (Bug 3) — overwrites correct result:
post-commit: session 743d4b39 agent_lines:0 human_added:0 agent_pct:0.00Additional context
- All three bugs occur without sub-agents or task agents.
- Bug 1 is the most common — any mid-session commit,
git pull --rebase, orgit mergetriggers it. - Bug 2 triggers whenever an ENDED session has leftover
FilesTouchedentries (normal after carry-forward). - Bug 3 requires multiple sessions in the same worktree, or rapid sequential commits.