Conversation
When a sidechain transcript was loaded without its trunk session (e.g. warmup-only subagent files), `_integrate_agent_entries` accepted the agent's own root entry as its anchor. The subsequent re-parent step then set `parentUuid = uuid`, producing a self-loop and a "Cycle detected" warning at DAG construction. Tighten the sidechain-anchor predicate to require a cross-agent boundary (parent belongs to a different agent's transcript). Add a real-world repro fixture and three regression tests, including one that guards the legitimate nested A→B anchor case. Also restore missing `contextlib`/`logging`/`Iterator` imports introduced by 0bcf1a7 — the module fails to import without them.
The "N roots found (M unexpected)" warning fired on long sessions for shapes that are actually routine: * The genuine session-start user root counted as 'unexpected' alongside expected `compact_boundary` roots. * Sidechain user roots with no agentId — older Claude Code Task prompts loaded without their trunk anchor. * Cross-session attachment roots — `--resume` shape where the resumed transcript's entries reference parents that live in another loaded session. Add `_classify_unexpected_roots` to filter these patterns out before deciding whether to warn. The genuine start is identified as the earliest non-sidechain natural root, so a sidechain orphan dated before the real session start can't shadow it. On the user's repower project this drops 16 multi-root warnings to 0 while keeping the legitimate orphan-node warning intact. Adds four regression tests covering each shape, including the sidechain-earlier-than-user-start edge case.
📝 WalkthroughWalkthroughThis PR improves DAG integration quality by introducing root classification to distinguish expected from anomalous multi-root scenarios, tightening sidechain anchor selection to prevent self-loops, suppressing noisy warnings during silent CLI flows, and adding comprehensive test coverage for the new edge cases. ChangesDAG Root Classification & Anchor Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Comment |
cboos
left a comment
There was a problem hiding this comment.
I had a set of sessions that, when processed together, exhibited the warnings. With these changes they are gone and the content looks good, so... approved!
@cboos these are addressing the warnings I mentioned in #135
I'm not super familiar with this DAG processing so please have a look!
Make DAG cycle warnings honour silent=True
Normal generation should just output projects list
Quiet routine multi-root warnings
The "N roots found (M unexpected)" warning fired on long sessions for
shapes that are actually routine:
expected
compact_boundaryroots.loaded without their trunk anchor.
--resumeshape where the resumedtranscript's entries reference parents that live in another loaded
session.
Add
_classify_unexpected_rootsto filter these patterns out beforedeciding whether to warn. The genuine start is identified as the
earliest non-sidechain natural root, so a sidechain orphan dated
before the real session start can't shadow it.
On the user's repower project this drops 16 multi-root warnings to 0
while keeping the legitimate orphan-node warning intact. Adds four
regression tests covering each shape, including the
sidechain-earlier-than-user-start edge case.
Fix self-loop anchor for orphan subagent transcripts
When a sidechain transcript was loaded without its trunk session (e.g.
warmup-only subagent files),
_integrate_agent_entriesaccepted theagent's own root entry as its anchor. The subsequent re-parent step
then set
parentUuid = uuid, producing a self-loop and a "Cycledetected" warning at DAG construction.
Tighten the sidechain-anchor predicate to require a cross-agent
boundary (parent belongs to a different agent's transcript). Add a
real-world repro fixture and three regression tests, including one
that guards the legitimate nested A→B anchor case.
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests