fix(storage): keep equivalents quarantined-ambiguous when no head is accepted#3255
Conversation
…accepted Problem: apply_raw_membership_classification labels equivalent_raw_ids superseded_equivalent and promotes them to byte_proven even when classification.accepted_raw_ids is empty — i.e. when the head/session/ application-receipt write never ran. That fabricates supersession authority for a head that does not exist. On the 2026-07-20 rebuild walk this produced 914 logical sources (155,816 max messages) that read as byte_proven/superseded in raw_session_memberships yet have zero raw_revision_heads row, zero application receipt, and zero session row (investigation: .agent/reports/byte-headless-914-investigation-2026-07-21.md). Introduced by 6a579d0 (#2684). What changed: with no accepted head, equivalence collapses back into the unresolved cohort — equivalent members are recorded decision='ambiguous' and stay revision_authority='quarantined'. Regression test proves an all-ambiguous cohort with duplicate content writes no head and keeps every member quarantined-ambiguous; the pre-fix labeling fails it (verified via stash). Note: this fix restores honest debt visibility only; re-resolving the existing mislabeled 914 sources on the live archive is a separate coordinator repair. Ref polylogue-yla8 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
|
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 (2)
📝 WalkthroughWalkthroughThe archive now labels equivalent raw memberships as ambiguous when classification produces no accepted raw head. A regression test verifies that headless cohorts persist without an accepted head and retain ambiguous, quarantined membership authority. ChangesHeadless membership classification
Estimated code review effort: 2 (Simple) | ~10 minutes 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: f5e31cb0f5
ℹ️ 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".
| decisions.update( | ||
| dict.fromkeys( | ||
| classification.equivalent_raw_ids, | ||
| "superseded_equivalent" if classification.accepted_raw_ids else "ambiguous", |
There was a problem hiding this comment.
Count equivalent members in quarantine totals
When a headless cohort contains duplicate content, this branch now quarantines every equivalent_raw_id, but backfill_historical_revision_evidence still increments its quarantine total using only len(classification.ambiguous_raw_ids) at polylogue/sources/revision_backfill.py:863-864. For the new three-member fixture, all three membership rows are quarantined while the result reports only two, so raw_materialization_quarantined_count and the operator-facing repair detail understate the unresolved evidence; include the equivalent IDs in that count when no head is accepted.
Useful? React with 👍 / 👎.
|
Coordinator review: read the full diff. One-line semantic gate at the decisions construction (equivalents map to superseded_equivalent only when an accepted head exists) + incident comment; regression test asserts no-head cohorts stay ('ambiguous','quarantined') for every member, anti-vacuity verified via stash (pre-fix labeling fails it). archive.py self-audit test run explicitly per repo gotcha. Live-archive re-resolution of the 914 mislabeled rows is named as a coordinator follow-up, not claimed. Merging on green quick-gate. |
… deploy, blocker critical path) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
Summary
When
classify_membership_revisionsrefuses to pick a head (accepted_raw_ids=()), the membership write-back no longer labelsequivalent_raw_idsassuperseded_equivalent/byte_proven— they collapse back into the unresolved cohort asambiguous/quarantined.Problem
Live-archive forensics (Ref polylogue-yla8; report
.agent/reports/byte-headless-914-investigation-2026-07-21.md) found 914 logical sources (155,816 max messages) whose memberships readbyte_proven/superseded_equivalentyet have noraw_revision_headsrow, no application receipt, and no session — supersession authority fabricated for a head that was never written. Introduced by 6a579d0 (#2684, 2026-07-11); the 2026-07-20 rebuild walk amplified it (93% of the cohort decided in one hour).Solution
One-line gate in
apply_raw_membership_classification's decisions construction: equivalents map tosuperseded_equivalentonly whenaccepted_raw_idsis non-empty. The authority ternary then keeps themquarantinedautomatically. Comment documents the incident.Verification
devtools test tests/unit/storage/test_revision_replay.py→ 23 passed.test_headless_cohort_keeps_equivalents_quarantined_ambiguous: all-ambiguous cohort with duplicate content → no head row, every member('ambiguous','quarantined'). Anti-vacuity: with the fix stashed, the test fails (pre-fix labeling) — verified.devtools test tests/unit/storage/test_no_string_interpolated_sql.py(archive.py self-audit) → pass.devtools verify --quick→ exit 0.Note: repairing the existing mislabeled rows on the live archive is a separate coordinator-owned step (re-census after this merges).
Ref polylogue-yla8
🤖 Generated with Claude Code
https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
Summary by CodeRabbit
Bug Fixes
Tests