Uh oh!
There was an error while loading. Please reload this page.
reader: assign turn membership by parentUuid chain walk (#433) - #447
Conversation
…433) Activity classification associates each assistant turn with its user prompt by walking the `parentUuid` chain to the nearest user-prompt ancestor, replacing the file-order "last user text seen" heuristic. The old heuristic mis-attributed user text under: - Out-of-order JSONL flushes (Claude Code's writer is async). - Mid-stream interrupt + resume (late assistant rows inherited the intervening prompt's text). - Compaction artifacts with off-window timestamps. New helper in `claude/parent_chain.rs` (`group_by_parent_chain` + `find_turn_root` + `ChainNode` trait) provides the bulk grouping API the issue specifies; the in-reader hot path uses the single-row `nearest_user_prompt_root` variant for per-turn lookup. Cycle guard via visited set; orphan/cycle chains fall through to the legacy file-order map (over-grouping > silently dropping rows). Codex and opencode readers are untouched — their rollouts have no equivalent `parentUuid` field. Asymmetry documented at the `claude.rs` module header and `claude/parent_chain.rs` docstring. Tests: 13 new (10 unit tests in `parent_chain` + 3 end-to-end on the Claude reader path with new fixtures `parent-chain-out-of-order.jsonl` and `parent-chain-interrupt-resume.jsonl`). No schema change. Golden snapshots unchanged.
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 4 minutes and 20 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ 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. Comment |
Uh oh!
There was an error while loading. Please reload this page.
Closes#433.
Summary
Groups Claude turn rows by walking the
parentUuidchain up to the nearest user-prompt ancestor, instead of relying on file order / timestamp windows for user-prompt-text → assistant mapping in activity classification.parent_chainsubmodule withChainNodetrait,group_by_parent_chain,find_turn_root(the API surface the issue specifies; unit-tested).nearest_user_prompt_roothelper that returnsOption<String>so the caller can cleanly fall back to the file-order map for rows missing bothuuidandparentUuid.user_text_by_uuidmap andis_user_promptfield onLineNodeto thread the UUID-keyed lookup through classification.Scope clarification
Burn's reader already collapses multi-block assistants correctly via
message_id— turn counts and message_id grouping are unchanged. The actual mis-attribution this fixes is user-prompt-text → assistant mapping for activity classification, where out-of-order JSONL flushes and interrupt-resume gaps would previously cause incorrect attribution.Codex/opencode readers unchanged (no
parentUuidfield).Open question
group_by_parent_chainandfind_turn_rootare declared#[allow(dead_code)]— they satisfy the issue's specified API surface and are unit-tested, but the hot path uses the lighter single-row helper. Happy to either remove them or wire them through if reviewers prefer; doc comments explain the trade-off.Test plan
parent_chainunit tests (10 new): chain walk, root detection, cycle guard, missing-uuid fallback, multi-root fileparent-chain-out-of-order.jsonl,parent-chain-interrupt-resume.jsonlcargo build --workspacecleancargo test --workspace— 813 passed, 0 failedBURN_GOLDEN=1 cargo test --test golden— 5/5cargo clippy -p relayburn-sdk --libclean on new codeOut of scope
parentUuidfield; documented asymmetry).Generated by Claude Code