fix(memory-ingest): --include-unattributed is inert — apply the fallback to page.git_remote (#2353) - #2371
Open
noron12234 wants to merge 1 commit into
Open
Conversation
…te (garrytan#2353) buildTranscriptPage wrote the raw resolveGitRemote() result into page.git_remote while the frontmatter and repoSlug both applied the "_unattributed" fallback. The skip guard reads page.git_remote, so `"" === "_unattributed"` was never true and --include-unattributed was inert: every session whose repo could not be resolved got imported regardless of the flag, and skipped_unattributed always reported 0. buildArtifactPage already stores the defaulted value (slug_repo); this brings the transcript builder in line. Adds three regression tests: non-git cwd is skipped by default, imported with --include-unattributed, and a cwd that does resolve is unaffected.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
Fixes #2353.
Root cause
buildTranscriptPageapplies the_unattributedfallback in two of the threeplaces it computes it, and the one it skips is the one the guard reads:
page.git_remoteis"", so the comparison is never true, the branch is dead, and--include-unattributedhas no effect in either direction. The earlier!session.cwdguard doesn't cover it — these sessions have a
cwd, it just no longer resolves to aremote (deleted directories, ephemeral worktrees).
buildArtifactPagealready stores the defaulted value (git_remote: slug_repo, :787),so this is the transcript builder catching up.
Fix
One line, plus a comment noting the guard depends on it:
Taking the fix at the source rather than loosening the guard to
!page.git_remote || … === "_unattributed"keeps the field consistent with the frontmatter and the slug,which is what
buildArtifactPagealready does.Verification
Reproduced with a real session JSONL whose
cwdis a directory that isn't a git repo,run through
--bulk --no-write:--include-unattributedThree regression tests added to
test/gstack-memory-ingest.test.ts, in the existingrunScript/writeClaudeCodeSessionstyle. Confirmed they actually bite — revertingjust the one-line change makes the first one fail:
Suites run clean with the fix in place:
Note on scope
The issue also suggests recovering attribution from the Claude Code project-directory
encoding rather than discarding it. That's a behaviour change with its own design
questions, so it's left out — this PR only makes the existing flag do what it says.