Repository navigation
[codex] Add session event attribution recovery - #1654
Merged
Merged
Conversation
svarlamov
marked this pull request as ready for review
June 25, 2026 14:13
This was referenced Jun 30, 2026
svarlamov
added a commit
to rajaiswal/git-ai
that referenced
this pull request
Jun 30, 2026
PD-23 / GH git-ai-project#1677: the git-ai daemon could consume 20GB+ RSS during a `git pull`. On a fast-forward `update-ref`, the daemon calls `post_commit_from_working_log(Some(old), new)` where `old` is the old branch tip from *before* the pull. Attribution recovery (`recovery_committed_hunks`) then ran `diff_added_lines(old, new, None)` with no pathspec, buffering the entire `git diff -U0 old..new` output plus one u32 per added line into memory. When the pull fast-forwards across a large range that is the whole history delta — gigabytes. This path is new since v1.5.13: the same unbounded diff previously ran only inside the background-agent block (Devin/Codex-Cloud), never for ordinary users. `recover_attribution` (default true, added in git-ai-project#1654) made it run for everyone. Fix: resolve the finalized commit's immediate first parent and diff against that instead of the caller's `parent_sha`. The normal commit and amend paths already pass the immediate parent, so they are unchanged; only the fast-forward `update-ref` range is capped to a single commit. This also removes a latent cross-author misattribution (recovery could attribute remotely-authored pulled lines to the local user on a timestamp coincidence). Repro (tests/integration/recovery_diff_memory_repro.rs): over a ~270MB fast-forward range the full-range diff grows peak RSS ~293MB while the immediate-parent diff grows ~1MB (275x). Plus a unit regression test asserting recovery sees only the finalized commit's files. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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
Adds a session-event mtime attribution recovery solver for commits where AI hook checkpoints were missed. The new solver runs after bash-history recovery and before adjacent-edge extension, then attributes still-unknown committed lines when nearby
SessionEventmetric rows can be selected conservatively.Details
SessionEventrows within a 3 second mtime windowValidation
task fmttask linttask test TEST_FILTER=session_event_candidatetask test TEST_FILTER=session_event_recoverytask test TEST_FILTER=attribution_recoverytask test TEST_FILTER=bash_history_recoverstask test