Skip to content

fix: Codex review debt: surfaces (51 findings) - #5727

Merged
Sinity merged 54 commits into
masterfrom
batch/polylogue-20260928-013602-d600a2b8/integration
Sep 28, 2026
Merged

Sinity merged 54 commits into
masterfrom
batch/polylogue-20260928-013602-d600a2b8/integration

Conversation

@Sinity

@Sinity Sinity commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Batch polylogue-20260928-013602-d600a2b8 on base 75eb023e9973.

polylogue-1tyq5.37 Codex review debt: surfaces (51 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.20 Codex review debt: harness devtools findings (35 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.14 Codex review debt: devtools workload receipts (15 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.19 Codex review debt: gate ratchet (2 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.13 Codex review debt: devshell (3 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.24 Codex review debt: layering (1 finding)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.32 Codex review debt: runtime packaging (4 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.15 Codex review debt: embeddings (20 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.18 Codex review debt: fts (2 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.1 Codex review debt: blob store durability (1 finding)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.33 Codex review debt: schema identity (14 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.34 Codex review debt: schema inference and audit (14 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.9 Codex review debt: daemon convergence (14 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.10 Codex review debt: daemon operation runtime (7 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.11 Codex review debt: design follow-ups (4 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.5 Codex review debt: cold-build lifecycle (15 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.4 Codex review debt: cold-build capacity (7 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.7 Codex review debt: conservation census (5 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.23 Codex review debt: intake membership arbitration (13 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.28 Codex review debt: raw authority (7 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.22 Codex review debt: ingest integrity (1 finding)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.26 Codex review debt: materials and attachments (3 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.31 Codex review debt: rendition-keyed asset model (1 finding)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.2 Codex review debt: browser capture (8 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.3 Codex review debt: capture-job retention (6 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.21 Codex review debt: hooks (9 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.17 Codex review debt: extension findings (2 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.16 Codex review debt: excision (8 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.12 Codex review debt: destructive operations (5 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.36 Codex review debt: single-writer residue (4 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.25 Codex review debt: lease root binding (8 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.29 Codex review debt: read authority (5 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.30 Codex review debt: read cancellation and bounds (10 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.35 Codex review debt: search lanes (7 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.38 Codex review debt: topology snapshot (4 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.6 Codex review debt: compaction surface (8 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

polylogue-1tyq5.8 Codex review debt: cost (4 findings)

  • Every finding listed in the description has a disposition row in the worker result (fixed / fixed-later / obsolete / invalid, each with its commit or evidence); every still-real defect is fixed with a

Disposition: F038 fixed by derived identity validation; F169 fixed with SQL paging for large evidence rows; F286 fixed with conflict-aware readiness; F298 fixed by checking the embeddings attachment; F338 fixed by invalidating tag-dependent search cache. F176 and F285 were fixed earlier by c3844fb and a65dca5; F692 was fixed earlier by 735f52f. Remaining findings in the dispatch require follow-up.
Finding | disposition\nF034 | fixed: refresh and retry typed credential rejections in shared web requests; regression test covers cached-expiry recovery.\nF101 | fixed: bootstrap before generated search continuation requests.
Fix startup audit retry and marker progress, unique shared metric declarations, stale latency version checks, usage input classification, and legacy 404 / typed 5xx operation handling. Other assigned findings remain either already resolved at the base or require separate work, as recorded in the worker result.
Findings: F497/F498/F840/F843 remain unresolved pending storage-backed snapshot lineage and an executable compact terminal; F841/F842/F844 fixed in the compaction refs, lineage direction, and serialized budget; F845 tests name anti-vacuity conditions. F786 was fixed later by 9ef655c; F815/F823/F830 fixed in cost precedence, billable completeness, and domain payload omission.
Fixed: F049/F054/F464 calibrate against source evidence, include prospective source rows, and charge the candidate baseline copy. F853/F854 accept conserved supersets and reclassified lineage events. F023/F762 remove partial rollback proofs and pin failed-generation cleanup. F487 restores planner statistics before publication.

Existing code evidence: F003/F008 reuse unretained source deltas; F010 recovers pointer-swapped promotions; F011 watches archive-root mode; F012/F014 preserve retryable baseline read faults; F017 restores predecessor sidecars; F021 watches candidate filesystem availability; F067 resolves repaired root-walk faults; F226 samples evidence at observation time; F337/F358 classify excluded edges and missing durable parents; F465 measures the generation destination.

Unresolved: F048, F050, F071, F116, F328, F864 require additional implementation and regression coverage.
Fix current browser capture identity, selection-target, receiver-link,
retention declaration, producer-deadline, receipt-size, and snapshot-recovery
defects. Finding dispositions:

| Finding | Disposition |
| --- | --- |
| F493 | fixed (this commit; browser_capture.py and test_browser_capture.py) |
| F646 | fixed (this commit; browser_capture.py and test_attachment_direction.py) |
| F697 | fixed-later (75eb023; server.py resolves the default archive root) |
| F710 | fixed (this commit; server.py and facade_writers.py) |
| F796 | fixed-later (75eb023; receiver.py acknowledges identities from existing) |
| F846 | fixed-later (75eb023; pyproject script and native_host absolute path) |
| F847 | fixed-later (75eb023; manifest permission and sendNativeMessage call) |
| F888 | fixed-later (75eb023; receiver.py ignores captured_at for freshness) |
| F696 | fixed (this commit; runtime.js links to /s/ on web port 8766) |
| F708 | fixed (this commit; runtime.js retains identities by message_ref) |
| F139 | fixed (this commit; hook producers bypass the compaction lock) |
| F141 | fixed (this commit; hook receipt stores streamed count/hash summaries) |
| F675 | fixed (this commit; source_snapshot.py restores a handoff without destination) |
| F683 | fixed-later (75eb023; hook_event_authority.py pins a read transaction) |
| F684 | fixed-later (75eb023; hook_event_authority.py counts every matching ref) |
| F781 | obsolete (75eb023 removed the old per-file drain; current input is append-only carriers) |
| F890 | obsolete (75eb023 removed Codex state snapshot event writer) |
| F891 | obsolete (75eb023 removed Codex state snapshot event writer) |
| F892 | fixed-later (75eb023; watcher.py consumes hook_spool_sources topology) |
| F630 | fixed-later (75eb023; checkpoint recalculates timeline retention) |
| F631 | fixed (this commit; capture_jobs.py persists retention_declared) |
| F633 | fixed-later (75eb023; list_orphans invokes gc) |
| F634 | fixed-later (75eb023; terminal retry states transition retention) |
| F635 | fixed-later (75eb023; checkpoint writes conversation timeline events) |
| F735 | fixed-later (75eb023; capture_jobs.py caps event bytes and per-job count) |
F497 resolves source compaction snapshots from the archive query relation without reconstructing missing session events. F498 includes the inherited parent prefix through its stored lineage branch point when compiling compaction evidence. F840 and F843 remain unresolved.
Finding | disposition\nF104 | fixed: cursor-bearing reads bypass the offset-only archive fast path; the regression test fails if the cursor is ignored.
Fix F257 by retaining named fields after high-cardinality promotion; F468/F620 by checking derived identity on tier opens before use or materialization; F158/F944 by auditing profile tokens and standard literal keywords. Add anti-vacuity regressions for F257 and F944. Other findings were checked against this head and are already addressed or invalid against current consumers.
Disposition summary (finding -> disposition/evidence):
| Finding | Disposition |
| --- | --- |
| F125 | fixed (this commit) |
| F251 | fixed-later (21c315c; non-browser guard rejects DOM arbitration) |
| F252 | fixed (this commit) |
| F253 | fixed (this commit) |
| F262 | fixed-later (8b16cd0; non-container receipt path) |
| F353 | fixed (this commit) |
| F383 | fixed (this commit; acquired_at_ms ordering) |
| F488 | unresolved (projection refresh still does not rederive session links) |
| F489 | fixed-later (79e041f; pre-export fingerprint keeps racing WAL changes dirty) |
| F606 | fixed (this commit) |
| F858 | unresolved (source generation/item entrypoints remain unwired to live acquisition) |
| F859 | unresolved (transition remembers only the latest request_id) |
| F861 | fixed-later (1d901ec; caller-owned transaction mode) |
| F217 | fixed (this commit) |
| F605 | fixed-later (735f52f; declared Content-Length validation) |
| F672 | fixed (this commit) |
| F674 | unresolved (attachment payload bytes are still not published to the blob store) |
| F206 | fixed (this commit; removed acknowledgement-chain cap) |
| F242 | fixed (this commit; shared blocker reopening path) |
| F293 | obsolete (e20f6f5 removed reject_stale_raw_replay_plan) |
| F301 | fixed-later (9238939; publication rechecks frontier blockers under lease) |
| F302 | obsolete (fresh-v1 archives have no prior unreceipted retained-state rows; live acquisition records terminal evidence) |
| F326 | fixed-later (75b9e36; compute re-inspects component status before parsing) |
| F450 | fixed-later (6be5d2f; CLI resolution routes through daemon) |
| F492 | fixed (this commit; physical renditions sharing a provider id retain separate keys) |

Focused verification: five declared selectors were queued through AgentCTL but had not started at commit time because pytest-quick was saturated. Static checks passed: git diff --check; python -m compileall on changed modules/tests.
Disposition: F105/F106/F114/F212/F283/F333/F334/F614/F687/F690/F711/F746/F838/F126/F449/F484/F485 fixed in this commit.

Disposition: F109 fixed-later in 161183e; F276 fixed-later in 7e644de; F335 fixed-later in b53cf16; F747 fixed-later in 4010849; F835/F836 fixed-later in 9ef655c.

Disposition: F758 obsolete because repair_session_insights and repair_empty_sessions were removed in e20f6f5.
Disposition by finding (current candidate evidence):

| Finding | Disposition |
| --- | --- |
| F024 | fixed: skip mutating opens without read correlation |
| F146 | fixed: reject non-completed daemon outcomes inside every measured invocation |
| F155 | obsolete: mixed-load query parameters already use a monotonic cross-round counter |
| F268 | obsolete: `_run_arm` already calls `capture_finished_build_output` before recording resources |
| F308 | fixed: receipts record the effective census dispatch width |
| F310 | fixed: resource interval now includes fresh generation construction and final reads |
| F700 | fixed: scenario execution is explicitly declared outside the receipt contract |
| F701 | fixed: default pipeline probe output always carries a receipt |
| F702 | fixed: common verifier finalization adds receipts for early exits |
| F703 | fixed: default SLO text output prints its receipt |
| F776 | obsolete: `_table_count_delta` already turns unavailable count sentinels into unmeasured values |
| F834 | fixed: cancellation benchmark performs and validates a daemon cancellation |
| F869 | fixed: cancellation timing now comes from a cancelled in-flight request |
| F921 | obsolete: append-cohort quiescent observations already set phase cleanup evidence |
| F927 | fixed: unavailable debt renders unknown and causes comparison/CLI failure |
| F417 | fixed: MCP check environment includes Python |
| F797 | fixed: shell sync retries when pytest or ruff completeness is missing |
| F893 | obsolete: full-test CI already runs `uv sync --extra dev --group audit --frozen` |
| F839 | fixed: AST-context anchors distinguish same-text matches in separate contexts |
| F894 | fixed: enforcing baselines are compared with the parent revision |
| F756 | fixed-later: daemon-to-storage imports remain in `convergence_stages.py` and `metrics.py`; adapter migration is still required |
| F035 | obsolete: production build already emits the current observability island; rebuild produced no asset diff |
| F103 | obsolete: production build already emits the current search client; rebuild produced no asset diff |
| F722 | fixed: live GIL state is rechecked after extension probes |
| F723 | fixed: public Python install commands now request CPython 3.14t |

Verification: `npm run build` passed. The three declared `devtools test` selectors were submitted/waited through AgentCTL; the first remained queued (#4651) under pytest backpressure, and the remaining two were not started. `git diff --cached --check` passed.
Fix the reviewed blob durability, replay, embedding receipt, selector, identity, retry accounting, and lifecycle admission defects.

Finding dispositions: F027/F028/F422/F434/F435/F603/F615/F848 fixed here; F090/F118/F119/F129 fixed here; F154/F295/F327 fixed here; F686/F766/F812 obsolete at base (already corrected with inventory protection, mixed-recipe membership, and shrinking planned inventory); F616 obsolete at base (its regression already targets the window finalizer); F765 obsolete at base (active writes refresh the generation contract); F811 obsolete at base (generation reads compare stored contract fields with the database-derived contract); F767 and F810 remain unresolved pending a cross-tier provenance and index-promotion authority design.
Remove a monkeypatch target for a provider detector that no longer exists in the production ZIP route. The guard still traps the live ZIP sampler and decoder entry points.
F141: keep the receipt fixed-size and within the producer import budget. Declare the fresh raw existence journal as retained bookkeeping so focused excision flows pass.
Follow-up after the declared selectors exposed the lease-thread admission gap, the raw existence journal carrier, and a test that omitted the daemon writer needed by candidate judgment. This completes F485 on the coordinator-thread route; the initial finding disposition table is in the preceding commit.
Check the endpoint duplicate flag for an explicit default-shaped retention update; the receipt intentionally omits a no_op field for accepted updates.
Correct the destructive-operation confirmation gate, carry archive identity through daemon lease delegation and tier opens, and keep insight invalidation in the admitted transaction. The initial commit carries the full finding disposition table; this follow-up closes failures found by its focused selectors.
Disposition follow-up: F109, F105, F106, F114, F746, F835, F836 and F838 are fixed by 844b0c2 or its listed fixed-later commits; F186, F614 and F711 are fixed, and F758 is obsolete as recorded in 844b0c2. This commit carries archive identity into the remaining excision and cursor writes exposed by focused verification, and initializes test archives through the fresh-format bootstrap.
F105/F106/F109/F114/F746/F835/F836/F838 disposition: fixed (844b0c2), fixed-later where existing commits own the correction (161183e, 9ef655c). F109 marker carriers have a declared excision route; query holdout receipts and assertion scrubbing are covered by regression tests. Final selector failures in the resumed candidate were due to stale test seams: bind injected tier writers to archive_root and skip indexed deletion when the session was already absent.
F126/F276/F283/F335/F449/F484/F485/F747 dispositions: fixed or fixed-later as recorded in 844b0c2, 7e644de, b53cf16 and 4010849. The excision regression selector exposed one remaining ops write-scope lease check without CursorStore archive identity; bind that assertion to the store root.
F105/F106/F109/F114/F746/F835/F836/F838 disposition remains fixed or fixed-later as recorded in 844b0c2, 161183e and 9ef655c. The batch re-ingest regression found revision heads/applications surviving source erasure and violating raw-existence authority; remove those index references with the excised session and assert the tables are clear.
Sinity added a commit that referenced this pull request Sep 28, 2026
polylogue-1s16n and polylogue-qxm5u.

- Candidate capture: the daemon actuator and the facade share one ref
  resolver that accepts canonical message refs; the browser receiver sends
  the canonical message ref, scopes the candidate to its session, follows
  the accepted mutation to its receipt, and reports a rejection as 400.
- Compaction: the pack estimate measures the complete serialized pack with
  a byte-aware estimator, names truncation in the manifest, and refuses a
  budget below the empty envelope.
- Schema merge: a collapsed object folds later keys into its value schema.
- Patterns gate: trusted-parent anchors keep their AST context.
- Reset protocol: an omitted expected_targets is not an empty preview.
- Session audit: a swept domain that keeps pending keys stays owed while the
  audit rotates to the other domains; completing it re-owes later domains.
- ChatGPT assets: every duplicate member rendition becomes its own
  attachment with its own blob, in both enrichment routes.
- Excision carriers: raw_existence_changes is declared once (EXCISED), and
  a duplicate declaration is refused.
- Extension: legacy accepted-identity cache entries are migrated once at
  startup; identity reads and writes share the storage queue.
- Compaction evidence cites only composable prefix-sharing parent links.
- Stale tests fixed forward: displaced-match fixture, compaction anchors,
  promoted audit pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity added a commit that referenced this pull request Sep 29, 2026
polylogue-1s16n and polylogue-qxm5u.

- Candidate capture: the daemon actuator and the facade share one ref
  resolver that accepts canonical message refs; the browser receiver sends
  the canonical message ref, scopes the candidate to its session, follows
  the accepted mutation to its receipt, and reports a rejection as 400.
- Compaction: the pack estimate measures the complete serialized pack with
  a byte-aware estimator, names truncation in the manifest, and refuses a
  budget below the empty envelope.
- Schema merge: a collapsed object folds later keys into its value schema.
- Patterns gate: trusted-parent anchors keep their AST context.
- Reset protocol: an omitted expected_targets is not an empty preview.
- Session audit: a swept domain that keeps pending keys stays owed while the
  audit rotates to the other domains; completing it re-owes later domains.
- ChatGPT assets: every duplicate member rendition becomes its own
  attachment with its own blob, in both enrichment routes.
- Excision carriers: raw_existence_changes is declared once (EXCISED), and
  a duplicate declaration is refused.
- Extension: legacy accepted-identity cache entries are migrated once at
  startup; identity reads and writes share the storage queue.
- Compaction evidence cites only composable prefix-sharing parent links.
- Stale tests fixed forward: displaced-match fixture, compaction anchors,
  promoted audit pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity added a commit that referenced this pull request Sep 29, 2026
polylogue-1s16n and polylogue-qxm5u.

- Candidate capture: the daemon actuator and the facade share one ref
  resolver that accepts canonical message refs; the browser receiver sends
  the canonical message ref, scopes the candidate to its session, follows
  the accepted mutation to its receipt, and reports a rejection as 400.
- Compaction: the pack estimate measures the complete serialized pack with
  a byte-aware estimator, names truncation in the manifest, and refuses a
  budget below the empty envelope.
- Schema merge: a collapsed object folds later keys into its value schema.
- Patterns gate: trusted-parent anchors keep their AST context.
- Reset protocol: an omitted expected_targets is not an empty preview.
- Session audit: a swept domain that keeps pending keys stays owed while the
  audit rotates to the other domains; completing it re-owes later domains.
- ChatGPT assets: every duplicate member rendition becomes its own
  attachment with its own blob, in both enrichment routes.
- Excision carriers: raw_existence_changes is declared once (EXCISED), and
  a duplicate declaration is refused.
- Extension: legacy accepted-identity cache entries are migrated once at
  startup; identity reads and writes share the storage queue.
- Compaction evidence cites only composable prefix-sharing parent links.
- Stale tests fixed forward: displaced-match fixture, compaction anchors,
  promoted audit pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity added a commit that referenced this pull request Sep 29, 2026
polylogue-1s16n and polylogue-qxm5u.

- Candidate capture: the daemon actuator and the facade share one ref
  resolver that accepts canonical message refs; the browser receiver sends
  the canonical message ref, scopes the candidate to its session, follows
  the accepted mutation to its receipt, and reports a rejection as 400.
- Compaction: the pack estimate measures the complete serialized pack with
  a byte-aware estimator, names truncation in the manifest, and refuses a
  budget below the empty envelope.
- Schema merge: a collapsed object folds later keys into its value schema.
- Patterns gate: trusted-parent anchors keep their AST context.
- Reset protocol: an omitted expected_targets is not an empty preview.
- Session audit: a swept domain that keeps pending keys stays owed while the
  audit rotates to the other domains; completing it re-owes later domains.
- ChatGPT assets: every duplicate member rendition becomes its own
  attachment with its own blob, in both enrichment routes.
- Excision carriers: raw_existence_changes is declared once (EXCISED), and
  a duplicate declaration is refused.
- Extension: legacy accepted-identity cache entries are migrated once at
  startup; identity reads and writes share the storage queue.
- Compaction evidence cites only composable prefix-sharing parent links.
- Stale tests fixed forward: displaced-match fixture, compaction anchors,
  promoted audit pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity added a commit that referenced this pull request Sep 29, 2026
#5727 made a root-bound writer lease refuse any write that omits its
archive identity. #5769 fixed the lifecycle and several daemon ops
writers; the routes below still refused or wrote to a re-resolved root.

- Pass archive_root at the remaining daemon, schema, security and
  storage write opens.
- Daemon-emitted lifecycle and live-batch events name the daemon's
  archive instead of re-resolving the ambient root.
- Nested write_lease re-entry checks the held lease's own identity;
  it raised "omitted archive identity" under any root-bound lease.
- SQLiteBackend over an established archive admits it through the
  read-only format-marker proof when the caller holds no lease, so the
  live batch probing Polylogue.backend is not refused (#5727 made the
  constructor run the lease-gated active-root bootstrap every time).
- A process-wide arming no longer saves and restores the thread-local
  flag, which left a thread armed after out-of-order exits (#5722).

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

The run route reads operation_runtime.embedding_convergence from the
API server (#5727), so the fake server declares it. Since #5691 a
cancelled compute owner stops its retained preparation, so the raw
owner test asserts nothing is published on cancel and the next pass
publishes the session and its FTS rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity added a commit that referenced this pull request Sep 29, 2026
polylogue-1s16n and polylogue-qxm5u.

- Candidate capture: the daemon actuator and the facade share one ref
  resolver that accepts canonical message refs; the browser receiver sends
  the canonical message ref, scopes the candidate to its session, follows
  the accepted mutation to its receipt, and reports a rejection as 400.
- Compaction: the pack estimate measures the complete serialized pack with
  a byte-aware estimator, names truncation in the manifest, and refuses a
  budget below the empty envelope.
- Schema merge: a collapsed object folds later keys into its value schema.
- Patterns gate: trusted-parent anchors keep their AST context.
- Reset protocol: an omitted expected_targets is not an empty preview.
- Session audit: a swept domain that keeps pending keys stays owed while the
  audit rotates to the other domains; completing it re-owes later domains.
- ChatGPT assets: every duplicate member rendition becomes its own
  attachment with its own blob, in both enrichment routes.
- Excision carriers: raw_existence_changes is declared once (EXCISED), and
  a duplicate declaration is refused.
- Extension: legacy accepted-identity cache entries are migrated once at
  startup; identity reads and writes share the storage queue.
- Compaction evidence cites only composable prefix-sharing parent links.
- Stale tests fixed forward: displaced-match fixture, compaction anchors,
  promoted audit pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity added a commit that referenced this pull request Sep 29, 2026
## Summary

Closes the open Codex findings from the #5727 landing tracked in
polylogue-1s16n (9) and polylogue-qxm5u (2). This replaces the earlier
untested source batch on this branch. The polylogue-1tyq5.164/.165/.166
parts were dropped because another run owns them.

## Problem

Each finding was re-checked against master. All eleven reproduced on
master, apart from one that #5767 had already fixed:

- The browser selection save sent `message:<provider id>` to a daemon
actuator that accepted only session refs. Two further blockers on that
route came to light: the receiver treated the accepted mutation envelope
as "unavailable", and it passed the capture evidence ref as the
assertion scope, which `upsert_assertion` rejects. So no browser
candidate could persist.
- The compaction budget used a whitespace word count over compact JSON,
so 100 omission rows cost about one token.
- Once a schema was collapsed as high-cardinality, later keys went back
under `properties`. The existing 512-sample law was red on master.
- The trusted-parent baseline dropped AST context.
- An omitted `expected_targets` became `[]`, so a confirmed reset was
always refused.
- A swept audit domain that still had pending keys restarted itself
indefinitely, so the marker domain never ran.
- Only the first duplicate ChatGPT asset rendition got an attachment.
- `raw_existence_changes` was declared twice, and the TOMBSTONE
declaration won. #5767 already fixed this on master.
- Legacy scalar accepted-identity cache entries in the extension were
read as maps.
- The displaced-match fixture could not be parsed.
- Compaction evidence cited quarantined or authority-contradicted parent
prefixes.

## Solution

- The facade and daemon actuator now share one candidate ref resolver,
`resolve_assertion_candidate_refs`, which accepts canonical `message:`
refs. The receiver sends the canonical message ref and scopes the
candidate to its session. It follows the mutation with
`operation_to_completion` and maps a daemon rejection to 400.
- Compaction measures the whole serialized pack, including its own
estimate field, with `estimate_serialized_tokens`, the larger of the
word estimate and UTF-8 bytes/4. Truncations are named in
`manifest.unknown`. A budget below the empty envelope raises
`CompactionBudgetTooSmallError`. The prose estimator used by the context
compiler is unchanged.
- In a high-cardinality merge, a marked side keeps the property names it
already retained. Keys first seen later fold into
`additionalProperties`.
- Trusted baseline entries are compared as full `(file, digest,
context)` anchors.
- `ResetRequest.expected_targets` defaults to `None`.
- The session audit keeps an owed-domain set. It rotates past a swept
domain that still has pending keys, and a late completion re-owes the
domains after it.
- Every duplicate asset member becomes its own attachment with its own
blob, member-derived name and MIME type. This covers both the
prepared-carrier route and the in-memory route, and rollback restores
the attachment count.
- The extension migrates identity storage once at startup, recorded
under a version key. Reads and writes go through the storage queue.
- The compaction evidence SQL requires `inheritance = 'prefix-sharing'`
and `topology_status_composes_sql`.
- Three stale tests are fixed forward: the compaction anchor refs, the
promoted audit pass, and the displaced fixture.

## Verification

- `agentctl job start polylogue pytest_focused --workspace <wt> --
tests/unit/browser_capture/test_receiver.py
tests/unit/operations/test_mutation_actuators.py::TestCaptureAssertionCandidateActuator
tests/unit/cli/test_note.py tests/unit/surfaces/test_compaction.py
tests/unit/core/test_schema_laws.py
tests/unit/devtools/test_verify_patterns.py
tests/unit/cli/test_reset.py::TestResetCommandDeletion::test_confirmed_reset_without_a_preview_is_not_an_empty_preview
tests/unit/daemon/test_session_profile_composition.py
tests/unit/sources/test_chatgpt_sidecars.py
tests/unit/sources/test_assembly_chatgpt.py
tests/unit/security/test_excision_carrier_reach.py
tests/unit/insights/test_run_projection_materialization.py
tests/unit/context/test_compiler.py
tests/unit/operations/test_daemon_protocol.py`: all new tests pass. The
three remaining failures (`test_compiler` ×2 and `test_note` canary)
fail identically on master `origin/master` (baseline job 1403).
- Follow-up runs: `test_receiver.py` passed, and
`test_chatgpt_sidecars.py test_assembly_chatgpt.py
test_session_profile_composition.py` passed.
- `verify_quick`: succeeded (job 1520).
- Extension: `vitest run` gave 419 passed, and the new migration test
fails without the startup migration.

## Residuals

- `dynamic_keys.py`, `assembly_chatgpt.py` and
`run_projection_relations.py` are in the derived schema-identity
closure, so this moves the derived identity. Land it before the next
rebuild starts.
- Master already has unrelated failing tests (reset CLI suite, note
canary, context compiler, facade contract, preamble, tag overlay). They
are recorded in a separate Bead.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

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

## Summary

`tests/unit/daemon/test_daemon_cli.py` failed on master because of a
production defect, not the dependency bump. #5727 made a root-bound
writer lease refuse any write that omits its archive identity, but it
left callers that open without one. On fddc7a1 the daemon could not
start: `DaemonLifecycle.start` opened `ops.db` unnamed under
`polylogued`'s root-bound lease. #5769 has since fixed the lifecycle and
several daemon ops writers. This PR fixes the routes that were still
refused and realigns three tests with contracts that later PRs changed.

## Problem (evidence)

- `devtools test tests/unit/daemon/test_daemon_cli.py` on plain
origin/master 4cbf83b, with no lockfile bump: `29 failed`, the same
set as the bumped run. That rules out starlette, uvicorn, watchfiles,
ruff, hypothesis and networkx.
- 28 of the 29 were `UnleasedWriteError:
open_daemon_connection(.../ops.db) omitted archive identity for writer
daemon.lifecycle.start`, raised while the daemon started. The tests' own
`watch stopped`, `server stopped` and `shutdown marker failed`
expectations never ran. The 29th was the #5727 pidfile message change.
- With the lifecycle fixed, nine more failures appeared. The same tests
pass on 841bbb3, the commit before #5727. Traced causes:
- `SQLiteBackend.__init__` now runs the lease-gated
`initialize_active_archive_root` on every construction, even for an
established archive. The live batch reads `Polylogue.backend` outside
the lease, so each intake item came back `retryable: UnleasedWriteError:
active archive bootstrap requires the daemon write lease`.
- Nested `write_lease(actor)` re-entry called `require_write_lease`
without a root, so any derivation publish under a root-bound lease
raised "omitted archive identity".
- Daemon-emitted events re-resolved the ambient archive root instead of
the daemon's own.
- On master tip 14a63dc, the three touched test files still fail 14
tests: `devtools test --on-default-branch
tests/unit/daemon/test_daemon_cli.py
tests/unit/daemon/test_daemon_lifecycle.py
tests/unit/storage/test_write_lease.py` gives `151 passed, 14 failed`.

## Solution

Production (`fix(daemon)` commit):
- Pass `archive_root` at the write opens that still omitted it. These
are the FTS automerge, judgment automation, daemon assertion mutation,
schema drift sampling, schema sampling and verification, secret scan,
blob GC history, sqlite-vec runtime, the non-daemon branch of
`open_initialized_tier_connection`, and `connection_context`, which
gains the parameter.
- Daemon lifecycle, parked-loop and live-batch events name
`archive_root_path`.
- Nested `write_lease` re-entry checks the held lease's own identity. It
no longer checks an absent one.
- `initialize_backend_state` runs the active-root bootstrap only when
the caller may write: the bootstrap is needed, a lease is held, or
enforcement is off. A daemon-armed caller without a lease gets the
read-only `assert_archive_format_lineage` proof. An established archive
therefore still has to prove its lineage marker, as #5727 intended.
- `arm_write_lease_enforcement(process_wide=True)` no longer saves and
restores the thread-local flag. #5722's overlapping-arming test exits
out of order, which restored a stale `armed=True` and left the pytest
thread armed for every later test in `test_write_lease.py`.

Tests, each disposition against the PR that changed the contract:

| Test(s) | Cause | Disposition |
| --- | --- | --- |
| 14 `UnleasedWriteError` plus 13 `watch/server stopped` and `shutdown
marker failed` | lifecycle start under the root-bound lease (#5727) |
production bug. #5769 fixed the lifecycle, and this PR fixes the
remaining writers |
| `test_pidfile_remains_locked_until_admitted_writers_are_drained` |
#5727 widened the refusal wording | superseded contract. #5769 already
realigned it |
|
`test_an_orphaned_service_retains_archive_ownership_on_the_production_route`
(TimeoutError) | never reached `health_check` because the lifecycle
start raised | production bug, same root cause |
| `test_daemon_watcher_hints_wake_fair_intake_and_canonical_derivation`
×4 | backend bootstrap outside the lease (#5727) | production bug, fixed
|
| `test_cold_build_*` ×4,
`test_daemon_startup_catch_up_and_restart_repair_session_profiles` |
nested-lease re-entry, event root, and state leaked from the failing
watcher test | production bug, fixed |
| `test_run_daemon_services_waits_for_fts_startup_before_watcher` ×2 |
#5727 reads `operation_runtime.embedding_convergence` | superseded test
stub. The fake server declares the attribute |
| `test_raw_owner_cancellation_settles_publication_and_fts` (fails on
the current tip) | #5691 made a cancelled compute owner stop its
retained preparation | superseded contract. Renamed to
`..._stops_preparation_and_the_next_pass_publishes`: cancellation
publishes nothing, and the next pass publishes the session and its FTS
rows |
| `test_archive_bound_lease_can_delegate_without_dropping_identity` |
asserted `adopted is lease`, but adoption returns a per-thread view by
design | the test was wrong when #5727 added it. It now asserts that the
adopted view carries the archive identity and authorizes a write for
that archive |

New regression tests, each naming its anti-vacuity condition: nested
re-entry inherits the outer archive identity; an unleased backend admits
an established archive read-only and still refuses one without a marker;
lifecycle start and the signal marker persist under a root-bound lease.

## Verification

- `devtools test tests/unit/daemon/test_daemon_cli.py
tests/unit/daemon/test_daemon_lifecycle.py
tests/unit/storage/test_write_lease.py
tests/unit/cli/test_cli_write_authority.py
tests/unit/daemon/test_daemon_events_endpoint.py
tests/unit/storage/test_write_guard.py
tests/unit/daemon/test_write_coordinator.py
tests/unit/daemon/test_judgment_automation.py
tests/unit/daemon/test_secret_scan_sweep.py
tests/unit/daemon/test_standing_queries.py
tests/unit/daemon/test_standing_queries_default_evaluator.py
tests/unit/daemon/test_standing_query_clock.py
tests/unit/mcp/test_mcp_call_log.py
tests/unit/pipeline/test_schema_drift_sentinel_ingest.py
tests/unit/schemas/test_drift_sentinel.py
tests/unit/schemas/test_drift_sentinel_sampling.py
tests/unit/security/test_secret_scan.py` at 3a56a1e: `devtools test:
PASSED`, `445 passed`.
- `devtools verify --quick` at 3a56a1e: `verify: PASSED`.
- The head was then rebased over #5778, which touches none of these
files.

## Residuals

- `devtools schema closure` reports these touched files as IN:
`write_lease.py`, `async_sqlite.py`, `connection_profile.py`,
`bootstrap.py`, `blob_gc.py`, `sqlite_vec_runtime.py` and
`sampling_db.py`. The derived schema identity may move, so this must
land before a fresh build starts.
- Some writers outside the daemon still resolve the ambient root: the
HTTP reset event, browser capture and judgment receipt events. In
production that root equals the lease root. In tests it can differ when
`polylogue.daemon.events` is first imported under a
`patch("polylogue.paths.archive_root")`, which binds the mock into the
module.
- `open_profiled_connection` still has no `archive_root` for write
profiles. Every current caller uses a read profile.
- An `arm_write_lease_enforcement(armed=False, process_wide=True)`
suppressor no longer clears a thread-local arming. Nothing calls that
combination.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 29, 2026
…fi… (#5752)

Batch `polylogue-20260928-192817-c999529c` on base `ee567d00982b`.

**polylogue-iag9y** Unresolved Codex findings from polylogue-1tyq5.37
(part 1/5, 10 findings)

**polylogue-x650m** Unresolved Codex findings from polylogue-1tyq5.37
(part 2/5, 10 findings)

**polylogue-idz9o** Unresolved Codex findings from polylogue-1tyq5.37
(part 3/5, 10 findings)

**polylogue-enrac** Unresolved Codex findings from polylogue-1tyq5.37
(part 4/5, 10 findings)

**polylogue-wzs8g** Unresolved Codex findings from polylogue-1tyq5.37
(part 5/5, 9 findings)

**polylogue-rumwn** Unresolved Codex findings from polylogue-1tyq5.20
(part 1/1, 2 findings)

**polylogue-g6227** Unresolved Codex findings from polylogue-1tyq5.14
(part 1/1, 2 findings)

**polylogue-yi3s2** Unresolved Codex findings from polylogue-1tyq5.15
(part 1/1, 3 findings)

**polylogue-wd0ws** Unresolved Codex findings from polylogue-1tyq5.33
(part 1/1, 2 findings)

**polylogue-pkede** Unresolved Codex findings from polylogue-1tyq5.9
(part 1/2, 10 findings)

**polylogue-abwxk** Unresolved Codex findings from polylogue-1tyq5.9
(part 2/2, 9 findings)

**polylogue-sdfvf** Unresolved Codex findings from polylogue-1tyq5.5
(part 1/1, 7 findings)

**polylogue-uyb8j** Unresolved Codex findings from polylogue-1tyq5.23
(part 1/1, 6 findings)

**polylogue-biqlz** Unresolved Codex findings from polylogue-1tyq5.2
(part 1/1, 3 findings)

**polylogue-tg8rk** Unresolved Codex findings from polylogue-1tyq5.29
(part 1/2, 10 findings)

**polylogue-gwlfh** Unresolved Codex findings from polylogue-1tyq5.29
(part 2/2, 10 findings)

**polylogue-zl347** Unresolved Codex findings from polylogue-1tyq5.6
(part 1/1, 5 findings)

**polylogue-t4dfv** Codex review debt from PR #5727 round 2 (13
findings)

---------

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

Search now returns its hits together with the lanes that actually ran,
and the API, daemon, CLI and MCP envelopes all project that one result.
The actions lane no longer needs embeddings. Hybrid fuses the text,
action and vector legs, and when the vector leg is unavailable it
degrades to the lexical legs under the `hybrid` lane. Semantic search
refuses with a typed error instead of leaking provider exceptions or
reporting an empty success. Separately, the hook carrier census now
reads each directory as a stream.

This salvages ChatGPT fleet worker 3's unverified patch for beads
polylogue-1tyq5.35 and polylogue-1tyq5.21. The patch was reviewed,
corrected and verified here.

## Problem

These are Codex findings on PR #4180 and PR #5447. Each was checked
against master before its fix was kept.

- F871: `archive_search_hits` treated `retrieval_lane="actions"` as a
semantic lane. Without a vector backend it raised
`EmbeddingRetrievalNotReadyError` instead of returning action evidence.
- F872: `provider.query()` had no handler around it. When the vector
service failed, hybrid lost its lexical hits and pure semantic search
leaked the provider exception.
- F873: CLI `format_search_envelope`, `session_search_result_payload`
and MCP `archive_search_payload` never passed `execution`. A degraded
hybrid therefore looked healthy on those surfaces.
- F874: the API envelope counted hybrid results through `spec.count()`,
which counts only the semantic leg. The result was `total=0` next to a
full page, and that suppressed continuation.
- F877: a degraded hybrid labelled its hits `dialogue`, so the next
page's hybrid request rejected the cursor this route had minted. This
happened on both the API route and the daemon route.
- F878: sqlite-vec with an empty or wholly stale store returned `[]` as
a successful empty search.
- F879: a degraded hybrid returned text FTS only and dropped the action
leg.
- F141: #5727 already made the compact receipt a fixed-size count. The
census still sorted each carrier directory into a list first, though,
and a day directory holds one carrier per hook process.

## Solution

- `archive_search_hits` returns `ArchiveSearchResult(hits,
retrieval_lane, execution)`, and `project_search_hits` projects it
without rebuilding the lane story.
- Action-block FTS reads through
`ArchiveStore.iter_search_summaries(actions_only=True)`
(`tool_use`/`tool_result` blocks). It streams over one cursor until it
has the requested number of distinct sessions.
- Handling of the vector leg:
  - Cancellation, timeout, work-budget and read-frame errors propagate.
  - `EmbeddingRetrievalNotReadyError` makes the lane unavailable.
  - Any other provider exception makes the lane `execution_failed`.
- The archive's own `semantic_summaries` read is outside that handler,
so an index fault is never relabelled as a vector failure.
- Non-hybrid lanes refuse with a typed error. The session-seed route
keeps its typed refusal when no backend is available.
- `SqliteVecProvider.query` refuses with `readiness_status="empty"`
before buying a query embedding when no `message_embeddings_meta` row
matches the current message and recipe projection. That table is the
writer's own authority for whether a vector exists.
- On the API and MCP routes, hybrid, actions and vector totals are
`null`, which the daemon route already reports. The daemon envelope
`offset` follows the cursor page.
- MCP search routes through the shared ranked read. Two things are
removed:
- `archive_search_payload`'s `retrieval_lane` parameter, which was
ignored because the spec already carries the lane;
  - `archive_search_hit_payload`, which no longer has callers.
- `docs/search.md` describes hybrid degradation, null totals and
semantic readiness.
- The hook census walks one live `scandir` iterator per depth and closes
every iterator.

## Verification

- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w3 --wait`, job 2136 on 9e3e005: `verify:
PASSED exit=0`. All 12 gates pass, including mypy, layering and
schema-closure.
- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w3 --wait -- <21 files>`, job 2145 on
9e3e005: 358 passed, 3 failed. The selection covers:
  - the new tests;
  - `tests/unit/sources/test_hook_carriers.py`;
  - MCP query, envelope and miss-predicate contracts;
  - daemon reads;
  - the search envelope contract;
  - archive search runtime, near-session and search-hit tests;
  - the API envelope builder;
  - daemon golden parity;
  - the vec and embedding suites;
  - the similarity endpoint;
  - query verbs;
  - `test_query_ordering_authority`.

The 3 failures are in `tests/unit/storage/test_embedding_dedup.py`
(`status 'error' != 'embedded'`). They also fail on the unmodified base
dc21dd4 in job 2133, so they predate this change.
- Negative control: job 2065 ran the new tests on the unmodified base
f7ad8d8. Every fix test failed there:
- F141: the instrumented iterator saw entries collected before any was
inspected.
  - F878: the query embedding was purchased.
  - F874: `total` was 0 instead of None.
- F877: the cursor lane was `dialogue` instead of `hybrid`, and the
daemon rejected its own cursor.
  - F871: `EmbeddingRetrievalNotReadyError` was raised.
  - F872: the `RuntimeError` leaked.
- F873 and F879 failed on the old tuple return shape,
`project_search_hits` arity and missing `.hits`. These are API-shape
failures; their behavioural assertions are covered by the post-fix run.
- The cancellation and archive-fault tests guard the new handler, so
they pass on base by design.

## Self-review

- **Sibling sites.** Every caller of `archive_search_hits` and
`project_search_hits` moved to the new result: API, daemon, the MCP list
and search paths, and tests. `format_search_envelope` and
`session_search_result_payload` have no production callers, but both now
accept and forward execution. The session-seed branch needed a sibling
fix to keep its typed refusal.
- **Cancellation and loops.** Cancellation, deadline, work-budget and
read-frame errors are re-raised ahead of the broad handler. The
lane-candidate loop is one streamed SQL cursor, and it stops once enough
distinct sessions have been read. The worker's version re-issued an
OFFSET query per page, which is quadratic when one session has many
hits.
- **Unbounded reads.** Candidate pools stay at `(offset + limit) * 3`.
The census never holds a directory listing.
- **Fail-open fallbacks.** The broad `except Exception` covers only
`provider.query()`, and it records `execution_failed` as a named
degraded outcome. Non-hybrid lanes refuse with a typed error.
- **Compatibility shims.** None were added. The ignored MCP
`retrieval_lane` parameter and the dead hit-payload helper were deleted
rather than kept.
- **Removed symbols.** A search for `archive_search_hit_payload` finds
only docstring mentions. The monkeypatch targets for
`archive_search_hits` in the MCP tests were updated to the new return
type.
- **Tests on the production route.** The lane tests use real seeded
archives through `open_operation_read`, `Polylogue`,
`execute_read_operation` and the MCP builder; only the external vector
service is substituted. The readiness test exercises
`SqliteVecProvider.query` on a snapshot connection, with vec-extension
loading stubbed out.

## Findings

| key | disposition | evidence | test |
| --- | --- | --- | --- |
| F871 | fixed | master `archive_execution.py` sent `actions` down the
vector path |
`test_actions_without_embeddings_return_only_action_evidence` |
| F872 | fixed | master had no handler around `vector_provider.query` |
`test_vector_execution_failure_degrades_hybrid_and_refuses_semantic`,
`test_vector_read_cancellation_is_not_a_successful_hybrid_degradation`,
`test_archive_read_failure_is_not_relabelled_as_a_degraded_vector_lane`
|
| F873 | fixed | master CLI and MCP `build_search_envelope` calls had no
`execution` |
`test_cli_and_both_mcp_builders_preserve_degraded_execution` |
| F874 | fixed | master `search_envelope_builder.py` used `total = await
spec.count(...)` |
`test_hybrid_api_does_not_publish_semantic_only_total` |
| F877 | fixed | master's degraded hybrid returned `"dialogue"` |
`test_degraded_hybrid_api_cursor_keeps_request_lane`,
`test_degraded_hybrid_daemon_cursor_keeps_request_lane` |
| F878 | fixed | master's `_query_unlocked` bought an embedding with no
readiness check | `tests/unit/storage/test_vector_query_readiness.py` |
| F879 | fixed | master's degraded hybrid returned lexical-only hits |
`test_degraded_hybrid_fuses_action_rank_contributions` |
| F141 | fixed (residual) | master `_carrier_scope_summary` still called
`sorted(entries)` |
`test_compact_carrier_census_streams_wide_directories` |
| F139 | fixed-already | #5727 (ee567d0); `hook_producer.py:282`:
producers never wait for the drain | - |
| F675 F683 F684 F781 F890 F891 F892 (1tyq5.21); F786 F815 F823 F830
(.8); F248 F446 F447 F448 (.11); F417 F797 F893 (.13); F696 F708 (.17);
F605 F672 F674 (.26); F035 F103 F722 F723 (.32) | not reached | - | - |

## Derived-identity closure

`devtools schema closure` reports these changed files as IN:

- `polylogue/archive/query/archive_execution.py`
- `polylogue/archive/query/search_contract.py`
- `polylogue/archive/query/search_hits.py`
- `polylogue/sources/hook_producer.py`
- `polylogue/storage/search_providers/sqlite_vec_queries.py`
- `polylogue/storage/sqlite/archive_tiers/archive.py`

Every other changed file is out. The edits are semantic, so the
candidate identity may move; land this before a rebuild starts.

## Residuals

- MCP search hits are now built by
`SessionSearchHitPayload.from_search_hit`, so they gain `matched_terms`
and a domain-shaped session summary. The focused MCP and parity suites
pass with this.
- On a wholly stale store, the readiness probe runs one primary-key
lookup per current message.
-
`tests/unit/sources/test_hook_carriers.py::test_compact_and_materialize_ten_thousand_events`
is a timing test. It failed twice under host load (758 and 1018 events/s
against a threshold of 2000) and passed in the final run. Its timed
window, `materialize_hook_carriers`, does not include the changed
census.
- `polylogue/mcp/server_cutover.py` loses one line, and #5779 also edits
that file, in other hunks.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

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

Realigns 11 tests that fail on master. Each encodes a contract that a
merged PR changed on purpose. Production code is unchanged.

## Problem

These tests failed at master 1beb2e5 (baseline agentctl job 2441,
`devtools test --on-default-branch`). Beads: polylogue-cp3z5 (lineage
validation) and polylogue-bn8gg (facade `record_context_ledger`). The
other items are in polylogue-6bhuy, which also lists items owned by
sibling PRs.

| Test | Contract change |
| --- | --- |
| `tests/unit/devtools/test_lineage_validation.py` (all 21) | The
hand-built index lacks `messages.fields_digest` and the derived schema
identity stamp. Every reader refuses an unstamped derived tier as
`SchemaSkew` ("expected <digest>, found None"). |
| `test_facade_contracts.py::test_no_undiscovered_async_methods` |
`record_context_ledger` (#5722) and `get_session_summaries` are in no
contract set. |
|
`test_facade_contracts.py::test_archive_facet_buckets_count_unique_sessions_for_duplicate_hits`
| #5703 moved deduplication into the search-scope walk. The unscoped
path yields each session once by construction, so the duplicate case is
a search hit. |
|
`test_preamble.py::test_precompact_uses_scheduler_and_records_real_boundary_context`
| The precompact path awaits `record_context_ledger` (#5722). The mock
was a plain `MagicMock` attribute, and the other test in the file set it
twice. |
|
`test_manual_contract.py::test_published_examples_use_live_operation_vocabularies_and_preconditions`
| `read`'s `view` is now `Literal[...] \| None`. `typing.get_args` on
the union yields the Literal and `NoneType`, not the members. |
|
`test_write_effects.py::test_deferred_insight_invalidation_follows_a_repointed_index`
| #5727 moved profile invalidation into the admitted transaction, so no
deferred reopen by path is left to follow. |
|
`test_mutation_actuators.py::...::test_production_tag_and_metadata_writes_use_user_overlay_policy`
| #5727 made tag writes that change a row invalidate the search cache. |
|
`tests/unit/cli/test_status.py::...::test_sinex_status_reads_the_active_archive_file_set`
| #5722: publication mode comes from the loaded config, and the file set
from `resolve_runtime_config()`. |
|
`tests/unit/cli/commands/test_status.py::...::test_configured_override_url_is_not_refused`
| #5722: a non-built-in daemon URL is read over HTTP `GET /api/status`.
|

## Solution

Each test now exercises the current contract and keeps its anti-vacuity
condition:

- **Lineage validation.** The fixture declares `fields_digest` and
stamps the current identity with the production
`stamp_derived_schema_identity`.
- **Facade.** Both methods are classified. `get_session_summaries` gains
coverage in `test_archive_tiers_api_reads_native_sessions`: requested
ids key the result, and an unresolved id is omitted. The facet test
drives two hits for one session through the search scope.
- **Manual contract.** The vocabulary is read through unions, and the
test asserts `"messages"` is in it, so an empty read cannot pass.
- **Write effects.** The test now proves the invalidation commits and
rolls back with the caller's transaction. An effect that opened its own
connection would survive the rollback.
- **Tag overlay.** Expects exactly one invalidation per changed tag
write, and none for metadata writes or the no-op re-add.
- **Status.** The URL-override test runs a real local HTTP server and
asserts only `/api/status` was requested.

## Verification

- `agentctl job start polylogue pytest_focused --workspace <wt> --
tests/unit/devtools/test_lineage_validation.py
tests/unit/api/test_facade_contracts.py
tests/unit/context/test_preamble.py
tests/unit/agent_integration/test_manual_contract.py
tests/unit/archive/test_write_effects.py
tests/unit/operations/test_mutation_actuators.py
tests/unit/cli/test_status.py tests/unit/cli/commands/test_status.py`:
job 2632, `devtools test: PASSED exit=0`, 582 passed. Five tests passed
only on rerun. Each failed first with `DaemonWriterOwnerLoopStopped ...
daemon.operation_journals.startup` or a 5 s bridge `TimeoutError` in the
test daemon stack; that race is fixed in #5810.
- `agentctl job start polylogue verify_quick --workspace <wt>`: job
2633, succeeded.

## Self-review

- **Production route.** Each rewritten test calls the production
function (`stamp_derived_schema_identity`, `_invalidate_insights_effect`
on a real connection, `_status_operation_result` against a real HTTP
listener, `ArchiveStore` tag writes). None asserts a mock's own
behaviour.
- **Loosening.** No assertion was dropped. The facet and write-effects
tests change input shape to match the current route, and each keeps a
condition that fails if the named behaviour regresses.
- **Scope.** Test-only; no derived-identity closure file changes.

## Residuals

None known for these tests. The daemon-stack startup race behind the
five reruns is addressed in #5810.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

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

Four intake tests failed on master at 1beb2e5. Each encoded a route
or contract that an earlier PR had changed. None is a production bug, so
this PR changes tests only. One sibling guard that could never fire is
tightened too.

## Problem (evidence)

I reproduced the failures in one focused job over the four files
(agentctl job 2555) and diagnosed them with probe tests that were not
committed (including jobs 2635 and 2660). All four failures are
deterministic, not load-related.

- `test_page_admission_runs_lease_free_owners_outside_the_writer_gate`:
`admit_page` returned `RETRYABLE` with `CursorAuthorityBlockedError: ...
global raw existence is unproven: required source or index tier is
unavailable`. The fixture created only `index.db`. The cursor-authority
gate added in #5657 fails closed when one tier exists without the other,
which is the intended behavior.
- `test_watcher_queues_behind_daemon_maintenance_writer`: the test
paused `LiveParseStage.warm`. The batch has called only `warm_paths`
since #5550, so the pause never happened and `parser_started.wait(5.0)`
timed out.
-
`test_dispatcher_page_compaction_cost_is_one_scoped_hold_at_archive_scale`:
each page traced 4 SELECTs instead of 3. The fourth is `SELECT identity
FROM schema_identity WHERE tier = 'index'`, which every validated
read-only open has run since #5727. The three authority reads are
unchanged.
-
`test_flag_on_prefetch_and_flag_off_produce_identical_archive_content`:
the snapshots differ in `raw_sessions`, `raw_revision_heads` and
`raw_authority_parser_census`.
  - The prefetch arm writes `full`/`byte_proven` raws with byte heads.
- The production arm (`converge_raw_observations`, which uses the
retained preparation from #5643) writes `unknown`/`quarantined` raws
with semantic heads.
- The prefetch arm drives `DaemonParseStage` and
`backfill(prefetch_cache=...)`. No production module has constructed
`DaemonParseStage` since #5002, and `RawObservationDerivation.compute`
always builds `RawObservationReplacement(payload=None)`. So production
archive content never goes through the route that differs.

## Solution

- Lease-free owners test: bootstrap a whole archive with
`initialize_active_archive_root`, and put the source under its own root.
- Maintenance-queueing test: pause `warm_paths`, the method the batch
calls in `_ingest_full_paths`. Replace the 5 s and 1 s wall-clock waits
with waits on the events themselves: an `asyncio.Event` set with
`call_soon_threadsafe`, plus the maintenance-entered event. A `finally`
releases the parked thread. pytest-timeout bounds a hang.
- Compaction-cost test: separate the per-open identity read. Assert
there is exactly one, which means the page used one connection, then
keep the three-authority-read assertions. Raise the hang guard to 600 s,
the same as its sibling measurement test: in one probe run under host
load (average about 22), the 120 s default fired during seeding.
- Delete the prefetch equivalence test and the helpers only it used.
polylogue-fhlo1 tracks deleting or rewiring the dead `DaemonParseStage`
and `LiveParseStage.warm` routes.
- Sibling:
`test_page_admission_acquires_source_without_reading_unavailable_index`
forbade `warm`, which production never calls. The batch also swallows
prewarm exceptions, so a raising stub would have passed anyway. The test
now records calls to `warm_paths` and asserts there were none.

No production file changes, so the derived-identity closure is
untouched.

## Verification

- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/polylogue-mh-intake --wait --
tests/unit/sources/test_live_batch_convergence.py
tests/unit/sources/test_live_watcher_locking.py
tests/unit/daemon/test_dispatcher_intake_measurement.py
tests/unit/daemon/test_raw_materialization_parse_stage_equivalence.py
tests/unit/sources/test_live_watcher.py::test_page_admission_acquires_source_without_reading_unavailable_index`
(job 2688, head d81534d): `devtools test: PASSED exit=0
diagnosis=pytest_passed`, 21/21.
- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/polylogue-mh-intake --wait` (job 2696, head
d81534d): `verify: PASSED exit=0`.

## Self-review

- **Siblings.** I searched `tests/` for patches of the unused `warm`.
One other guard patched it; it is fixed here. The remaining
`stage.warm(...)` calls in `test_parse_prefetch.py` and
`test_live_watcher_parse_stage_equivalence.py` test the dead classes
directly and belong to polylogue-fhlo1.
- **Fix itself.** The identity filter matches only `from
schema_identity`, and it asserts exactly one match, so an extra
connection per page still fails the test. The authority-read assertions
are unchanged.
- **Anti-vacuity.**
- Maintenance queueing: wrapping the page in `coordinator.run` blocks
maintenance, so `maintenance_entered` never sets and pytest-timeout
fails the test.
  - Lease-free owners: the owner-outside-gate assertions are unchanged.
- Derived-only guard: removing the `_source_tier_acquisition_required()`
gate records a call.
- **Interruption.** The parked parse thread is released on every exit
from the wait block, so a failing run does not leave a thread blocking
executor shutdown.
- **Waits.** The only wall-clock bounds left in the changed tests are
`coordinator.shutdown(timeout=1.0)` after all tasks finish, which was
already there, and the pytest-timeout marks.
- **Public boundary.** Synthetic fixtures only.
- **Docs.** `docs/design/convergence-simplification-inventory.md` still
cites the deleted equivalence test. That design note describes the dead
route as a whole, so it is left to polylogue-fhlo1.

## Residuals

- In one repro job under load, the deleted test's seeding hung for 120 s
in `BlobPublicationReservationStore.reserve_many` at `conn.close()`.
Sibling tests in that file use the same seeding and passed. I did not
reproduce it again.
- `tests/unit/daemon/test_daemon_cli.py` load-sensitivity did not show
up in my runs, so it is not addressed here.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.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