Repository navigation
Keep recorded branch labels stable across re-imports - #44
Merged
Merged
Conversation
A project's branch label came from the record when it carried one, and otherwise from the checkout's HEAD at scan time. HEAD at scan time says nothing about where a past session ran, so every re-import made while a repository sat on another branch relabeled its history and moved those sessions' rollups to the new branch. Codex hit this on almost every session. `session_meta` records the branch, but `turn_context` repeats only the cwd, and each one resolved the project again without a branch and fell back to HEAD. A turn in the directory `session_meta` named now keeps the remote and branch it recorded. A turn in another directory has no recorded branch. The HEAD fallback is gone. A branch is labeled only when the record carries one, and is otherwise left unset. OpenCode records no branch, so its sessions are no longer labeled. Claude Code and Grok Build archive scans now pass the branch their records carry. Codex, Claude Code, OpenCode, and Grok Build parser revisions are bumped, so the first scan after upgrading rescans and re-archives them once and drops every branch taken from a checkout's HEAD.
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
A project's branch label came from the record when it carried one, and otherwise from the checkout's HEAD at scan time. HEAD at scan time says nothing about where a past session ran, so a re-import made while a repository sat on another branch relabeled its history and moved those sessions' rollups to that branch.
session_metarecords the branch, butturn_contextrepeats only the cwd. Eachturn_contextresolved the project again without a branch, fell back to HEAD, and overwrote the recorded branch, so almost every session took the checkout's branch. A turn in the directorysession_metanamed now keeps the remote and branch it recorded. A turn in another directory has no recorded branch.Verification
cargo fmt -p statsai-adapters,cargo clippy -p statsai-adapters --all-targets -- -D warnings,cargo test -p statsai-adapters./scripts/rust-ci.sh full(passed locally and in the pre-push hook)New adapter tests re-scan the same sessions with different branches checked out:
session_metabranch and hash across checkouts.gitblock, and a turn that moved to another directory, never take the checkout's HEAD.The three Codex tests fail with the fix reverted.
Ran the build against an isolated clone of a real store: a full rescan restored Codex sessions to the branches their records carry, and a second uncached rescan changed no branch label or hash.