fix(claude): .orphaned-* segments no longer vanish from chained conversations - #237
fix(claude): .orphaned-* segments no longer vanish from chained conversations#237bdelanghe wants to merge 2 commits into
Conversation
…rsations Two related fixes in chain handling (#236, defect 2): ChainIndex::refresh classified any stem whose first entry carried a foreign sessionId as a chain successor. Rotation artifacts (`<uuid>.orphaned-<ts>-<hash>`) always do — their entries keep the original session's id while the stem is mangled — so they were chained in, whereupon is_bridge_entry matched every entry of the segment and the merge dropped the whole thing: turns and token_usage silently gone while claude_chain_stamp still counted its bytes. A session stem never contains a dot; dotted stems now stand alone as their own conversations. read_conversation applied the bridge filter to every entry of every segment, though bridge entries are only ever the predecessor tail copied to the top of a successor file. The filter now skips only the leading bridge run, so a foreign sessionId deeper in a segment is data, not a discard. toolpath-claude 0.13.0 → 0.13.1 (Cargo.tomls, crates.json, CHANGELOG). Verified: cargo test -p toolpath-claude — 259 tests green including the two new cases (orphaned stem stays unchained; mid-segment foreign id is kept). path-cli integration suite: 42 passed / 20 failed both on this branch AND on unmodified main in the same local nix-shell env — pre-existing environment failures, not regressions; CI is the arbiter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EbQMJRxBqTQyP7nE7qqzsr
|
🔍 Preview deployed: https://eb632988.toolpath.pages.dev |
Standalone orphans must not become listed conversations yet: a derived document id truncates the stem to its first 8 characters, which for `<uuid>.orphaned-*` equals the parent session's prefix — the orphan doc and the full session doc would overwrite each other in the cache (defect 3 interaction, caught against the kind spec's summing guarantee). Orphans are now neither chained nor listed; read_segment reads them directly. Ingestion arrives with the full-stem id work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EbQMJRxBqTQyP7nE7qqzsr
|
Amended after checking the fix against the kind spec (toolpath.net/kinds/agent-coding-session/v1.1.0): as first pushed, standalone orphans would have become listed conversations, and |
Defect 2 from the #236 root-cause analysis (#236 (comment)).
ChainIndex::refreshclassified any stem whose first entry carried a foreignsessionIdas a chain successor. Rotation artifacts (<uuid>.orphaned-<ts>-<hash>) always do — their entries keep the original session's id while the stem is mangled — so they were chained in, whereuponis_bridge_entrymatched every entry of the segment and the merge dropped the whole thing: turns andtoken_usagesilently gone, whileclaude_chain_stampstill summed the segment's bytes into the freshness stamp. A session stem never contains a dot; dotted stems now stand alone as their own conversations.Second,
read_conversationapplied the bridge filter to every entry of every segment, though bridge entries are only ever the predecessor's tail copied to the top of a successor file (aschain.rs's own docs say). The filter now skips only the leading bridge run — a foreignsessionIddeeper in a segment is data, kept.toolpath-claude 0.13.0 → 0.13.1 (crate + workspace Cargo.toml, site/_data/crates.json, CHANGELOG).
Run sheet
test_orphaned_stem_is_not_a_successor(new),test_bridge_skip_is_leading_run_only(new), fullcargo test -p toolpath-claude— 259 green50357658-….orphaned-1787626221622-ac84712d.jsonl, 8 entries, all silently dropped🤖 Generated with Claude Code
https://claude.ai/code/session_01EbQMJRxBqTQyP7nE7qqzsr
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.