Repository navigation
fix(lineage): compose sibling variants canonically - #2922
Conversation
The write-side signature stream omitted non-primary variants while composed reads retained them, making prefix-tail extraction depend on ingest order. Order signatures by position and variant index, and drop inherited signatures when a branch point is no longer present so re-ingest cannot fabricate a complete prefix. Add parent-first/child-first, replacement, and dangling-cut production regressions; make the state-machine freshness clock monotonic. Ref polylogue-866e. Co-Authored-By: Claude <[email protected]>
Exercise the production writer after an ancestor branch cut disappears. The child must remain spawned-fresh with its complete physical replay, rather than inheriting a surviving but semantically incomplete prefix. Ref polylogue-866e. Co-Authored-By: Claude <[email protected]>
Use real datetime arithmetic for generated replacement timestamps so state-machine runs remain valid beyond the first minute and continue to exercise fresh-write behavior rather than accidental stale rejection. Co-Authored-By: Claude <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe change centralizes lineage depth limits, replaces recursive writer composition with iterative traversal, includes all message variants in owned signatures, and adds coverage for variant branches, dangling lineage, deep chains, and deterministic timestamps. ChangesLineage composition and variant handling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Writer
participant SessionLinks
participant ComposedCache
participant Reader
Writer->>SessionLinks: Traverse ancestor chain iteratively
Writer->>ComposedCache: Compose prefixes and owned tails
Writer->>ComposedCache: Cache composed signatures
Reader->>SessionLinks: Resolve lineage links
Reader->>ComposedCache: Compose transcript with shared depth limit
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e222e6a2b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Writer-side signature composition reused the recursive sync reader's 64-level guard even though the primary async reader composes iteratively to 1024. Valid branch points beyond that cutoff could therefore become spawned-fresh during extraction or re-ingest.\n\nWalk writer lineage iteratively with the same shared runaway limit as the async reader, retaining the sync envelope's explicit stack-safe truncation boundary. Add a 66-level production write/re-ingest regression that proves the root branch point remains canonical and physically deduplicated.\n\nCo-Authored-By: Claude <[email protected]>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ec3ac1ec0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| LEFT JOIN blocks b ON b.session_id = m.session_id AND b.message_id = m.message_id | ||
| WHERE m.session_id = ? AND m.variant_index = 0 | ||
| ORDER BY m.position, b.position | ||
| WHERE m.session_id = ? |
There was a problem hiding this comment.
Filter lineage signatures to the active sibling path
When a parent has an inactive sibling before a later active-path message, a fork typically replays only the active path. Including every variant makes the parent signatures A, inactive-B, C while the child has A, C, ...; prefix alignment therefore stops after A, retains a duplicate C in the child, and records an earlier branch point. The added regression masks this because _msg sets is_active_path=True even for its variant-1 sibling; use active-path membership while still allowing an active nonzero variant.
Useful? React with 👍 / 👎.
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Make write-side lineage signatures use the same canonical sibling-variant order
as composed reads, and prevent a missing branch point from fabricating an
inherited prefix during later ingestion. Add production-route regressions for
parent/child order, replacement, missing sibling cuts, and dangling-ancestor
reingest.
Problem
Writer-side prefix alignment considered only variant zero while composed reads
include all sibling variants. This made physical child tails depend on ingest
order and could retain a duplicated sibling. Separately, a missing branch point
caused writer alignment to inherit the accumulated parent prefix even though
readers correctly expose only the child's bounded tail.
Solution
(position, variant_index, block position)andinclude every sibling variant.
reader, parent replacement, dangling cuts, and child reingest.
the state machine cannot accidentally model fresh writes as stale after 59
updates.
Ref polylogue-866e. Ref polylogue-t8t. The supplied t8t continuity package was
not applied because it implemented only two of seven routes and introduced a
competing scenario seam.
Acceptance status
child-first convergence; bounded behavior when a direct branch cut is
missing; no fabricated prefix on dangling-ancestor reingest.
crash/rollback fault injection, exhaustive saved examples, and complete
nested-ancestor completeness propagation.
Verification
1 inherited property failure.
origin/masterproperty run — 1 failed with three distinctcounterexamples; this branch removes the two sibling-replacement failures but
retains the pre-existing nested dangling-completeness counterexample.
devtools test -k 'session_links or composed'— 11 passed.devtools verify --quick— 16/16 checks passed, run20260716T014100Z-quick-2135389-bff17c2f.20260716T014141Z-quick-2136224-5f98b796.Anti-vacuity: restoring the primary-only signature query leaves the sibling in
the child tail; removing the missing-cut guard fabricates a prefix and drops
part of the child's physical replay. Both mutations fail production-route
regressions.
Summary by CodeRabbit
Bug Fixes
Tests