Skip to content

fix: Land seventeen small-bead batches before the rebuild - #5224

Merged
Sinity merged 82 commits into
masterfrom
integ/small-batches
Sep 16, 2026
Merged

Sinity merged 82 commits into
masterfrom
integ/small-batches

Conversation

@Sinity

@Sinity Sinity commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Seventeen worker branches, each resolving a theme of small known-fix beads, integrated into one candidate: 472 files, +20,406 / −12,166, 80 commits (worker commits plus integration merges and eight cross-branch reconciliations). Every fixed bead carries one regression test that names its anti-vacuity condition.

Problem

The reindex campaign's closure held ~150 open beads whose fix was already known and small, spread across parsers, storage, daemon, surfaces, devtools and the test harness. Working them one PR at a time serialised on review and on the pytest slot. Bead status was stale in both directions: several dozen were already fixed at head, and a handful of premises were refuted on inspection.

Solution

Per theme (branch → beads):

  • batch3-identity: ig9tt irtix(1) 3ad8j(1,3) vabba zj8ns t1vl6 prwmd d9t8u asp4b(6) dhkuu(B) l3zva ddvpi m8yd5; 9193q already at head
  • batch3-devtools: uy1a5 7o5zj gcy1 8ykm 1bkl g31s zmlcn wbuf v6xh b1vr1 lafc4 d0kj acsmu hohj7 ga8vn c4a1o rxfo c2qsm t4l2q n6gnd 59qy ww6mj 5pv1p; already at head: b0vbz qai7u e4qyw 8errr v0t3r
  • batch3-daemon: ia88n(a) c1dx2 s4tkf 7z8do 7viwp 0ye6q jyzfs uwxir lbsh9 umca4 ji49p 7mkgv 5a6xc dvhe7 8374p o90gu 3zvsd 9z2gy hprg0 s4135 ho6m7 a03p0 6u8do; pinned at head: lr47v 8ifs 3ahdg f7bf9 liwst
  • batch4-harness: xbg9e o733y m3018(code half) 016xl(root cause: schema-closure import walk memoized on disk, 10.4→4.1 s per process); already at head: 3z1bj yichs csex1(AC1) ehva4
  • batch1-parsers: 8t9bj 6d7fx q5j3o 670mf sfu70 foi1h utv49 4mbya w54q3 1wom1 l0cnu gzxhi; pua53 at head
  • batch1-surfaces: o6oct g88v4 xtcdz i6p4x onbz3 vgxkk e9y76 nfr2u 4vjfd 45pkf l9u58 zu08l; at head: kjy0a oil1q m1s98 c0ay0 9qpx4
  • batch1-storage: nd2tb lyymm 3sic0(a–e) ebjar nszyu h9xx0 pv8xp wr0oe lezv0 5qrip lyqzg crcst; at head: bl132 4hys5 gzh7n son7n qczu5
  • batch4-ingest: f7pdm dznyt 3ijaa swicx(3/4) m5djs av5j1(2) 9k62p roaof 3r36h; l8tdh at head
  • batch4-identity2: s9w0h e2e25 8u1p 3vsoj xnk51 31zag ro922 t37k9 07rfc sqy57 h92sm khkup 8k10u 56jc6
  • B6 excision: 14ucm q4f6d aix14 9lrqs p1naz (+ unrecorded otlp_spans reach); at head: bhhsa si5kj
  • B7 vocabulary: z3sv hjvow bwh3h 7k3n0 exxly j1vs ir1wn grdt mjupn(part) jglh(part); a2jir at head
  • B8 daemon: zbzxs tjtua 5lfcr z5bu7 h8l96 w17k1 oa9w8 (+ duplicate ISOLATED_TIER_WRITE_PROFILE); iwmt at head
  • B9 ingest: 0ck6i zxpgj fkqxx(half) payqy xj7ru v85tn sifoy erf3; at head: h0nor ip0nq re4es
  • B10 CLI/API: 1c6j fawr7 lxdwy t83q(residual) lb15e(part) 01fe(origin class); at head: 1kavq v1mnm i58iu pd63j qwgi mon2f 395j
  • B11 tests/devtools: vwdj zphcj p9evo 6ou1q 7ui0g nlush b7c7m 4ayqx thqg2 8xvlf(part) + one real daemon saturation red; at head: vl7ra mnkfh 7y23g vhelw f3p8c mhy6z
  • B12 security: 97o2z xv0pf n61h5 4fbgw tztk 81v76 1oa7o; xtawb refuted at head
  • B13 campaign: k00uq cois9 xrba4 1ifhp; 4x38n at head

Integration reconciliations (own commits on this branch): the shared SQLite introspection helper moved to polylogue/core/sqlite_introspection.py (its storage home grew the surface→substrate ratchet for two daemon modules); the hook-drain cursor read guards on the carriers table instead of swallowing every sqlite3.Error; the audit principal_surface CHECK stays hand-written (durable DDL is not enum-generated) and is pinned to the literal by value set; the codex record-skip log is a structured event; --limit refuses non-positive and clamps to the ceiling; the raw-discovery sweep keeps the held-page cursor inside the arrival/sweep lanes; the prefetch timeout cancels unstarted, discards finished-unread and attaches the discard to still-running workers; generated surfaces re-rendered; writer-module census, schema-closure and degradation baselines refreshed for the deleted and added modules.

Beads skipped by workers are listed in the worker reports and stay open with their reason noted; none was closed without a fix at head.

Closure and rebuild

Dozens of files in this candidate are IN the derived-schema identity closure (parsers, write.py, archive_tiers specs, core enums/timestamps, sources, excision). The identity moves; this lands before the fresh rebuild starts and never during one. Content also changes for ChatGPT thought summaries, Gemini subagent origin, Codex world_state keys, Hermes profile keys, Grok session identity (content-derived, message-id namespace grok), tool_path/search_text widening for FTS, and the hash framing in _hash_bytes (length-prefixed) — all pre-wipe by design.

Verification

  • agentctl job start --workspace /realm/worktrees/polylogue-integ polylogue verify_quick → job 2459 succeeded (all 21 gates ok)
  • agentctl job start --workspace /realm/worktrees/polylogue-integ polylogue pytest_focused -- <162 touched test files> → job 2460: 5,795 passed / 13 failed (all cross-batch interactions, reconciled in 5f123c6 and 2da4406); re-test of the 13 files → jobs 2467+2470 succeeded (594 and 89 tests, all passed); quick gate re-run after reconciliation → job 2471 succeeded
  • Each worker branch additionally ran its own focused selections and, for most, devtools verify --quick green before integration (receipts in the worker worktrees).

Residuals

  • 15 test failures inherited on master (13 test_plain_cli_snapshots fixtures, 2 test_click_app read-view assertions) are owned by the peer session's 2206 fix and are not touched here.
  • test_codex_state_live_ingest.py::test_codex_goal_materials_do_not_cross_supersede_source_roots fails at base 342cf9e (inherited, unrelated).
  • Operator decisions surfaced by workers, left open: b5xfk (contradicts the chore: Merge the insights packages into ordinary layering and delete de… #4614 subdirectory contract), bwu75 (member-level disposition row needs a source migration), 4xhzs (no converger stage resumes accepted machine requests), om8dh, ew7ti, fxtbj, gzmd4, qut1/l6v61, v8dz.
  • pw5jd stays open: its classifier is landed by fix: Let the read operation own continuation, totals and failure exits #5222 (jtrtj) instead.
  • Corpus-scale receipts (memory.peak under the pytest slice at width 4, controller peak ≤600 MiB) were not produced; the width change is arithmetic plus unit tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw

Sinity and others added 30 commits September 16, 2026 04:50
…droom

The slice budget and the width derived from it disagreed by a worker. Sinnix
picks agentctl-pytest.slice MemoryHigh=12G by taking the intended width's peak
(4 * 2263 + ~1 GiB) and applying 1.2x -- "the corpus is sized for four
workers" -- and width_within() then subtracted a further 20% from that
already-headroomed ceiling, deriving 3. The headroom had one owner too many.

width_within is now (budget - CONTROLLER_PEAK) // WORKER_PEAK, so a slice
provisioned for N workers yields N: CORPUS_MAX_WORKERS goes 3 -> 4, and
AFFECTED_MAX_WORKERS follows through its existing min(). The margin's owner is
named in the module and in the sizing receipt (headroom_owner) instead of being
re-applied here, and MEMORY_HEADROOM_FRACTION is gone rather than left as a
second knob. PYTEST_SLICE_MEMORY_HIGH_MIB is unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
A single-file pytest selection spent 65.5 s in collection against 2.4 s of test
time (receipt 20260916T023414Z-focused-test-2145484-b403a9c9). Profiling the
same collection locally: 9.6 s of 14.3 s was _semantic_source_closure, which
re-parses every member of the parser-semantic import graph -- 560 files, 3.8 s
in compile() and 6.2 s in ast.walk -- to decide membership. The fingerprint
itself was already memoized on disk; the membership walk feeding it was
memoized only per process, so every xdist worker and every CLI start paid it
again.

The edges now persist in .cache/source-fingerprints/import-edges-v<n>.json,
keyed by each file's repository label and content digest. What is memoized is
lexical: the extensionless module bases the file's own text imports from, never
which of those resolved to a file at the time. Resolution stays live, so a
module added or deleted elsewhere still changes an unedited importer's closure
and the fingerprint it feeds.

Measured on this worktree, same file, fingerprint memo warm either way:
collection 10.37 s -> 4.1 s (three consecutive runs: 4.20, 4.07, 4.09), and
lowering/materializer/replay fingerprints are identical cold and warm.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Batch of small, independently-specified beads: dead-code retirement,
regression tests at production seams, and a few devtools repairs.

Deletions (zero production callers, verified by grep at head):
prune_orphaned_index_revision_seeds (polylogue-uy1a5), the stale
supersession reissue family (polylogue-7o5zj), archive/coverage.py
analyze_coverage with the UsageOutlookPayload.coverage_pct stub
(polylogue-gcy1), four RepositoryInsight*ReadMixin modules
(polylogue-8ykm), storage/embeddings/progress.py with the daemon
metrics and status-payload pre-split fallbacks (polylogue-wbuf),
sources/providers/claude_ai.py (polylogue-g31s), and the dead
notification_* config accessors (polylogue-v6xh). Tests certifying
the removed mechanics and the docs naming them go with them.

Fixes: drift-trend section on `polylogue ops diagnostics`
(polylogue-1bkl); benign-DDL validator rejects data-producing tails
(polylogue-d0kj); scratch-tree reclamation on every exit path
(polylogue-acsmu); webui blocked-env branch bound to package.json
(polylogue-hohj7); declaration-time handler resolution
(polylogue-ms4uy); upsert_ingest_cursor manage_transaction so cursor
rebase is one transaction (polylogue-5pv1p); health-threshold
accessors routed (polylogue-v6xh); audit tier in `config paths` and
tier enumerations pinned to ARCHIVE_TIER_ORDER (polylogue-b1vr1);
RUF068 enabled with its one duplicate __all__ entry removed
(polylogue-zmlcn); and real-value assertions for several tests
(polylogue-rxfo, -c2qsm, -t4l2q, -ga8vn, -c4a1o, -59qy, -n6gnd,
-ww6mj, -8errr).

Verification: devtools verify --quick (21 gates ok), devtools render
all --check (sync OK, no "out of sync"), devtools test over the 29
touched and consumer test files (1140 passed, exit 0).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
…uild

Twelve small, independently-specified defects, grouped because every touched
file is inside the derived schema-identity closure and must land before a
fresh archive rebuild starts.

Identity and hashing
- pipeline/ids.py `_is_redundant_text_only_block` ignored every
  evidence-bearing block field, so a TEXT block carrying citations, metadata,
  a tool outcome or a file edit collapsed to the empty sentinel and hashed
  equal to a bare echo of `message.text`. The conjunction now covers
  metadata, web_constructs, is_error, exit_code, tool_outcome,
  outcome_unknown_reason and file_edit; `signature` stays excluded on
  purpose. (polylogue-ig9tt)
- archive_tiers/write.py `_hash_bytes` framed fields with one NUL separator.
  Imported content legitimately contains U+0000, so two different field
  splits could serialize to one byte stream and one content hash. Each part
  is now length-prefixed with an 8-byte big-endian length. THIS MOVES EVERY
  CONTENT HASH THE FUNCTION PRODUCES -- allowed because it lands pre-wipe,
  ahead of the fresh build. (polylogue-irtix, item 1)

Usage and cost reads
- storage/usage.py `ProviderUsageLanes.from_counters` subtracted reasoning
  from output unconditionally, understating completion tokens for a
  separate-lane provider and breaking `has_disjoint_partitions`. It now
  subtracts only when `output_includes_reasoning`.
- `_sample_event_sessions(missing_model=True)` used bare `TRIM`, which strips
  only U+0020, so a whitespace-only model name was counted as missing yet
  never sampled. It now passes the same explicit strip set the aggregate
  uses. (polylogue-3ad8j, items 1 and 3; item 2 -- the prefix-sharing join
  fan-out -- is left open: it needs a cost-model ruling on what a
  contradicted lineage edge means for attribution.)

Parsers and providers
- claude/code_parser.py now records `apiBlockIndex` and `quotaLimits`
  (rate_limit_type/resets_at/status) on the message_usage payload beside
  request_id. Measured first over ~/.claude/projects (15,215 files): all
  182,187 apiBlockIndex and all 222 quotaLimits occurrences sit on
  type:"assistant" records carrying message.usage, so the payload gate the
  reader runs behind is always satisfied. (polylogue-vabba)
- claude_code_record.py `text_content` read top-level `content` for
  type:"summary" records, whose text is under `summary`; the fixture that
  pinned it asserted a key-set the corpus never carries. Split into the two
  real record families. (polylogue-zj8ns)

Bounding untrusted input
- origin_specs.py Hermes admission read whole candidates with no ceiling.
  The JSON branch is now gated on the stat size the caller already holds
  (SOURCE_CLASS_JSON_PROBE_MAX_BYTES) and the JSONL branch reads bounded
  records at JSONL_RECORD_INSPECTION_BYTES; batch.py and batch_support.py
  pass the observed size. (polylogue-dhkuu, finding B)
- assembly_codex.py `_parse_state_db_file` fetchall'd every `threads` row of
  a state_5.sqlite located positionally beside session content. Bounded by a
  server-side LIMIT plus a title length cap, with the shortfall reported as
  a counted degradation on the assembly result. (polylogue-ddvpi)
- browser_capture.py `_merge_envelope_attachments` rescanned every merged row
  per unmatched candidate with a full-byte compare. Candidates are now
  indexed by (message_provider_id, name); size stays a predicate check inside
  the cohort because the match rule only requires size equality when both
  sides declare one. (polylogue-l3zva)
- rendering/identity.py `identity_frame` stepped its ladder once per
  character of the longest identifier, so one megabyte-long native id cost
  ~10^6 * N renders on every query returning it. Identifiers are bounded at
  MAXIMUM_DISPLAY_LENGTH with an observable OVERLONG_MARKER. (polylogue-m8yd5)

Authority and lineage
- revision_backfill.py Antigravity `.pb` replay re-derived from the live file
  while ignoring the retained blob, and Antigravity rewrites those files in
  place -- so current content could be replayed under an older revision's
  raw_id. A content-hash mismatch is now a typed
  AntigravityTrajectoryDriftError. (polylogue-t1vl6)
- raw_retention.py reduced a frontier violation to physical source paths,
  admitting a sibling path of a still-violated logical source. Refusal is now
  expanded by logical_source_key; the per-path refusal count is unchanged.
  (polylogue-d9t8u)
- write.py `_claude_agent_dispatch_parent_claim` resolved two hook records
  disagreeing over one tool_use_id by sorted agent-id order. That is now a
  flagged ambiguity: no parent adopted, contested ids and agents retained on
  the link's evidence. (polylogue-asp4b, item 6 only)
- write.py rebinds a Hermes observer's parent key onto the conversational
  session by raw id, with the profile qualifier as a tie-break, and refuses
  the literal artifact name "events" as a parent id. The fail-closed rule
  holds: an ambiguous raw id keeps the parser's own key rather than guessing.
  (polylogue-prwmd)

Verification
  devtools verify --quick -> all gates ok (exit 0)
  devtools test <11 modules> -> 924 passed, exit 0

The layering ratchet's sqlite-degradation baseline moves two
assembly_codex.py anchors to their new digests; no site was added.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
polylogue-zbzxs, polylogue-tjtua.

A narrowed batch pass recorded whole-archive stages as SKIPPED, which
FileState.converged counts as converged, which left no debt to preserve --
and clear_convergence_debt_except with an empty failed-stage set degenerates
into "delete every debt row for this subject". A re-observed file with no
session changes reached the same clear with zero stages executed.

- StageState.NOT_RUN distinguishes "this pass deliberately did not run it"
  from SKIPPED ("not applicable at all"); it is not converged and lands as
  deferred (owed, not broken) convergence debt.
- The full-ingest path only records a convergence outcome when a convergence
  pass actually ran.
- Stage checks that raised no longer return True ("assume work"): with
  false_means_pending that turned a permanently failing probe into an
  unbounded retry loop. The engine already records a raising check as a typed
  FAILED stage with debt-backed bounded retry.
- A failed per-key inspect retry no longer also writes KeyStatus.VALID; the
  recorded FAILED verdict is what stops the main loop, and claiming VALID
  asserts exactly what the failed inspect is the absence of evidence for.
- The publication budget counts publish attempts, so an adapter that always
  mis-publishes cannot issue unbounded publish() calls inside one pass.

Verification: devtools test tests/unit/daemon/test_derivation_kernel_laws.py
tests/unit/daemon/test_convergence_not_run_debt.py
tests/unit/daemon/test_daemon_convergence.py
tests/unit/daemon/test_convergence_stages.py
tests/unit/sources/test_convergence_debt_deferred_vocabulary.py -> PASSED exit=0

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Ten private `_timestamp_ms` / `_iso_from_epoch_ms` / `_epoch_ms` copies each
baked in their own answer to "what unit is a bare number", so the same
all-digit string resolved 1000x apart (1970-01-21 vs 2025-01-01) depending on
which copy a caller reached.

`polylogue.core.timestamps.to_epoch_ms` is now the single kernel and takes
`numeric_unit` explicitly: provider-wire callers (parser writes, browser
capture, sinex material adapter) declare "seconds", stored-millisecond row
readers declare "milliseconds". `iso_from_epoch_ms` is its inverse and
replaces the three ISO copies plus the `row_iso_from_epoch_ms` re-export that
four daemon modules imported under an aliased private name.

`archive/query/unit_results._epoch_ms` was not a coercion fork at all -- it
lowers query-grammar date text -- and is renamed `_query_date_ms` to say so.

This commit also lands two sibling vocabulary collapses:

- TerminalState is declared once in core/enums.py and its three consumer
  tables are typed and asserted total at import, so `refused` and `truncated`
  stop defaulting to noise and the dead `clean_finish` / `agent_hanging` keys
  are gone (polylogue-hjvow).
- DEFAULT_MESSAGE_PAGE_LIMIT replaces the CLI's 50, the daemon's 30 and MCP's
  20, so one session id returns one row count on every surface
  (polylogue-bwh3h).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
connection_profile.py bound ISOLATED_TIER_WRITE_PROFILE twice at module
scope with different timeout and autocheckpoint policy. Python kept the
second, so the first -- and the comment justifying it -- was dead code that
read as the live policy. __all__ listed the name twice for the same reason.

Pinned by an AST check over the whole module rather than the one name, so any
future re-shadowing of a profile constant is red.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
polylogue-5lfcr. record_route_observation's own docstring frames it as
best-effort telemetry, explicitly contrasted with the durable,
outbox-delivered record_mcp_call -- but its ops.db connection ran at the
default synchronous=FULL, so every observation committed with a synchronous
fsync on the hot path of the route it was measuring (12.88 ms per
insert+commit measured against a real ops.db; the pruning work the same call
does measured 0.04 ms).

ops.db is the disposable tier. The emit connection now opens with
synchronous=OFF, which keeps the row committed and immediately visible to
other readers and drops only durability across a host crash, for a tier whose
whole contract is that it can be discarded. Both properties are tested.

Not measured here: the post-change per-observation cost on the reference
host. The change is a durability-policy change, not a tuning guess.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
polylogue-z5bu7 was confirmed already fixed in product code at head:
assert_readable_archive_layout's sqlite3.Error branch reports
lifecycle_action="retry" with "the archive schema was not inspected", and the
write path lets operational errors propagate rather than reclassifying them.

Nothing pinned that. A regression here sends an operator to reset a sound
index over a transient lock, so the behaviour now has a test.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
polylogue-h8l96. The set of insights MCP could project was a hand-written
frozenset of five tokens with no derivation and no test. Of the registry's
thirteen descriptors it exposed exactly one (tool_episodes); the other four
tokens are not registry descriptors at all. A newly registered descriptor
gained no MCP surface and nothing failed.

query(projection=...) now resolves registry descriptors generically through
the registry's own fetch/payload contract -- the same way the daemon's
/api/webui/insights/:name route already resolves them -- so a new descriptor
gains an MCP surface with no edit. The four dispatcher-compiled reports
(postmortem, pathologies, abandoned_sessions, stuck_sessions) are bundles over
a session query rather than listable relations, so they stay, declared
explicitly as _STANDALONE_INSIGHT_REPORTS and asserted disjoint from the
registry.

Bounds a descriptor does not declare are dropped rather than refused, matching
the rule export_bundles already applies.

CLAUDE.md's "MCP insight projections still bypass the registry" caveat is
removed because it is no longer true.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
polylogue-w17k1. The declaration was wrong in both directions at once: seven
of nine declared resources did not exist, and thirteen live registrations were
undeclared. Neither direction had a test, and tests/infra/mcp.py documented
the missing pin in a comment.

- server_resources.py exposes registered_resource_uri_templates(), which runs
  the real registration pass against a recorder rather than restating it.
- TARGET_RESOURCES now declares exactly those fifteen templates.
- The seven phantom object kinds are recorded as
  UNBUILT_RESOURCE_OBJECT_KINDS, not deleted: the stable-URI-per-identity
  design intent is still wanted, and a narrowed declaration must not read as
  "these were never wanted".
- build_live_manifest() gains missing_target_resources (mirroring
  missing_target_tools), undeclared_live_resources, and the unbuilt kinds.
- tests/infra/mcp.py regains the declaration-derived resource pin.

Both reconciliation directions are now empty and asserted.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
…r batch

polylogue-oa9w8. validate_raw_ids walks raw ids in batches of 50 and
resolve_validation_dispatch returned an unconditional process pool for every
batch, so evaluate_raw_artifacts constructed a fresh spawn-based
ProcessPoolExecutor per batch -- ~863 pool constructions for the 43,124-raw
corpus, each worker a fresh interpreter re-importing polylogue.

The dispatch gains the same aggregate-blob-bytes tier resolve_ingest_batch_
dispatch already uses: at or below 8 MiB the batch validates in-process.
Above the tier the worker formula is unchanged. A caller that cannot weigh its
batch (total_blob_bytes=None) keeps the historical process answer.

Not done: the before/after wall-time and process-CPU measurement over a real
multi-batch raw population on the reference host, which needs the corpus. The
regression instead observes pool construction directly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Session excision reported success while evidence keyed to the session
survived: container payloads held live through source_items, telemetry
spans, publication reservations. The membership list of "what excision
must reach" was hand-maintained, so each new session-keyed relation was
silently exempt.

excision_carriers declares the reach of every source-tier relation
carrying a session key (a raw_id column, or an (origin,
session_native_id) pair), scans the live schema for them, and refuses the
excision when one has no declared reach or claims a raw-cascade its
foreign key does not provide. source_items now gets a per-member
disposition; a container still holding the excised bytes for another live
session is a named residual that makes the receipt incomplete.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Deleting a codex_thread_spawn_edge claim leaves the loser
authority-contradicted and the winner authoritative on evidence that no
longer exists, and nothing re-derives. Retaining the last recorded
verdict stays the policy; the archive now names those verdicts as their
own warning class instead of reporting the topology check OK.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
# Conflicts:
#	tests/unit/sources/test_origin_specs.py
Four vocabularies that each existed in three to six copies now have exactly
one declaration, and every consumer -- including the SQL -- is generated from
or reduced through it.

- Tool input keys (polylogue-7k3n0): `core/tool_identity` declares
  TOOL_PATH_INPUT_KEYS / TOOL_COMMAND_INPUT_KEYS and the SQL renderer that
  builds a COALESCE from them. The generated `blocks.tool_path` and
  `tool_command` columns and the FTS `search_text` projection -- the authority
  structured queries and search actually read -- carried the NARROWEST of the
  five key sets, so a NotebookEdit's `notebook_path` rendered but could not be
  searched. All five readers now share one list.
- Tool operation classification (polylogue-exxly): `archive/viewport/tools`
  owns the category predicates, and `pipeline/semantic_capture` reduces
  `classify_tool` through them instead of a hardcoded Claude-Code tool-name
  allowlist that recognised only Read/Write/Edit/NotebookEdit and only Bash
  for git. `parse_git_operation` is no longer gated on the tool being literally
  named Bash.
- Render destination (polylogue-j1vs): `_READ_DESTINATIONS` and
  `_READ_TIMESTAMP_POLICIES` derive from the RenderDestination /
  RenderTimestampPolicy enums, `QueryDeliveryTarget.kind` is a
  RenderDestination rather than its own three-member Literal plus a "path"
  token, and every dispatch site compares enum members instead of raw strings.
- Surface (polylogue-ir1wn): PrincipalSurface (who mutated) and
  TelemetrySurface (which transport served a read) are declared once in
  core/enums with why they are deliberately not joinable, and the audit.db and
  ops.db CHECKs are generated from them. Values are byte-identical to the
  hand-written lists, so no durable migration is implied. The dead fourth
  declaration in production_evaluator, which spelled the daemon HTTP route
  `daemon-web` where no writer ever produced that token, is deleted.

Schema note: the generated-column widening moves the derived schema identity
and needs a reconvergence, and it widens what FTS indexes for tool blocks.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
The writer_modules lint scanned only archive_tiers/, so the inventory proved
its own internal consistency and nothing else: 77 DML-bearing modules
elsewhere in polylogue/ owned tiers with no declaration and drew no
objection. Add census_roots plus a checked-in census baseline: a DML module
outside the inventory must already be in the census, and a census entry that
stops mutating is stale, so the set can shrink but never grow silently. The
layering.yaml header now states the inventory's scope where it claims to be
audited.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
perf_floors emitted 0.0 for a zero-sample lower_is_better metric, which
--update-floors would ratchet in as a permanent pass; a zero baseline was
treated as "no regression"; and a floor whose metric stopped being measured
(several names are munged from route strings, so a rename produces a new
metric) disappeared silently. Zero samples and non-positive measurements are
now refused at the source, a non-positive baseline reports UNMEASURED and
fails, and a recorded floor with no candidate reports MISSING and fails.

Three benchmark vacuities go with it: cold-start and warm-status recorded
first_byte_ms/full_render_ms as copies of the one elapsed value they
measured (deleted, including from PROFILE_METRICS), and the concurrent-read
benchmark issued four identical requests that the daemon read cache served,
so it measured the cache rather than interference.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
The durable-enum-checks gate tests a signature of the invariant (a durable
literal list whose members equal some enum's values), which needs waivers for
the two hand-written lists that coincide. This tests the property directly:
render source/user/audit DDL, extend every persisted vocabulary with a
synthetic member, re-render, assert byte equality -- so any route into
durable DDL is red with no waiver consulted. A companion test proves the
extension really reaches the renderers, and a third proves the probe restores
the real modules.

Also drops a docstring reference to a raw-convergence helper that no longer
exists.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
…ites

The cross-cluster cost suite re-tested cases the focused suites already own
against the same production functions. Quota-pressure absence was assertion-
for-assertion identical to test_outlook.py's version and is deleted; the
curated seed's non-authoritative notice is now asserted where the seed is
owned (test_plans.py), strengthened from "notice is truthy" to the substring
the UX depends on; the month-end-anchor and DST cycle-window cases moved to
test_plans.py, which owns cycle_for.

Retained in the cross-cluster suite: the basis-split and aggregation
contracts, the curated-plan-to-outlook wiring, the projection monotonicity
properties (a different oracle from the focused fixed-point tests), and the
CLI/MCP envelope parity. 14 tests -> 12 plus 2 moved; no oracle weakened.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
… unscanned

polylogue-97o2z: the secret scanner covered `blocks` only, so a credential
pasted into the system prompt was never surfaced. `_scan_targets_for_session`
is now the single chokepoint for both the single-session and archive-wide
routes and also covers `sessions.instructions_text`/`title`/
`git_repository_url` and `messages.user_context_text`, recorded under the
`session:`/`message:` refs excision already resolves. SECRET_SCAN_VERSION
bumped to 2 so existing coverage rows rescan.

polylogue-xv0pf: `scan_path_for_secret_candidates` returned `[]` both for a
clean file and for one it never read (over the 20 MB cap, unreadable, or not
UTF-8), and both CLI callers printed nothing — the largest, most shareable
exports were reported as clean. It now returns a typed `PathScanResult` with
`scanned`/`unscanned_reason`, and the shared `describe_path_scan_result`
notice both callers use says NOT SCANNED explicitly. The two tests pinning
the silent `[]` are replaced.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Six ingest/sources defects that each reported an unmeasured state as a
positive result:

- polylogue-0ck6i: raw discovery reset its cursor to the head of the key
  space on any new arrival, so under a sustained arrival rate the sweep
  never advanced past its first page. The frontier now feeds an arrival
  lane that alternates with the sweep instead of discarding its position.
- polylogue-zxpgj: a legacy-read-only hook root never acknowledges, so
  every bounded drain re-collected the same first 250 envelopes and
  reported the repeats as progress. Drains now resume from the durable
  hook_event_carriers prefix.
- polylogue-fqnv: _merge_observed_structure_pair had the wipe-everything
  shape already fixed in collapse_dynamic_keys - static properties
  standing beside an existing additionalProperties model were swept into
  it.
- polylogue-fkqxx (first half): the generic except branch in
  _stream_prefixed_items returned partial records at DEBUG level while
  the JSONError branch beside it raised PartialJsonStreamError for the
  identical loss.
- polylogue-payqy: sniff_zip_provider returned the first member that
  detected and applied it to every member; it now weighs detections by
  member size and returns None for a genuinely mixed archive.
- polylogue-xj7ru: occurred_at_ms was bounded only against negatives, so
  a far-future record pinned its session at the top of freshness
  ordering. A declared absolute ceiling refuses it at the parser
  boundary rather than clamping.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Sixteen named helpers each ran their own `sqlite_master` probe, with five
different type-sets, so the same database answered "does this exist"
differently depending on which copy a caller reached -- a query-time view
(`actions`, `threads`) was present to one helper and absent to another, and
several interpolated the schema or table name into the SQL by hand.

`storage/introspection` now owns all four questions -- table, table-or-view,
view, trigger -- sync and async, with one schema-attachment guard and one
quoting policy behind them. `relation_exists` gained the attachment guard
`table_exists` already had; `view_exists`, `trigger_exists` and
`trigger_exists_async` are new members of the same owner rather than new
private copies.

Callers that genuinely differ keep their own thin wrapper and say why in a
docstring: the optional-connection status probe, the not-yet-attached schema
probe that swallows `sqlite3.Error`, the mid-migration probe that swallows
`no such table`, and the `temp`-schema probe -- which now reaches the temp
schema through the shared primitive instead of `sqlite_temp_master`.

Residual: ~130 inline `sqlite_master` probes remain at their call sites. This
commit collapses the named helpers, which are what callers reached for; the
inline ones are a separate mechanical sweep.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
…te governance

Problem
-------
Two transition-era bodies of code survive with no production route.

`polylogue/storage/ingest_byte_governance.py` (543 lines) has zero
references anywhere in the tree -- grep over the whole worktree including
tests returns only the file itself. The accepted-ingest route imports only
the membership half, so a byte-governed raw could never be selected by any
cohort (polylogue-nd2tb).

The one-shot historical blob-ref repair subsystem existed solely to
classify and repair one pre-#3868 defect on the operator's live archive.
PR #4618 already deleted its mutation half; what remained was read-only
residue plus its readers. `blob_ref_liveness.py` also made `safe_to_apply`
false whenever any rekeyable hook ref existed, blocking the generic
orphan-prune route entirely (polylogue-lyymm).

Solution
--------
Delete `ingest_byte_governance.py`, `blob_ref_liveness_reconciliation.py`,
`hook_payload_ref_reconciliation.py` and `blob_ref_liveness.py`, plus every
reader: the `rekeyable_legacy_ref` owner and its branches in
`blob_liveness.py`, the legacy match-stage threading in `blob_gc.py`, the
source-continuity recovery chain in `durable_change_train.py` whose only
caller was the deleted module, the `blob-reference-liveness` CLI command and
its declaration, and the `docs/maintenance.md` section. The tests that
certified the deleted mechanics go with them; tests covering surviving
behaviour are kept.

`validated_blob_ref_liveness_joins()` survives in `blob_liveness.py` -- it is
the generic ref-type join map `archive_verification.py` still uses.

`write_source_hook_event` already writes the correct `hook_payload` shape
keyed by `hook_event_id`, so on a fresh archive the orphan population this
repaired is empty by construction.

Schema closure
--------------
`devtools schema closure` reports IN for both `blob_gc.py` and
`blob_liveness.py`, so this is a closure-moving change: the derived schema
identity moves, the archive must reconverge, and this must land before a
fresh rebuild starts, never during one.

Not done here
-------------
The bundled `raw_hook_events.blob_hash` NOT NULL tightening is out of scope
(a durable migration). The stale DDL comment naming the deleted module was
reverted: rendered DDL text is version-gated, and a comment is not worth a
source-tier version bump.

Verification
------------
devtools verify --quick -> all 21 gates ok (including layering,
schema-manifest, schema-closure, consumer-reachability)
devtools render all --check -> exit 0, zero "out of sync"

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
…flight

polylogue-v85tn: parse_verification_evidence_db materialized both tables
with fetchall() and no row budget, while decode.py routes any
structurally-matching SQLite path here ahead of the generic JSON decoder.
Both tables now group straight off the cursor, and a file past the
declared row bounds is a counted refusal rather than a partial parse.

polylogue-sifoy: _preflight_sqlite answered an admissibility question by
running list(parse_trajectory_db(...)), which runs one steps query per
trajectory_meta row, so the cost scaled with the crafted file. It now
probes a bounded prefix and reports the unexamined remainder as a
counted caveat instead of a silently partial "supported".

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Problem
-------
Nine independent storage/runtime seams reported something they had not
established.

- `archive_debt._read_user_version` -- the one reader whose job is to
  diagnose a skewed tier opened with `validate_schema` defaulted on and
  caught only `sqlite3.Error`, so `SchemaSkew` (a Polylogue DatabaseError)
  raised out of the debt projection on exactly the case it exists for.
- `index_generation` built `/proc/self/fd/{fd}` literally at two sites,
  bypassing `descriptor_alias_path()`, which probes `/dev/fd` too and
  validates inode identity.
- `converge_same_version_tier` had no EMBEDDINGS branch, so a same-version
  open returned a connection with sqlite-vec never loaded -- every `vec0`
  query on it fails with "no such module".
- `measure_archive_capacity` measured free space on the archive root's
  filesystem, not `IndexGenerationStore.generations_root`'s, which a
  symlink-farm layout resolves elsewhere: the gate admitted or refused a
  candidate build on space it will never consume.
- `assert_owns_archive_location` validated the configured root and the
  captured active-index identity but never that acquisition happened, so a
  token from the public constructor -- or one returned by `release()` --
  passed as an exclusive-ownership proof. (polylogue-3sic0)
- `daemon/similarity.py` reported anything not containing the word
  "extension" as `not_embedded`; `readiness` returned `{}` from a bare
  `except sqlite3.OperationalError`; `daemon/http.py` rendered any
  FTS-mentioning exception as a missing index. Contention and corruption
  were published as clean negative content facts. (polylogue-ebjar)
- `source_freshness` ordered revision-application recency by a candidate
  column list containing none of the table's real columns, so it always
  fell back to `rowid`; its test's synthetic schema invented
  `applied_at_ms`, which is why nothing caught it. (polylogue-nszyu)
- `ingest_worker._enrich_parsed_sessions` returned False on every path
  after on-demand discovery was removed, making `sessions_unenriched` and
  its summary counter permanently zero. (polylogue-wr0oe)
- `_vector_derivation_hash_sql` rebuilt the recipe with a hardcoded
  `dimensions=1024`, so at any other configured dimension the SQL-side
  vector address disagreed with the embed-time one and every message stayed
  pending forever, re-embedding on each pass. (polylogue-crcst)

Solution
--------
Each seam now answers with what it actually knows. New
`is_corrupt_sqlite_database` in `core/sqlite_locking` classifies
SQLITE_CORRUPT/NOTADB/IOERR by result metadata, and the three runtime
layers report typed unavailable/degraded instead of absence. The
embeddable-messages relation carries the whole `EmbeddingRecipe` (registered
by its own recipe hash) rather than a model name, so selection and embed
address identically at any dimension. `sessions_unenriched` is deleted with
its counter, summary field and stale docstring, and the stale Drive/watcher
import-cycle comment now says what is true.

Every fix carries one regression test at the production seam whose docstring
names its anti-vacuity condition.

Not done here
-------------
The GROUP_CONCAT dedup and tool-pairing items from polylogue-3sic0 are
skipped: both are query restructures inside the derived schema closure that
change a shared read contract, not one-liners. The fifth text-based lock
predicate in `sources/live/watcher.py` is deliberately left alone -- that
file IS in the derived schema identity closure and routing it costs
reconvergence.

Schema closure
--------------
IN: bootstrap.py, index_generation.py, archive_identity.py,
candidate_capacity.py, ingest_worker.py, embeddings/identity.py,
core/sqlite_locking.py. out: archive_debt.py, readiness, daemon/http.py,
daemon/similarity.py, source_freshness.py, embeddings/materialization.py.
So this change moves the derived schema identity and must land before a
fresh rebuild starts.

The two `sqlite_degradation` baseline anchors for archive_debt.py and
readiness split/moved because the handler text changed; the site count is
unchanged (both handlers narrowed, neither added).

Verification
------------
devtools verify --quick -> all 21 gates ok
devtools test tests/unit/{storage,maintenance,operations,core,pipeline,daemon}
  ... each targeted file PASSED (receipts under .cache/verify/runs)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
`get(ref, projection=X)` carried four hand-written branches, each
independently re-spelling the projection name, the archive method it calls,
the payload key and the envelope around it -- against a CLI `read --view`
vocabulary that is already registry-checked, with nothing tying the two
together. `file-edits` in particular existed twice.

`mcp/session_projections` is now the single declaration, and it asserts at
import that every name it serves is in the shared `archive/viewport`
read-view vocabulary, so MCP cannot invent a projection the other surfaces
have never heard of.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
Sinity and others added 6 commits September 16, 2026 06:26
# Conflicts:
#	polylogue/security/excision.py
#	tests/unit/api/test_facade_contracts.py
#	tests/unit/daemon/test_http_write_coordination.py
#	tests/unit/sources/test_revision_backfill.py
The declared excision-reach registry (polylogue-14ucm) reads the live source
schema, so it joins the derived-identity closure by import; one member added.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
polylogue-1oa7o (P1). This checkout is a free-threading CPython build, so a
spawned thread inherits the creating thread's ContextVars: every thread
started during a hold sees the daemon's live WriteLease object in _ACTIVE.
The module's docstrings reasoned about contexts as isolating; they now state
that authority rests entirely on explicit thread identity.

Taking option (b) from the bead -- binding is delegated by the owner rather
than self-served -- and closing the three concrete residuals:

1. bind_write_lease_thread() read the ambient lease and added the calling
   thread's id, so any inheriting thread could self-authorize into the live
   lease. It now requires a single-use WriteLeaseThreadGrant, mintable only
   from a context that passes require_write_lease and checked against that
   exact lease object. _run_in_daemon_thread mints the grant on the owning
   side before the worker thread exists.
2. A nested write_lease(...) in an inheriting thread took the re-entrant
   branch and yielded the parent's lease with no ownership check. The branch
   now runs the same require_write_lease identity check.
4. bound_thread_ids was mutated by an unsynchronized check-then-assign. It is
   now read and widened only through WriteLease.authorize_thread /
   authorized_threads under a per-lease lock.

Residual 3 (bound_thread_ids entries are never removed and OS thread ids are
reused) is unchanged and still open: it needs a lifetime model for the bound
set, not a narrower binding gate.

Verification: devtools test tests/unit/storage/test_write_lease.py PASSED
(four new regressions, each naming its anti-vacuity mutation); tests/unit/daemon
PASSED.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
# Conflicts:
#	tests/unit/storage/test_archive_identity.py
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 470 files, which is 370 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: b6ad82cb-3438-45a6-9681-c6a8679dc0cc

📥 Commits

Reviewing files that changed from the base of the PR and between 342cf9e and 2da4406.

⛔ Files ignored due to path filters (2)
  • polylogue/schemas/providers/grok/versions/v1/elements/session_document.schema.json.gz is excluded by !**/*.gz
  • polylogue/schemas/providers/grok/versions/v2/elements/session_document.schema.json.gz is excluded by !**/*.gz
📒 Files selected for processing (470)
  • .agent/demos/attachment-acquisition-census/ANALYSIS.md
  • .agent/demos/attachment-acquisition-census/README.md
  • .agent/demos/attachment-acquisition-census/census.json
  • .agent/demos/attachment-acquisition-census/reconcile-attachment-coverage.json
  • .agent/demos/attachment-acquisition-census/regenerate.sh
  • .agentctl/project.toml
  • CLAUDE.md
  • TESTING.md
  • browser-extension/manifest.json
  • browser-extension/scripts/validate-manifest.mjs
  • browser-extension/src/background/adapters.js
  • browser-extension/src/background/runtime.js
  • browser-extension/src/popup.js
  • browser-extension/tests/background.test.js
  • devtools/continuity_evidence.py
  • devtools/continuity_replay.py
  • devtools/gate.py
  • devtools/manifest_models.py
  • devtools/pytest_slot.py
  • devtools/render_cli_output_schemas.py
  • devtools/run_tests.py
  • devtools/verification_admission.py
  • devtools/verify.py
  • devtools/verify_layering.py
  • devtools/verify_population_coverage.py
  • devtools/verify_runs.py
  • devtools/verify_schema_manifest.py
  • devtools/verify_schema_provider_identity.py
  • devtools/verify_webui.py
  • devtools/worker_memory.py
  • docs/agent-integration-reference.md
  • docs/agent-manual.md
  • docs/atlas/daemon.md
  • docs/design/raw-decision-authority.md
  • docs/hermes-operators.md
  • docs/library-api.md
  • docs/maintenance.md
  • docs/openapi/search.yaml
  • docs/plans/layering-surface-baseline.json
  • docs/plans/layering.yaml
  • docs/plans/schema-closure-baseline.json
  • docs/plans/sqlite-degradation-baseline.json
  • docs/plans/writer-module-census-baseline.json
  • docs/schemas/cli-output/README.md
  • docs/schemas/cli-output/search-envelope.schema.json
  • docs/security.md
  • docs/structured-logging.md
  • polylogue/agent_integration/data/deep-reference.md
  • polylogue/agent_integration/data/integration-manifest.json
  • polylogue/agent_integration/data/integration-spec.json
  • polylogue/agent_integration/data/standing-manual.md
  • polylogue/agent_integration/manifest.py
  • polylogue/analysis/archive_rollups.py
  • polylogue/analysis/capture_coverage.py
  • polylogue/analysis/hermes_topology_projection.py
  • polylogue/analysis/objective_posture.py
  • polylogue/analysis/pathology.py
  • polylogue/analysis/resume.py
  • polylogue/api/__init__.py
  • polylogue/api/archive.py
  • polylogue/api/ingest.py
  • polylogue/api/insights.py
  • polylogue/api/sync/sessions.py
  • polylogue/archive/coverage.py
  • polylogue/archive/query/production_evaluator.py
  • polylogue/archive/query/source_freshness.py
  • polylogue/archive/query/spec.py
  • polylogue/archive/query/unit_results.py
  • polylogue/archive/raw_payload/decode.py
  • polylogue/archive/revision_authority.py
  • polylogue/archive/semantic/content_projection.py
  • polylogue/archive/semantic/subscription_models.py
  • polylogue/archive/semantic/subscription_pricing.py
  • polylogue/archive/viewport/models.py
  • polylogue/archive/viewport/tools.py
  • polylogue/browser_capture/receiver.py
  • polylogue/cli/archive_query.py
  • polylogue/cli/commands/diagnostics.py
  • polylogue/cli/commands/excise.py
  • polylogue/cli/commands/maintenance/_blob_integrity.py
  • polylogue/cli/commands/maintenance/_embedding_preservation.py
  • polylogue/cli/commands/maintenance/_raw_identity.py
  • polylogue/cli/commands/paths.py
  • polylogue/cli/commands/reset.py
  • polylogue/cli/commands/tutorial.py
  • polylogue/cli/convergence_feedback.py
  • polylogue/cli/messages.py
  • polylogue/cli/operation_kernel.py
  • polylogue/cli/query_contracts.py
  • polylogue/cli/query_output.py
  • polylogue/cli/query_verbs.py
  • polylogue/cli/read_views/base.py
  • polylogue/cli/read_views/events.py
  • polylogue/cli/read_views/file_edits.py
  • polylogue/cli/read_views/messages.py
  • polylogue/cli/read_views/query_set.py
  • polylogue/cli/read_views/standard.py
  • polylogue/cli/read_views/streaming_markdown.py
  • polylogue/cli/read_views/web_content_constructs.py
  • polylogue/cli/shared/embed_stats.py
  • polylogue/cli/shared/helper_summary.py
  • polylogue/config.py
  • polylogue/core/enums.py
  • polylogue/core/errors.py
  • polylogue/core/payload_coercion.py
  • polylogue/core/schema_subjects.py
  • polylogue/core/sqlite_introspection.py
  • polylogue/core/sqlite_locking.py
  • polylogue/core/timestamps.py
  • polylogue/core/tool_identity.py
  • polylogue/core/write_lease.py
  • polylogue/daemon/catchup_status.py
  • polylogue/daemon/cli.py
  • polylogue/daemon/convergence.py
  • polylogue/daemon/convergence_debt_alert.py
  • polylogue/daemon/convergence_debt_status.py
  • polylogue/daemon/convergence_stages.py
  • polylogue/daemon/cursor_lag_alert.py
  • polylogue/daemon/cursor_lag_anomaly.py
  • polylogue/daemon/cursor_lag_baseline.py
  • polylogue/daemon/cursor_lag_status.py
  • polylogue/daemon/derivation.py
  • polylogue/daemon/embedding_backlog.py
  • polylogue/daemon/fts_status.py
  • polylogue/daemon/http.py
  • polylogue/daemon/intake.py
  • polylogue/daemon/metrics.py
  • polylogue/daemon/provenance.py
  • polylogue/daemon/similarity.py
  • polylogue/daemon/status.py
  • polylogue/daemon/uds.py
  • polylogue/daemon/webui.py
  • polylogue/daemon/write_coordinator.py
  • polylogue/daemon_client.py
  • polylogue/demo/verify.py
  • polylogue/hooks/__init__.py
  • polylogue/logging.py
  • polylogue/maintenance/archive_verification.py
  • polylogue/maintenance/blob_ref_liveness_reconciliation.py
  • polylogue/maintenance/blob_residue_comparison.py
  • polylogue/maintenance/candidate_capacity.py
  • polylogue/maintenance/declarations.py
  • polylogue/maintenance/embedding_preservation.py
  • polylogue/maintenance/parent_session_accounting.py
  • polylogue/maintenance/reasoning_conservation.py
  • polylogue/maintenance/source_conservation.py
  • polylogue/mcp/archive_support.py
  • polylogue/mcp/call_log.py
  • polylogue/mcp/declarations/registry.py
  • polylogue/mcp/payloads.py
  • polylogue/mcp/server_cutover.py
  • polylogue/mcp/server_prompts.py
  • polylogue/mcp/server_resources.py
  • polylogue/mcp/server_support.py
  • polylogue/mcp/session_projections.py
  • polylogue/operations/archive_debt.py
  • polylogue/operations/audit.py
  • polylogue/operations/daemon_execution.py
  • polylogue/operations/daemon_ingest.py
  • polylogue/operations/daemon_mutations.py
  • polylogue/operations/daemon_protocol.py
  • polylogue/operations/daemon_reads.py
  • polylogue/operations/daemon_status.py
  • polylogue/operations/daemon_workload_probe.py
  • polylogue/operations/delete_authorization.py
  • polylogue/operations/fts_derivation.py
  • polylogue/operations/intake_adapters.py
  • polylogue/operations/mutation_actuators.py
  • polylogue/operations/mutation_transaction.py
  • polylogue/operations/origin_filters.py
  • polylogue/operations/raw_authority_verdict_cache.py
  • polylogue/operations/route_observation.py
  • polylogue/operations/specs.py
  • polylogue/operations/status_workload.py
  • polylogue/pipeline/ids.py
  • polylogue/pipeline/semantic_capture.py
  • polylogue/pipeline/services/ingest_batch/_core.py
  • polylogue/pipeline/services/ingest_batch/_models.py
  • polylogue/pipeline/services/ingest_worker.py
  • polylogue/pipeline/services/process_pool.py
  • polylogue/pipeline/services/validation_flow.py
  • polylogue/readiness/__init__.py
  • polylogue/readiness/claim_guard.py
  • polylogue/rendering/blocks.py
  • polylogue/rendering/identity.py
  • polylogue/schemas/generation/archive_workload_profile.py
  • polylogue/schemas/provider_identity_audit.py
  • polylogue/schemas/providers/grok/catalog.json
  • polylogue/schemas/providers/grok/versions/v1/package.json
  • polylogue/schemas/providers/grok/versions/v2/package.json
  • polylogue/schemas/sampling_db.py
  • polylogue/schemas/source_document_identity.py
  • polylogue/security/excision.py
  • polylogue/security/excision_carriers.py
  • polylogue/security/secret_scan.py
  • polylogue/sinex/material_adapter.py
  • polylogue/sources/assembly.py
  • polylogue/sources/assembly_codex.py
  • polylogue/sources/codex_state_evidence.py
  • polylogue/sources/codex_state_projection.py
  • polylogue/sources/decoder_json.py
  • polylogue/sources/dispatch.py
  • polylogue/sources/hooks.py
  • polylogue/sources/import_explain.py
  • polylogue/sources/import_preflight.py
  • polylogue/sources/live/batch.py
  • polylogue/sources/live/batch_support.py
  • polylogue/sources/live/convergence_debt.py
  • polylogue/sources/live/convergence_debt_retry.py
  • polylogue/sources/live/cursor.py
  • polylogue/sources/live/gemini_tool_output_sidecars.py
  • polylogue/sources/live/hook_paste_enrichment.py
  • polylogue/sources/live/metrics.py
  • polylogue/sources/live/parse_prefetch.py
  • polylogue/sources/live/tool_result_sidecars.py
  • polylogue/sources/live/watcher.py
  • polylogue/sources/origin_specs.py
  • polylogue/sources/parsers/base_models.py
  • polylogue/sources/parsers/base_support.py
  • polylogue/sources/parsers/browser_capture.py
  • polylogue/sources/parsers/chatgpt.py
  • polylogue/sources/parsers/claude/code_parser.py
  • polylogue/sources/parsers/codex.py
  • polylogue/sources/parsers/codex_state.py
  • polylogue/sources/parsers/grok.py
  • polylogue/sources/parsers/hermes_identity.py
  • polylogue/sources/parsers/hermes_spans.py
  • polylogue/sources/parsers/hermes_state.py
  • polylogue/sources/parsers/hermes_verification.py
  • polylogue/sources/parsers/local_agent.py
  • polylogue/sources/providers/claude_ai.py
  • polylogue/sources/providers/claude_code_record.py
  • polylogue/sources/revision_backfill.py
  • polylogue/sources/source_acquisition_components.py
  • polylogue/sources/source_parsing.py
  • polylogue/sources/tool_outcomes.py
  • polylogue/storage/archive_identity.py
  • polylogue/storage/archive_readiness.py
  • polylogue/storage/attachment_relink.py
  • polylogue/storage/blob_gc.py
  • polylogue/storage/blob_integrity.py
  • polylogue/storage/blob_liveness.py
  • polylogue/storage/blob_publication.py
  • polylogue/storage/blob_ref_liveness.py
  • polylogue/storage/derived/derived_status.py
  • polylogue/storage/derived/feedback/__init__.py
  • polylogue/storage/derived/session/profiles.py
  • polylogue/storage/embeddings/derivation.py
  • polylogue/storage/embeddings/identity.py
  • polylogue/storage/embeddings/materialization.py
  • polylogue/storage/embeddings/preflight.py
  • polylogue/storage/embeddings/progress.py
  • polylogue/storage/embeddings/status_payload.py
  • polylogue/storage/embeddings/support.py
  • polylogue/storage/fts/derivation.py
  • polylogue/storage/fts/fts_lifecycle.py
  • polylogue/storage/hook_payload_ref_reconciliation.py
  • polylogue/storage/index_generation.py
  • polylogue/storage/ingest_byte_governance.py
  • polylogue/storage/materials.py
  • polylogue/storage/raw_authority.py
  • polylogue/storage/raw_convergence.py
  • polylogue/storage/raw_reconciler.py
  • polylogue/storage/raw_retention.py
  • polylogue/storage/repository/__init__.py
  • polylogue/storage/repository/insight/profile_reads.py
  • polylogue/storage/repository/insight/run_projection_reads.py
  • polylogue/storage/repository/insight/summary_reads.py
  • polylogue/storage/repository/insight/thread_reads.py
  • polylogue/storage/repository/insight/timeline_reads.py
  • polylogue/storage/search/runtime.py
  • polylogue/storage/session_replacement.py
  • polylogue/storage/source_sessions.py
  • polylogue/storage/sqlite/archive_tiers/archive.py
  • polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py
  • polylogue/storage/sqlite/archive_tiers/bootstrap.py
  • polylogue/storage/sqlite/archive_tiers/index.py
  • polylogue/storage/sqlite/archive_tiers/ops.py
  • polylogue/storage/sqlite/archive_tiers/ops_write.py
  • polylogue/storage/sqlite/archive_tiers/revision_governance.py
  • polylogue/storage/sqlite/archive_tiers/schema_identity.py
  • polylogue/storage/sqlite/archive_tiers/session_annotations_write.py
  • polylogue/storage/sqlite/archive_tiers/source_write.py
  • polylogue/storage/sqlite/archive_tiers/user_audit.py
  • polylogue/storage/sqlite/archive_tiers/user_overlay.py
  • polylogue/storage/sqlite/archive_tiers/user_write.py
  • polylogue/storage/sqlite/archive_tiers/write.py
  • polylogue/storage/sqlite/connection.py
  • polylogue/storage/sqlite/connection_profile.py
  • polylogue/storage/sqlite/durable_change_train.py
  • polylogue/storage/sqlite/queries/message_query_reads.py
  • polylogue/storage/sqlite/queries/raw_writes.py
  • polylogue/storage/sqlite/raw_state_update.py
  • polylogue/storage/sqlite/write_lease.py
  • polylogue/storage/usage.py
  • polylogue/surfaces/payloads.py
  • pyproject.toml
  • tests/benchmarks/cli_profile.py
  • tests/benchmarks/perf_floors.py
  • tests/benchmarks/test_cli_cold_start.py
  • tests/benchmarks/test_daemon_operation_profile.py
  • tests/infra/mcp.py
  • tests/infra/storage_records.py
  • tests/infra/workload_artifacts.py
  • tests/integration/test_facade.py
  • tests/unit/api/test_facade_contracts.py
  • tests/unit/api/test_parameter_conservation.py
  • tests/unit/archive/test_coverage_diagnostics.py
  • tests/unit/archive/test_source_freshness.py
  • tests/unit/cli/commands/test_status.py
  • tests/unit/cli/test_archive_maintenance_cli.py
  • tests/unit/cli/test_archive_query.py
  • tests/unit/cli/test_blob_ref_liveness_cli.py
  • tests/unit/cli/test_cli_output_schemas.py
  • tests/unit/cli/test_convergence_feedback.py
  • tests/unit/cli/test_diagnostics.py
  • tests/unit/cli/test_import_explain.py
  • tests/unit/cli/test_operation_kernel.py
  • tests/unit/cli/test_query_exec_laws.py
  • tests/unit/cli/test_query_lowering_property.py
  • tests/unit/cli/test_reset.py
  • tests/unit/cli/test_status.py
  • tests/unit/core/test_claim_guard.py
  • tests/unit/core/test_config.py
  • tests/unit/core/test_current_model_pricing.py
  • tests/unit/core/test_duplicate_vocabulary_collapse.py
  • tests/unit/core/test_schema_generation.py
  • tests/unit/core/test_sqlite_lock_classification.py
  • tests/unit/core/test_surface_vocabulary_ownership.py
  • tests/unit/core/test_sync_surface_runtime.py
  • tests/unit/core/test_terminal_state_totality.py
  • tests/unit/core/test_timestamp_coercion_kernel.py
  • tests/unit/cost/test_contract_suite.py
  • tests/unit/cost/test_plans.py
  • tests/unit/daemon/test_convergence_debt_alert.py
  • tests/unit/daemon/test_convergence_not_run_debt.py
  • tests/unit/daemon/test_daemon_cli.py
  • tests/unit/daemon/test_daemon_convergence.py
  • tests/unit/daemon/test_daemon_operation_route.py
  • tests/unit/daemon/test_daemon_status.py
  • tests/unit/daemon/test_derivation_kernel_laws.py
  • tests/unit/daemon/test_embedding_convergence_progress.py
  • tests/unit/daemon/test_fair_resumable_intake.py
  • tests/unit/daemon/test_health_threshold_config_accessors.py
  • tests/unit/daemon/test_http_origin_validation.py
  • tests/unit/daemon/test_http_write_coordination.py
  • tests/unit/daemon/test_metrics_endpoint.py
  • tests/unit/daemon/test_status_unmeasured.py
  • tests/unit/daemon/test_web_reader.py
  • tests/unit/daemon/test_webui_error_contract.py
  • tests/unit/devtools/_required_argument_probe.py
  • tests/unit/devtools/test_consumer_reachability.py
  • tests/unit/devtools/test_continuity_evidence.py
  • tests/unit/devtools/test_corpus_worker_memory_bound.py
  • tests/unit/devtools/test_gate_registration_argv.py
  • tests/unit/devtools/test_layering_gates.py
  • tests/unit/devtools/test_perf_floors_ratchet.py
  • tests/unit/devtools/test_pytest_invocation.py
  • tests/unit/devtools/test_pytest_slot.py
  • tests/unit/devtools/test_relative_time_assertions_are_pinned.py
  • tests/unit/devtools/test_verify.py
  • tests/unit/devtools/test_verify_runs.py
  • tests/unit/devtools/test_verify_schema_manifest.py
  • tests/unit/devtools/test_verify_webui.py
  • tests/unit/infra/test_workload_artifacts.py
  • tests/unit/insights/test_archive_rollups.py
  • tests/unit/insights/test_cost_basis_split.py
  • tests/unit/maintenance/test_archive_verification.py
  • tests/unit/maintenance/test_blob_sqlite_open_is_immutable.py
  • tests/unit/maintenance/test_candidate_capacity.py
  • tests/unit/maintenance/test_embedding_preservation.py
  • tests/unit/maintenance/test_embedding_reuse_verification.py
  • tests/unit/mcp/test_agent_surface_truncation.py
  • tests/unit/mcp/test_insight_projection_derivation.py
  • tests/unit/mcp/test_mcp_call_log.py
  • tests/unit/mcp/test_privileged_tools.py
  • tests/unit/mcp/test_resource_declaration_reconciliation.py
  • tests/unit/mcp/test_session_projection_table.py
  • tests/unit/operations/test_archive_debt.py
  • tests/unit/operations/test_daemon_status.py
  • tests/unit/operations/test_declared_operation_handlers.py
  • tests/unit/operations/test_mutation_actuators.py
  • tests/unit/operations/test_operation_audit.py
  • tests/unit/pipeline/test_parsing_service.py
  • tests/unit/pipeline/test_pipeline_ids.py
  • tests/unit/pipeline/test_tool_vocabulary_ownership.py
  • tests/unit/pipeline/test_validation_parallelism_contracts.py
  • tests/unit/rendering/test_rendering.py
  • tests/unit/schemas/test_provider_identity_audit.py
  • tests/unit/security/test_excision_carrier_reach.py
  • tests/unit/security/test_secret_scan.py
  • tests/unit/sources/parsers/test_codex_state.py
  • tests/unit/sources/parsers/test_codex_validation_error_redaction.py
  • tests/unit/sources/parsers/test_grok.py
  • tests/unit/sources/parsers/test_hermes_spans.py
  • tests/unit/sources/parsers/test_hermes_state.py
  • tests/unit/sources/parsers/test_hermes_verification.py
  • tests/unit/sources/test_assembly.py
  • tests/unit/sources/test_browser_capture.py
  • tests/unit/sources/test_claude_code_sidecar_evidence.py
  • tests/unit/sources/test_claude_code_unread_wire_fields.py
  • tests/unit/sources/test_codex_event_stream_contract.py
  • tests/unit/sources/test_codex_state_bounds_and_excision.py
  • tests/unit/sources/test_codex_state_live_ingest.py
  • tests/unit/sources/test_codex_whale_fixtures.py
  • tests/unit/sources/test_cursor_ops_write_scope.py
  • tests/unit/sources/test_cursor_rebase_atomicity.py
  • tests/unit/sources/test_dispatch_payloads.py
  • tests/unit/sources/test_gemini_cli_tool_output_losses.py
  • tests/unit/sources/test_hook_spool.py
  • tests/unit/sources/test_hook_tool_response.py
  • tests/unit/sources/test_hook_topology.py
  • tests/unit/sources/test_import_preflight.py
  • tests/unit/sources/test_live_batch_support.py
  • tests/unit/sources/test_live_metrics.py
  • tests/unit/sources/test_live_watcher_parse_stage_equivalence.py
  • tests/unit/sources/test_material_origin_role_law.py
  • tests/unit/sources/test_models.py
  • tests/unit/sources/test_origin_specs.py
  • tests/unit/sources/test_parser_admission_packet.py
  • tests/unit/sources/test_parser_contract_v1.py
  • tests/unit/sources/test_parsers_base.py
  • tests/unit/sources/test_parsers_chatgpt.py
  • tests/unit/sources/test_parsers_claude_code_artifacts.py
  • tests/unit/sources/test_parsers_codex.py
  • tests/unit/sources/test_parsers_local_agent.py
  • tests/unit/sources/test_revision_backfill.py
  • tests/unit/sources/test_silent_ingest_loss.py
  • tests/unit/sources/test_source_laws.py
  • tests/unit/sources/test_tool_result_sidecars.py
  • tests/unit/storage/test_archive_identity.py
  • tests/unit/storage/test_archive_readiness.py
  • tests/unit/storage/test_archive_tier_enumerations.py
  • tests/unit/storage/test_archive_tier_init.py
  • tests/unit/storage/test_archive_tiers_embedding_write.py
  • tests/unit/storage/test_archive_tiers_ops_write.py
  • tests/unit/storage/test_archive_tiers_write.py
  • tests/unit/storage/test_blob_gc.py
  • tests/unit/storage/test_blob_gc_durable_intent.py
  • tests/unit/storage/test_blob_gc_ref_type_liveness.py
  • tests/unit/storage/test_blob_liveness.py
  • tests/unit/storage/test_blob_ref_liveness.py
  • tests/unit/storage/test_browser_capture_origin_repair.py
  • tests/unit/storage/test_connection_profile_single_definition.py
  • tests/unit/storage/test_durable_change_train.py
  • tests/unit/storage/test_durable_migrations.py
  • tests/unit/storage/test_durable_vocabulary_invariance.py
  • tests/unit/storage/test_embedding_contracts.py
  • tests/unit/storage/test_embedding_stats.py
  • tests/unit/storage/test_fts_derivation.py
  • tests/unit/storage/test_hook_payload_ref_reconciliation.py
  • tests/unit/storage/test_index_generation.py
  • tests/unit/storage/test_introspection.py
  • tests/unit/storage/test_materials.py
  • tests/unit/storage/test_origin_usage_report.py
  • tests/unit/storage/test_raw_admission.py
  • tests/unit/storage/test_raw_retention.py
  • tests/unit/storage/test_raw_revision_authority.py
  • tests/unit/storage/test_repository_insight_runtime.py
  • tests/unit/storage/test_revision_replay.py
  • tests/unit/storage/test_schema_policy_contracts.py
  • tests/unit/storage/test_schema_safety.py
  • tests/unit/storage/test_table_existence_ownership.py
  • tests/unit/storage/test_tool_outcome.py
  • tests/unit/storage/test_topology_hook_authority_conflict.py
  • tests/unit/storage/test_write_lease.py
  • tests/unit/surfaces/test_projection_spec.py
  • tests/unit/test_read_surface_coherence.py
  • tests/unit/test_structured_logging.py
  • webui/src/api/generated.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sinity and others added 2 commits September 16, 2026 07:12
The raw-discovery held page compares the keys it owed, not their count, so a
page that gains a lexically earlier arrival is new work rather than a stalled
head. Grok replay is path-independent again because its identity is now
content-derived (polylogue-31zag supersedes 8t9bj). Metrics tolerate a
partial index without a sessions table. Tests that pinned prose log lines
capture the structured events that replaced them; tests that pinned the
per-surface page size, the fallback for a non-positive limit, the duplicate
'source' key, the refuted perf claim, and the introspection owner path
follow the integrated behaviour. The v7 migration fixture strips the
blob_hash block by pattern instead of by comment wording.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
A shrinking page is progress and a page that gained a key is an arrival;
only an identical re-inspection is a stalled head. Embedding metrics without
a sessions table count pending from the status table instead of a zero total.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
@Sinity
Sinity marked this pull request as ready for review September 16, 2026 05:22
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-16T05:34:52.168576Z 2da4406 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit d7d3dda into master Sep 16, 2026
3 checks passed
@Sinity
Sinity deleted the integ/small-batches branch September 16, 2026 05:28
Sinity added a commit that referenced this pull request Sep 20, 2026
…pproving moved evidence (#5311)

## Summary

Two beads. `polylogue-q54dt`'s grammar extension is delivered and
`/api/paste-browser` is repointed onto the declared route;
`polylogue-irtix` sub-item D refuses approving a candidate whose
evidence moved under a reused assertion id. `/api/attachments` is
**not** converted, for a reason that is not a grammar gap.

Three production files are IN the derived schema closure — **this must
land before any rebuild starts.**

## q54dt — the declared route now expresses message grain

`query_units` accepted `has_paste` but lowered it to
`sessions.paste_count > 0`, while the handler read message-grain
`msg.has_paste` because session aggregates lag direct message writes.
The predicate is now declared, and `_do_paste_browser` calls
`poly.query_units("messages where has_paste:true", limit=...,
offset=...)`.

The tests monkeypatch `Polylogue.filter` and `Polylogue.get_session` to
**raise**, so the retired shape cannot pass. AC1 (`total=None` when the
page filled, `total_is_exact`, `matched_so_far` separate) was already
satisfied at head and was verified, not rewritten.

**Anti-vacuity, executed:** reintroducing `await
poly.filter().list_summaries()` at the top of the handler turns both
tests red. The predicate fixture seeds a paste-bearing message while
`sessions.paste_count` stays 0 — asserted in the fixture — so a
session-aggregate lowering returns zero rows.

## /api/attachments is not convertible by this predicate

Stated plainly rather than left as an unexplained gap. Attachments hang
off `attachment_refs(message_id, session_id)`; `messages` carries **no**
attachment column (verified against the full column list);
`attachment_count` lives on `session_profiles` at session grain; and
there is no attachment query unit. Its `state` filter is derived at read
time from availability, not stored, so it cannot be pushed to SQL — a
message-grain approximation would break AC4's exact-once pagination
whenever `state` is set.

Closing it needs a declared attachment-grain read: either a new
`attachment` query unit (name, descriptor, payload model, row type, SQL
lowering, CLI renderer, completions, MCP registry, regenerated surfaces)
or a declared `ArchiveStore` read plus a product route. That is a
separate cohesive change, not a rushed extension of this one.

## irtix sub-item D

`AssertionEvidenceConflictError` is raised from
`_judge_assertion_candidate_in_transaction` when the evidence digest
read at capture no longer matches current. The test asserts both digests
appear in the message and that the candidate stays `CANDIDATE`. A second
test proves dedup is not reverted: two cycles over identical evidence
keep one assertion id, record no `superseded_evidence_digest`, and
accept unsighted.

**Anti-vacuity, executed:** deleting the refusal call gives `DID NOT
RAISE`.

## Corrections to the bead metadata

- **Sub-item B is already satisfied at head** — no change manufactured.
`_SQL_RECIPES_BY_HASH` and `_vector_derivation_hash_sql` resolve the
full recipe from its hash, and all six named call sites pass a full
recipe object. `git log -S` puts it in `d7d3ddae5` (#5224), together
with its AC5 anti-vacuity test, which passes. The bead's design note
still points at `identity.py:248` as the live defect; that line is now
only a tests-only `model=` fallback.
- **"D is the only sub-item outside the schema closure" is wrong in
consequence.** `raw_reconciler.py` is indeed out, but the approval
boundary is in `user_write.py`, which is **IN** — so D as implemented
moves the identity.
- Sub-item B's recorded `verification_commands` name three test paths
that do not exist at head.

## Verification

`119 passed` on the focused selection after rebase onto `f7bc76213`;
`775 passed, 1 skipped` on the broad query-surface sweep for the new
grammar field. `devtools verify --quick` all **23** gates ok. `render
all --check` exit 0, zero `out of sync`.

One inherited failure reproduced red on a clean worktree at the original
base and now **passes** after rebasing — one of #5302/#5308/#5309 fixed
it. Not mine in either direction.

## Behaviour change to confirm

`daemon/judgment_automation.py` builds its bulk envelope without
`expected_evidence_digest`, so an automated approval of a candidate
whose evidence moved will now fail that item with the typed conflict.
That is the correct default — automation approving unread evidence is
the exact risk — but it is a live change someone should confirm rather
than discover.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 21, 2026
## Summary

Nine commits closing harness-honesty gaps: a gate that blamed the code
for an
unprovisioned environment, a verify receipt that proved nothing about
which tree
it tested, a scheduled run whose killer was discarded, and two inherited
reds
answered rather than re-recorded.

## Problem

- **`gate layering` blamed the code for a pruned environment.** Without
the audit
group, `grimp` is absent and the gate emitted findings-shaped output,
sending
readers to investigate code that was never inspected.
`verify_patterns.py`
carried the same trap in its remediation string: `uv sync --group audit`
  prunes the dev extra and lands you in a *second* broken checkout.
- **A verify receipt was not bound to a tree.**
`[operations.verify_all]`
declared `checkout = "default"`, which does not select a tree —
`projects.py`
validates against `{"any","default"}` and `launch.py` refuses any
workspace
other than `project.root` — so the corpus run executed on the operator's
  working branch and its receipt could be read as candidate evidence.
- **A killed run reported an undifferentiated abandonment.**
`_adopt_outcome`
kept only AgentCTL's coarse bucket, in which an OOM kill and an ordinary
  non-zero exit are both "failed", discarding the `systemd_result` the
`.outcome` file already held — so `devtools why` sent readers to
`journalctl`
  for a fact the receipt contained.
- Two reds on master were unattributed: three `test_cli_acceptance.py`
reflow
baselines, and `grok-export` reporting `partial (schema_package is
missing)`.

## Solution

`audit_checker_unavailable()` probes before any import is read, so a
refusal
cannot emit a partial finding list. Exit **3**
(`ENVIRONMENT_REFUSAL_EXIT`) is
distinct from the 1 that means a violation, with a new
`gate_missing_analysis_dependency` diagnosis. `AUDIT_GROUP_SYNC_COMMAND`
is one
shared constant naming the whole correct command, fixing both sites.

`verify_receipt_check.py` gains `candidate_tree_refusal()` and
`--candidate`,
with four refusals each naming both SHAs — including *no tested SHA
recorded*,
so the field cannot be removed to opt out. The tree check runs
**before** the
test-evidence check, so a flawless green run on another tree does not
read as
evidence. CI passes `--candidate ${{ github.sha }}`.

The reflow raise was **attributed, not guessed**: a detached worktree at
44c5f86 (#5191, which recorded the baselines) reproduced the gallery,
and the
diff shows 100% of the raise is f8a63f0 (#5249). The arithmetic closes
exactly
(156+3=159, 100+1=101, 9+1=10, 54+1=55, 2+1=3). The help text does not
reflow at
all, so "narrowing" would mean deleting words — recorded with its reason
beside
the table.

`grok-export` is answered by refutation: `schemas/providers/grok` was
deleted by
d7d3dda (#5224) because its element schemas carried
`$id polylogue://schemas/claude-ai/v2/session_document` — verified by
decompressing the deleted bytes, which are Claude.ai's shape. A
withdrawn
package is correct, so `partial` is **truthful**.

## Verification

- `devtools verify --quick` — all 23 gates, 23,547 collected
- `devtools test` over 13 devtools modules — **287 selected, 287
passed**,
  `terminal_green true`, `git_dirty false`
- Red reproduced *before* fixing: 4 failed / 21 passed at f6f899c; 27
passed after
- `devtools render all --check` — exit 0, `grep -c 'out of sync'` = 0
- `devtools schema closure` on **all 25 changed files — every one
reports `out`.**
  No commit here moves the derived identity.

## Residuals

- **`016xl` criterion 1 is further away than when filed**: 581.3 MiB
over 23,547
tests against a 430 MiB target, up from 533 MiB over 20,681. Per-item
cost is
flat; the total tracked corpus growth. Neither named lever pays — a
one-file
selection collects in 1.9 s / 112 MiB, and `-X importtime` shows 1.20 s
of
  2.68 s is `readline` via pytest's own pdb. Re-measure with the new
  `devtools bench collection --budget-mib 430`.
- **A 4.6% admission margin.** `charge_mib(3)` is 11,725 MiB against a
12,288 MiB
`memory.high` — exactly the condition the 2026-09-17 run stalled in. The
corrected charge model fills a ceiling whose 1.2x safety margin was
computed
under the superseded anonymous-RSS model. `WORKER_PEAK_CACHE_MIB =
2,850` is
~80% of a worker's charge, driven by 47-55 GB of scratch SQLite writes.
- `p2mbi` AC4 and `k1o3t` AC4 are **not satisfiable in this
repository**:
agentctl's operation vocabulary has no key naming a candidate tree and
no
memory/admission key. Recorded rather than faked; both need a sinnix
change.
- `origin_specs.py:3210` still declares `schema_paths` to a path #5224
deleted.
Not fixed here — that file is **IN** the derived closure, so correcting
it
  forces a reconvergence and belongs at the rebuild boundary.
- The larger inherited storage/schema red cluster is untouched and
outside this
packet; one owner should confirm #5290 is the single cause before anyone
fixes
  it test-by-test.

Advances polylogue-mkucv, 1khzy, p2mbi, yk0zz, 016xl, 62j1f, k1o3t.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 21, 2026
…5367)

## Summary

Clears four inherited-red defects that every lane has had to prove "not
mine".
**14 failed / 408 passed → 0 failed / 419 passed**, proven at the rebase
base by
reverting all eight changed files in place rather than inferred from
bead text.

Two were product defects, two were stale tests. **No test was relaxed to
make it
green.**

## polylogue-w4hfb — product defect, and the tempting fix is provably
wrong

`analysis/orchestration_evidence.py` built `positive_tokens` with
`if (value := getattr(message, key)) > 0` over four lanes that became
`int | None = None` in #5300. Guarded rather than coerced: `positive` is
`value is not None and value > 0`, and `value is None` gets its **own
bucket**
plus a `message_token_lanes_unmeasured` gap token. **A measured 0 is
excluded from
the unmeasured bucket, because it is a measurement.**

The forbidden fix was executed to prove it is caught: `getattr(message,
key) or 0`
leaves 6 of 7 green and reddens exactly the distinction test —
`assert usage['messages_with_unmeasured_token_lanes'] == 1` → `assert 0
== 1`.

Sibling sweep found no other consumer applying an ordering operator to
these four
columns: `cost_compute.py` tests `is not None`, `material_adapter.py`
guards the
same way, `pricing.py` orders a coerced payload carrying a separate
`unmeasured_lanes` tuple, and storage readers use `IS NOT
NULL`/`COALESCE`.

## polylogue-njcms — the test's intent survives the census-ledger
retirement

**Ruling**: the retired frontier census row carried **two separable
questions** —
*"is there unresolved frontier debt?"*, which durable blocker rows now
answer
directly and which was correctly retired, and *"was this domain measured
at all?"*,
which nothing answered afterwards. **Retiring the ledger retired the
row, not the
second question.**

The defect is in the product, not a revert. `raw_materialization_ready`
returns
True when all twelve blocking counters are zero — so **on an archive
with zero raw
artifacts every counter is trivially zero and the projection certifies
convergence
off an inspection that examined no rows.** Probed live on the fixture:
`classification='not_run'`, `raw_artifact_count=0`, yet
`claim_guard.converged = {value: true, determinate: true, reason:
'ready'}`.

The successor precondition is **a zero denominator** — exactly the shape
`search_unmeasured_reason` already refuses for FTS coverage (*"fts
coverage is
undefined at a zero denominator, not complete"*). Unlike the old
census-row
condition, which a code comment says *"marked every production archive
permanently
indeterminate"*, this leaves every populated archive determinate. Only
an explicit
integer zero is classified; an **absent** count keeps its own verdict,
so a real
refutation is never masked into "unknown" — a mutation widening it to
`if not raw_artifact_count:` reddens that assertion.

Routed through `readiness/claim_guard.py` (closure **out**);
`readiness/capability.py`
(closure **IN**) untouched. Both status producers already share the one
function.

**The collateral was repaired, not accommodated.** Nine daemon-status
tests asserted
`converged=True` on a mocked empty archive. Their subject is debt-ledger
*isolation*
from the convergence claim — their helper is literally named
`_complete_raw_materialization_readiness` ("the complete source evidence
required to
isolate claim signals") while supplying only `available=True` and a
census stub. The
helper was made **actually complete**, preserving their subject exactly.

## polylogue-2i96t — both causes were the test

**`input_tokens`**: `MessageRenderEnvelope` is generated from the
canonical `Message`
model, so its lanes are `int | None` with default `None` — verified at
runtime, and
`models.py:61-70` states the ruling: defaulting to 0 on a public output
model
*"reintroduced, on the public output model, exactly the false
measured-zero the
storage/read path stopped writing."* The assertions pinned the pre-#5300
default.
Repaired to pin `None` for an omitted lane **and** `0` for an explicitly
measured
one — including on the wire, where unmeasured drops under `exclude_none`
and a
measured zero does not.

**`total_unit`**: the field is legitimate and the roster was stale.
Established by
`git log -S`: it entered in #5224 for polylogue-1c6j precisely so the
emitted
document could satisfy the published `additionalProperties: false`
schema, and that
PR regenerated the OpenAPI and CLI-output schemas without touching this
test.

The roster was **extended, not derived** — deliberately: a field-set
contract is
meant to force a human decision when the envelope grows. **That is its
anti-vacuity property**, unlike `pxzms` below where the roster mirrored
a derived
fact.

## polylogue-pxzms — derived, plus a stronger property

Confirmed: `write_coordinator.py` measures `out` and is absent from the
baseline, so
the hand-written roster was the stale side. Three property tests replace
two
parametrized rosters and a pinned directional test — including one that
proves the
**anti-prefix** property over **all 1296 files** under `polylogue/`
rather than one
hand-picked sibling pair (57 directories currently hold members beside
non-members),
and one deriving real members and real non-members and requiring the
command's JSON
verdict to equal the library predicate **in both directions**.

**Both anti-vacuity directions executed.** Stubbing the command to
report `True` for
everything reddens it; stubbing `False` reddens it. And the
must-**not**-redden
direction was measured too: a real closure change **555 → 933** that
pulled
`write_coordinator.py` back IN left all three replacement tests
**green** — the exact
class of change that broke the old roster. (The two tests that did
redden are the
ones that should: the baseline ratchet and CLI identity-neutrality.)

One rejected mutation is reported for honesty: emptying
`_REPLAY_ROUTING_FINGERPRINT_PATHS` did **not** change the closure — the
graph is too
connected for any single entry-path removal to matter — so the
import-edge mutation
was used instead.

## Verification

`devtools verify --quick` **exit 0** (26 gates) · `render all --check`
exit 0,
zero `out of sync` · focused 9-file selection **419/419 passed**,
`git_dirty false`
· the same selection with all eight files reverted in place → **14
failed**.

**Closure: all eight touched files `out`; the identity does not move** —
proven by
computing `derived_schema_identity` with both production files replaced
by their
base content (index and ops identical). **This branch can land during a
rebuild.**

Both candidate fix sites that are closure **IN** —
`surfaces/payloads.py` for
`2i96t` and `readiness/capability.py` for `njcms` — were left untouched,
because in
each case the defect was on the other side.

## Residuals

- **`raw_materialization_ready()` still returns True at a zero
denominator.** Only
the *claim* layer was fixed, because `storage/archive_readiness.py` is
closure **IN**
and `claim_guard.py` exists precisely so claim classification stays
outside it.
Non-claim consumers (`convergence_feedback.py:31`,
`commands/paths.py:76`,
`readiness/__init__.py:97`, `daemon/status.py:3067`) still read a
pristine archive
as materialization-ready. That is a rebuild-boundary edit, deliberately
not taken.
- `orchestration_evidence.py:311` still appends a
`message_usage_missing_and_zero_indistinguishable` gap whenever
`message_tokens` is
non-empty. Now that the lanes are nullable end to end and this
projection separates
them, that claim is **stale prose** — it over-reports uncertainty rather
than
over-claiming measurement, so it is safe, but it should be re-derived by
whoever
  owns that vocabulary.
- Still red and **not** cleared here, proven inherited:
`test_runtime_operations_are_well_formed` on the missing
`explicit_dry_run_evidence`
  guard.
- Evidence boundary: focused selections plus the static quick gate, not
an affected or
  full corpus run.

The shared known-red file was updated — four rows removed, with the 14 →
0
measurement and the per-defect ruling recorded in their place.

Closes polylogue-w4hfb, polylogue-njcms, polylogue-2i96t,
polylogue-pxzms.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 22, 2026
polylogue-ol2fc. A real `polylogued run` started, bound its API and watched
its sources, then ingested nothing: every intake page was refused with
`daemon.intake.page_refused ... reason=page_admission_failed` and the
`UnleasedWriteError` behind it, so the archive stayed empty forever.

Four sites on the daemon's own ingest path opened a write-mode archive
connection without holding the lease, or bound to the wrong archive root.
With the single-writer boundary armed -- which is exactly the state the
daemon runs in, and only the daemon -- each one aborts the whole page:

- `CursorStore.get_records` and six sibling SELECT-only ops readers went
  through `_connect_ops`, a write-mode open. `get_records` runs during batch
  planning on the event loop, outside the per-publication `_run_sync` hold
  that owns the lease. New `_connect_ops_read` reuses a held
  `ops_write_scope` connection and otherwise opens read-only.
- `LiveBatchProcessor` called its event emitter inline. The daemon's emitter
  appends to the ops-tier event ledger, so it is an ops publication and now
  takes the writer through `_run_sync` like every other one.
- `_drain_convergence_debt_once` constructed `CursorStore(db)`, whose
  bootstrap and interrupted-attempt rewrite are writes; it now passes
  `initialize=False` and leaves its ledger writes to `admit_stage_write`.
- `ArchiveStore._ensure_source_conn` bound the durable `source.db` open to
  the candidate directory. Under a cold-build generation that file is a
  read-through symlink to the declared archive's own tier, so the binding is
  `_write_lease_archive_root` -- the root the index-tier open already uses.

Verification: a synthetic archive with three 50-message claude-code JSONL
sessions, driven through the real `polylogued run` binary.
  base 0df0f6a: `TIMEOUT last=0`, 81 UnleasedWriteError lines
  head:           `OK messages=50 after 28.6s`, 0 UnleasedWriteError lines
The regression window opens at #5224 (2026-09-16): the same driver reports
`OK messages=50` at 342cf9e and `TIMEOUT last=0` from d7d3dda onward.

Anti-vacuity, executed: each of the four production edits was reverted and
the matching test in `tests/unit/daemon/test_daemon_ops_lease_boundary.py`
went red with the production failure text, e.g. `UnleasedWriteError:
open_connection(.../ops.db) requires the daemon write lease` and
`open_source_tier_write_connection(.../gen-.../source.db) is outside the
archive bound to writer test.cold_build`. The opposite direction is pinned
by `test_ops_tier_writes_still_require_the_write_lease`, which fails if
ops.db is made lease-free wholesale.

Schema closure: `batch.py`, `cursor.py` and `archive.py` are IN;
`daemon/cli.py` and the new test are out. Derived INDEX identity moves
8a971a5382afa46b0b08cfc35c98ab47a375802e3008f2ec883fe5b5c1267aa6 ->
abb040dad955a69ff876586e76e7557e1cba89a1cb53b1350903759804707003; OPS is
unchanged at 868662352a182527e6a561a0f7746a603cf2df17f3efda2da8190e6f1785104a.
No DDL, lowering or materializer semantics change -- this is a closure move
on ordinary code, and it must land before a fresh rebuild starts.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Sinity added a commit that referenced this pull request Sep 22, 2026
polylogue-ol2fc. A real `polylogued run` started, bound its API and watched
its sources, then ingested nothing: every intake page was refused with
`daemon.intake.page_refused ... reason=page_admission_failed` and the
`UnleasedWriteError` behind it, so the archive stayed empty forever.

Four sites on the daemon's own ingest path opened a write-mode archive
connection without holding the lease, or bound to the wrong archive root.
With the single-writer boundary armed -- which is exactly the state the
daemon runs in, and only the daemon -- each one aborts the whole page:

- `CursorStore.get_records` and six sibling SELECT-only ops readers went
  through `_connect_ops`, a write-mode open. `get_records` runs during batch
  planning on the event loop, outside the per-publication `_run_sync` hold
  that owns the lease. New `_connect_ops_read` reuses a held
  `ops_write_scope` connection and otherwise opens read-only.
- `LiveBatchProcessor` called its event emitter inline. The daemon's emitter
  appends to the ops-tier event ledger, so it is an ops publication and now
  takes the writer through `_run_sync` like every other one.
- `_drain_convergence_debt_once` constructed `CursorStore(db)`, whose
  bootstrap and interrupted-attempt rewrite are writes; it now passes
  `initialize=False` and leaves its ledger writes to `admit_stage_write`.
- `ArchiveStore._ensure_source_conn` bound the durable `source.db` open to
  the candidate directory. Under a cold-build generation that file is a
  read-through symlink to the declared archive's own tier, so the binding is
  `_write_lease_archive_root` -- the root the index-tier open already uses.

Verification: a synthetic archive with three 50-message claude-code JSONL
sessions, driven through the real `polylogued run` binary.
  base 0df0f6a: `TIMEOUT last=0`, 81 UnleasedWriteError lines
  head:           `OK messages=50 after 28.6s`, 0 UnleasedWriteError lines
The regression window opens at #5224 (2026-09-16): the same driver reports
`OK messages=50` at 342cf9e and `TIMEOUT last=0` from d7d3dda onward.

Anti-vacuity, executed: each of the four production edits was reverted and
the matching test in `tests/unit/daemon/test_daemon_ops_lease_boundary.py`
went red with the production failure text, e.g. `UnleasedWriteError:
open_connection(.../ops.db) requires the daemon write lease` and
`open_source_tier_write_connection(.../gen-.../source.db) is outside the
archive bound to writer test.cold_build`. The opposite direction is pinned
by `test_ops_tier_writes_still_require_the_write_lease`, which fails if
ops.db is made lease-free wholesale.

Schema closure: `batch.py`, `cursor.py` and `archive.py` are IN;
`daemon/cli.py` and the new test are out. Derived INDEX identity moves
8a971a5382afa46b0b08cfc35c98ab47a375802e3008f2ec883fe5b5c1267aa6 ->
abb040dad955a69ff876586e76e7557e1cba89a1cb53b1350903759804707003; OPS is
unchanged at 868662352a182527e6a561a0f7746a603cf2df17f3efda2da8190e6f1785104a.
No DDL, lowering or materializer semantics change -- this is a closure move
on ordinary code, and it must land before a fresh rebuild starts.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Sinity added a commit that referenced this pull request Sep 22, 2026
…5409)

## Summary

A real `polylogued run` ingests nothing. Four sites on its own ingest
path open a write-mode archive connection with no lease held — or bound
to the wrong archive root — and the armed single-writer boundary raises
`UnleasedWriteError`, which refuses the whole intake page. Live ingest
has been broken since 2026-09-16.

## Problem

This was filed as a cluster of 16 failing tests with two candidate
explanations. **Both are refuted**, and the defect is production-only.

- *"Startup never converges"* — no. `daemon.started` fires, the watcher
binds all 16 source roots, the API answers, and per-publication ops
writes succeed under their own lease in the same log.
- *"A writer lease is never released"* — no. Every
`daemon.writer.released … status=success` line shows holds of 1–800 ms.
The defect is a lease never **taken**.

Reproduced outside pytest with the installed `polylogued` console script
against a synthetic 3-session corpus — no fixture, no harness. The line
that decides the diagnosis, from the real daemon's stderr at base:

```
daemon.intake.page_refused ... error_detail=open_connection(<root>/ops.db) requires the daemon
write lease; open it inside write_lease(...) ... error_type=UnleasedWriteError files=3
outcome=degraded reason=page_admission_failed
```

Bisected on the real binary: `OK messages=50` at `342cf9e20` (#5221),
`TIMEOUT last=0` at `1c1895098` (#5263) and every later point. The
window opens at `d7d3ddae5` (#5224, 2026-09-16), which added
`require_write_lease` to `CursorStore.ops_write_scope`; #5265 moved the
raise site to `get_records` but did not introduce it.

**#5382 is not the cause**, despite the differential that pointed there:
the cluster was already failing in the 09-21 corpus run, and #5382
landed 09-22 02:54 UTC.

The four sites, each proven by stack capture at the raise:

| Site | Route |
|---|---|
| `sources/live/batch.py:963` | `get_records` → `_connect_ops` →
`open_connection(ops.db)` on the event loop |
| `daemon/cli.py` | `_drain_convergence_debt_once` → `CursorStore(db)` →
`initialize_archive_database(ops.db)` |
| `sources/live/batch.py:1515` | inline `self._event_emitter(...)` →
`open_daemon_connection(ops.db)` |
| `archive.py:1435` | `_ensure_source_conn` bound to the candidate
generation dir, not the declared root |

## Verification

Production route, the real binary, no pytest:

| | base `0df0f6a00` | head |
|---|---|---|
| result | `TIMEOUT last=0` | **`OK messages=50`** |
| `UnleasedWriteError` lines | 81 | **0** |
| `convergence_debt.pass.error` | present | **0** |

Re-run after rebasing onto current master `17566b048`: **`OK messages=50
after 27.3s`, 0 unleased errors** — the fix holds on the current tree,
not only on the base it was written against.

- `devtools verify --quick` → **21/25 gates green at time of writing,
with the single failure being `gate atlas`, which is already red on
master** (`docs/atlas/daemon.md`, hook-carrier anchor). Reproduced in a
clean detached worktree at `17566b048` carrying none of these changes.
PR #5408 fixes it.
- `devtools render all --check` → exit 0, `grep -c 'out of sync'` =
**0**.
- `devtools test` over `test_daemon_resilience.py`,
`test_schema_preflight.py`, `test_daemon_ops_lease_boundary.py`,
`test_daemon_operation_route.py`, `test_inferred_corpus_loop.py` →
**exit 0, 72 selected, 72 passed**. No timeout, mark or wait bound was
changed anywhere, so the resilience tests reach their own
`_wait_for_messages` assertions with real nonzero counts.
- `test_daemon_cli.py` at head: 106/112. At base: 100/107. Delta is one
test **fixed**; the remaining 6 are byte-identical inherited red.
Baseline established by detaching at the base SHA and running the same
selection.

### Anti-vacuity, executed

Four production reverts, one at a time, each restored:

- revert `_connect_ops_read` → `UnleasedWriteError:
open_connection(…/ops.db) requires the daemon write lease`, from two
independent tests
- revert the `_run_sync` wrapper on the batch emitter →
`UnleasedWriteError: live batch event ledger requires the daemon write
lease`
- revert `admit_stage_write` on the `CursorStore` construction →
`UnleasedWriteError: open_connection(…/ops.db)`
- revert `_ensure_source_conn` to `archive_root=self.archive_root` →
`UnleasedWriteError:
open_source_tier_write_connection(…/gen-1790055341112-6db616a2/source.db)
is outside the archive bound to writer test.cold_build`

Opposite direction pinned:
`test_ops_tier_writes_still_require_the_write_lease` fails if `ops.db`
is made lease-free wholesale.

## The cluster was three causes, not one

- **12 of 16** are the production defect above.
- **2** are a stale test contract: they assert
`assert_scopes_balanced(at_least=N)` on the degraded short-circuit path,
but #5265 retired the one-scope-per-batch contract and #5388 put the
scope inside each admitted publication. A degraded batch returns
synthetic skip metrics before `begin_ingest_attempt`, so it correctly
performs zero ops writes and can never satisfy `at_least>=1`. Retargeted
to `assert_no_ops_bookkeeping`.
- **1** is a harness more restrictive than production — a phantom.
`test_fresh_runtime_prepares_tier_journals…` died in its own `seed`:
`SessionBuilder.save` writes through the thread-local cache in
`storage/sqlite/connection.py`, whose `index.db` connection ATTACHes the
sibling durable tiers and is never closed, so `PRAGMA
journal_mode=DELETE` on `source.db` hit the seeding thread's own lock.
Isolated proof: `source LOCKED database is locked` / `user ok` / `audit
ok`. A fresh `polylogued` process has no such cached connection, so
**production cannot exhibit this one at all**.
- **1 more** was fixed by #5388 landing on master during the lane; it
passes at base untouched.

The harness was **under**-reporting, never over-reporting, for the real
cause.

## Still red, handed back

The 4
`test_daemon_watcher_hints_wake_fair_intake_and_canonical_derivation`
params are a **fourth, distinct cause** that only became visible once
the daemon started ingesting. They are no longer `CancelledError`; the
fix carries them past ingest (`ingested_session_count=1`) into
`test_daemon_cli.py:2747`, where `sum(report.done == 1 …) ==
expected_versions` sees `[(…, 0), (…, 2)]` — the canonical derivation
kernel reported done=0 then done=2 instead of one per version. That is a
derivation-batching question and needs its own bead. Confirmed
inherited-red at base by the same nodeids.

Two further inherited reds, failing identically at base and head:
`test_raw_observation_publication_holds_writer_lease_through_replay`
(`AttributeError: 'FakeArchive' object has no attribute 'archive_root'`
— a test double that never gained an attribute production now reads) and
`test_run_daemon_services_parks_operation_recovery_on_audit_schema_mismatch`.

The 2 `test_inferred_corpus_loop.py` property tests pass at head, but
**no code cause was established** for their corpus-run timeouts and they
do not arm the write lease. The honest reading is host-load starvation,
not a fix — do not credit them here.

## Behaviour change worth a reviewer's eye

The 7 SELECT-only `CursorStore` readers now open read-only when no
`ops_write_scope` connection is held. On a fresh archive with no
`ops.db` they raise `sqlite3.OperationalError: unable to open database
file` instead of silently bootstrapping it through a write-mode open.
The daemon bootstraps the archive root before any of these run, and
`cli.py:1584` already documents this exact `initialize=False` read-probe
pattern — its `get_record` call was a fifth latent `UnleasedWriteError`
site that this change also removes — so the typed failure is judged
correct rather than adding an unexercised guard.

## Schema closure

IN: `sources/live/batch.py`, `sources/live/cursor.py`,
`archive_tiers/archive.py`. out: `daemon/cli.py` and all three test
files.

- `DerivedTier.index`: `8a971a53…` (base, measured in a detached
worktree) → `abb040da…`
- `DerivedTier.ops`: unchanged

A closure move on ordinary code — no DDL, no lowering or materializer
semantics, no durable migration. Needs reconvergence, and **must land
before a fresh rebuild starts, never during one**. Re-measure at merge;
other lanes are moving this value concurrently.

## Follow-ups, same defect class, left unlanded

- `archive.py:5599` `ArchiveStore.delete_sessions` still binds
`require_write_lease(archive_root=self.archive_root)` instead of
`_write_lease_archive_root`, so a delete on a generation-rooted store
fails exactly as `_ensure_source_conn` did.
- `daemon/cli.py:487`
`_mark_interrupted_live_ingest_attempts_on_shutdown` constructs
`CursorStore(initialize=True)` on the shutdown path — an unleased ops
write. Currently unreached because signal termination logs
`daemon.shutdown.ingest_recovery_deferred`, but a non-signal graceful
stop would hit it.

Neither was fixed because neither could be exercised.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant