Repository navigation
fix(storage): land verified worker-5 archive, anchor and profile fixes - #5790
Merged
Merged
Conversation
Resolve the rebase onto the lineage depth-cap removal (#5685), keeping only the seed-free lineage pagination. Recover the archive root from the innermost generations marker, drop the unused whole-tuple expected_tier parameter, fix the status dependency map (the spine is not a presence key), relocate anchors by matching own physical rows across the whole neighbourhood instead of a second composer, and name the test modules by behaviour. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
The embedding recipe now refuses any element type other than float32, so the address-stability test no longer lists float16 as a label field. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…by the rebased commits) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
The 521-session chain spent its 120 s timeout on per-session commits to disk, so the test timed out in setup on both the fix and master. In memory it runs in seconds, and master now fails on the assertion (the capped resolver answers "missing") instead of on the clock. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity
marked this pull request as ready for review
September 29, 2026 09:42
Sinity
enabled auto-merge (squash)
September 29, 2026 09:42
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lands the real fixes from the worker-5 pass over storage Codex review debt (beads
polylogue-1tyq5.98,.99,.100, 75 findings). 28 findings are fixed here with production-route regressions. 13 were already fixed on master, 8 are stale, 2 are refuted and 24 were not reached. Every kept fix was re-checked against current master. None of the cited or touched storage files changed on master after the salvage baseab28700c1b, and the later master merge touched none of this PR's files.Problem
Each defect below was confirmed on master by a regression test that fails against master's production code (revert-proof job 2488):
.index-generationsresolved to its parent. Local ops/embeddings tiers refused a durable symlink farm. The tuple manifest loader normalized unknown, missing and coerced fields before recomputing the seal, and it admitted a sealed obsolete schema fingerprint. An inactive destination could be a symlink or hard link to a foreign database, which SQLite then initialized; this happened both through bootstrap and through embedding preparation. A forged destination generation passed when the caller gave no hint. A replacedaudit.dbescaped the authority digest. Neither new directory entry was fsynced. Any root that merely contained.archive-tupleswas refused.UNMEASUREDeven when blocking evidence loss had been measured.ambiguous, and skipped same-session drift when the anchored message had vanished.selected_part_factsreportedvalidwhile ordinary inspection reportedstaleunder pending demand. A session missing only its latency sibling was never rediscovered. Sync hydration droppeddirection/producer_ref. A shared dependency superset zeroedrun_counton archives that lackedsession_events.node_limit=1could not advance past the seed.siblings()listed a child once per evidence edge. An unrelated component's cycle or conflict flagged a healthy topology.COMMITin FTS repair ran outside rollback protection and left the transaction open.Solution
archive_identity.py: the innermost generations marker owns the path. Symlink-farm admission counts only the source, user and audit tiers.archive_tuple_location.py: exact manifest key and type validation before the seal. Schema fingerprints must equal the running writer's. The final tier entry must be absent or an unshared regular file (lstat,st_nlink == 1). The destination generation must equal the manifest's. The live location is re-resolved and the audit identity rechecked. Both new directory entries are fsynced. Only.archive-tuples/tuple-<id>marks a candidate path. The unused whole-tupleexpected_tieris removed; single-tier writers keep it onvalidate_inactive_destination.archive_readiness.py: positive blocking counts are evaluated before the zero-denominator return.block_anchor.py: the private composer and its cap are deleted. Relocation walks every prefix-sharing and spawned-fresh neighbour once and collects the distinct own physical rows that match the hash. Each query binds two values. More than one match isambiguous. Same-session drift is checked before lineage, even when the message is gone.derivation.py: required-page discovery includes sessions missing a latency sibling. Selected facts use the demand-aware classifier.rebuild.py: the sync loader selects and hydrates the attachment provenance columns. Theinput_binding.pyexclusion reasons are updated to match.status.py: each run projection declares exactly the relations its own body reads.compact.py: the seed rides every page outside thenode_limitbudget.topology.py,topology/derivation.py: siblings are deduplicated as nodes, while evidence edges stay onedges. Cycle and conflict flags come from the returned edges.marker_domain.py:required_pagereturns the head as its continuation, and it ends the sweep when the head has not moved (held or failed). One pass drains every committed batch without looping on or overtaking a held head.embeddings/identity.py: request options are sorted and duplicate keys refused; only float32 output is accepted. Production recipes carry no options, so no stored recipe hash or vector address moves.fts_lifecycle.py: the ownedCOMMITmoves inside the rollback guard.Derived-identity closure
This PR is identity-moving: it must land before the fresh rebuild, never mid-run. It touches 12 members of the committed closure baseline (
docs/plans/schema-closure-baseline.json, unchanged; theschema-closuregate passed):polylogue/analysis/topology.py,polylogue/storage/archive_identity.py,polylogue/storage/archive_readiness.py,polylogue/storage/archive_tuple_location.py,polylogue/storage/derived/lineage/compact.py,polylogue/storage/derived/session/{derivation,input_binding,rebuild,status}.py,polylogue/storage/derived/topology/derivation.py,polylogue/storage/embeddings/identity.py,polylogue/storage/fts/fts_lifecycle.py.Not in the closure:
polylogue/storage/block_anchor.py,polylogue/storage/derived/session/marker_domain.py.Verification
All checks ran as AgentCTL jobs on this worktree; nothing ran in-process.
agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w5returned job 2686 on head2136284cf0:verify: PASSED exit=0(all gates, includingschema-closure,layeringandmypy).agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w5 -- <36 test modules covering every changed module and its consumers>returned job 2687 on2136284cf0: 855 passed, 3 failed, 1 error. The 3 failures and the error aretest_archive_readiness::test_pinned_materialization_readiness_degrades_like_its_path_twin,test_read_view_operations::test_lineage_and_topology_use_the_pinned_graph_engines,test_session_partition_convergence::test_the_partition_input_columns_are_projected_or_declared_excluded, and a descriptor-leak teardown error intest_event_order_permutations_converge_to_the_same_relation. All four fail identically on master1beb2e516a(job 2643) and are untouched by this PR.1beb2e516a, production code unchanged) in job 2488:38 failed in 273.95s, which is every named regression. The rebuilt deep-anchor test then ran alone in job 2685 and failed on the assertion (message_id not found in the named session or its lineage neighborhood) in 10.6 s. On this branch it passes (job 2684, 22 passed).ci/circleci: quick-gateandstacked-review-threadsgate the merge.Self-review
validate_inactive_destination, the one gate that bootstrap, embedding preparation and whole-tuple validation all call. TheCOMMIT-outside-trypattern also occurs infts_invariant_snapshot_sync, but that closes a read-only snapshot transaction whoseCOMMITcannot lose writes, so it is left as it is. The FTS derivation writers (fts/derivation.py) already commit inside their guard. The status dependency map was re-derived for all three run projections from the tables their SQL actually reads.required_pagereturns no keys and no cursor once the head stops moving. The anchor neighbourhood walk visits each session once through avisitedset, and it terminates on cycles.missinganswers. Each step is one indexed edge query and one two-bind hash query. Removing the per-transcriptINlist removes the only unbounded bind list.stateto inactive. Readiness no longer lets a zero denominator mask measured loss. Anchors refuse on ambiguity and never pick the first match.expected_tierparameter had no caller, and mypy (verify_quick) proves none remains. Thefloat16case was removed fromtest_embedding_request_identity.pybecause that element type is now refused._MAX_LINEAGE_SEARCH_NODES,_prefix_edge,_composed_message_idsand_hash_matches_in_composed_sessionhave no remaining references in code, tests or monkeypatch targets (grep, plus the mypy gate).initialize_archive_database,prepare_inactive_embedding_generation,ArchiveTupleAllocator.load,resolve_block_anchoroverwrite_parsed_session_to_archivedata,converge()over a real derivation registry,load_sync_batch+hydrate_sessions,session_insight_status_sync, andrepair_message_fts_index_syncwith a real SQLite authorizer denying the firstCOMMIT. The 520-deep anchor test asserts that the cited session'sread_archive_session_envelopereally contains the block. Every named test fails on master (job 2488).Per-finding dispositions
attach_readonly_databaseattach_readonly_databaseexpected_tierremoved (no caller; mypy)tuple-<id>child requirednot dry_run_write_jsonl_rowsremoved in e20f6f5 (#5680)applied_sequence+expected_prior_sequencein BEGIN IMMEDIATEcommit_candidate_membershipremoved in 0b1e99d (#5336)A =
tests/unit/storage/test_archive_location_admission.py, L =test_block_anchor_lineage_and_topology.py, P =test_profile_selection_and_hydration.py, C =test_embedding_recipe_and_fts_commit.py.Counts:
.9811 fixed / 6 fixed-already / 1 stale / 1 refuted / 6 not reached..998 / 2 / 4 / 0 / 11..1009 / 5 / 3 / 1 / 7.Residuals
lstat. A process that swaps the entry between the check and SQLite's open is outside the single-writer contract.🤖 Generated with Claude Code
https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg