fix(claude-sync): skip subagent JSONL files to prevent main session corruption#737
fix(claude-sync): skip subagent JSONL files to prevent main session corruption#737kamioj wants to merge 1 commit intositeboon:mainfrom
Conversation
…orruption Subagent transcripts under `~/.claude/projects/.../<project>/subagents/` share their parent's sessionId. Indexing them as standalone sessions overwrites the parent's row in the sessions DB, which breaks session resume and history listing. Skip them in both the bulk `synchronize()` scan and the watcher-driven `synchronizeFile()` entry point. Path check covers Windows backslash and POSIX slash so the same guard works regardless of how findFilesRecursively emits the path.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Claude session synchronizer now explicitly filters out transcript files located in ChangesSubagent File Filtering
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Summary
ClaudeSessionSynchronizerwalks~/.claude/projects/<project>/for.jsonlfiles and indexes each one as a session row. Claude Code writessubagent transcripts under a
subagents/subdirectory but shares theparent session's
sessionIdin those files. The current scan picks themup and upserts them into the sessions DB with the same
sessionId, whichoverwrites the parent row and breaks session resume / history listing.
Reproduction
/agent, etc.).sessionsrow for<sid>now reflects the subagent file's metadata; opening the session in the UI shows the subagent transcript instead of the parent.Fix
Skip any path containing
/subagents/(or\subagents\on Windows) in:synchronize()— the bulk scan loopsynchronizeFile()— the watcher-driven entry pointBoth code paths use the same cross-platform separator-aware guard.
Notes
Summary by CodeRabbit