Skip to content

chore: Use one retained-input route for every file size - #5834

Merged
Sinity merged 34 commits into
masterfrom
batch/polylogue-20260929-130016-35798596/integration
Sep 29, 2026
Merged

Sinity merged 34 commits into
masterfrom
batch/polylogue-20260929-130016-35798596/integration

Conversation

@Sinity

@Sinity Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Batch polylogue-20260929-130016-35798596 on base 0914f89d4c72.

polylogue-9m93s Use one retained-input route for every file size

  • One ordinary retained-input route handles every file size and removes the size branches that silently exclude or separately defer valid inputs. Focused synthetic tests show complete membership, per-re
  • Worker isolation and focused fault tests turn a killed parse worker into a typed per-file failure while the daemon survives, and ensure queue/memory accounting does not lie or starve foreground progre
  • Focused devtools tests and relevant quick gates pass on the fixed code candidate with exact selectors and receipts. The measured 419 MB RSS bound and 1.6 GB scratch daemon convergence remain open in t

polylogue-i07pw Complete prepared publication and useful worker parallelism on the ordinary route

  • 1. The ordinary daemon path consumes prepared work and removes the displaced writer-side reconstruction.
  1. Selected concurrency actually supplies work; configured thread count is not performance evid

polylogue-6xcqj One acquisition-to-publication path for incremental updates and fresh construction

  • 1. Live and fresh source inputs reach the same interpretation/publication owner through ordinary daemon entry.
  1. Interrupted acquisition/publication has an identifiable accepted operation or private

polylogue-s8x8s Remove the super-linear and redundant work in parse and cursor commit

  • 1. next_ordinal is O(1); the 419 MB codex file (manifest-whale-codex.json) ingests in under half its measured 245 s on the same driver. 2. The pickle spool is replaced by an in-memory record list unde

polylogue-aar35 Delete the inert wanted-source receipt machinery and per-origin path overrides

polylogue-5hcbg Explicit cold build can promote a candidate missing sessions the active index serves

polylogue-8j9rh Session excision leaves its tool-result sidecar raws and bytes behind

polylogue-b8of0 A kill inside an append's index write leaves the tail unmaterialized and acknowledged

  • The append variant of tests/unit/sources/test_live_ingest_kill_recovery.py (kill after the append's index write, restart, admit) ends with 6 messages, 6 distinct, 1 session, no parse errors, through t
  • A page does not report DUPLICATE for a source whose acquired revision has no materialized sessions.

Self-review

polylogue-9m93s: 3 pass(es) against docs/review/codex-review-guide.md, polylogue/daemon/AGENTS.md, polylogue/sources/AGENTS.md, polylogue/storage/AGENTS.md (Code Review Rules), /realm/project/sinnix/dots/_ai/skills/orchestrate/references/worker-contract.md (generic list)

  • worker-contract 1: each assigned criterion is met on the production path, or an unmet one names its blocker: F02 is exercised through _iter_ingest_results_sync, the function _consume_ingest_results calls, with fake executors only at process_pool_executor; F58 through session_evidence_timestamps and a real SqliteMessageStore; F61 through normalize_active_branch (called by write.py prepare_session_rows and _prepared_message_context) and SqliteMessageSink.normalize_active_path (called by append_session_to_shard); the kill test drives FileIntakeAdapter over LiveWatcher in a SIGKILLed child. Every unmet criterion (INTAKE-PREP-1, INTAKE-PREP-3, the whole 6xcqj and i07pw fields) names its blocker in its evidence.
  • worker-contract 2: each defect class is handled at every site (search and count): Inline pool fallback: grep -rn 'PicklingError' polylogue found 2 sites (ingest_batch/_core.py, validation_flow.py), both removed. Undelivered work: the stall path dropped unsubmitted raws, now refused. Worker-death policy: live parse_prefetch (loss streak), storage/derived/raw.py (always retryable) and ingest_batch (sole = defect, shared = retryable) still differ; recorded in unresolved. Admission rule: every append_session_to_shard/prepare_session_shard site in prepared_jsonl.py (13) is preceded by the rule (grep listing checked). Active-branch leaf deciders: write.py list normalizer and sink normalizer unified; prepared_merge's own leaf choice now clears the inherited marker; parsers that set leaves (chatgpt, drive, claude common) are producer evidence and unchanged.
  • worker-contract 3: every consumer of a changed interface is updated and the predecessor deleted: _normalized_messages removed; its 2 write.py callers, 3 test references and the prepare_session_rows docstring now use normalize_active_branch (git grep _normalized_messages = 0). _ACTIVE_PARENT_LOOKUP_SQL replaced by two occurrence queries; the query-plan test checks both. whale_outbox.py deleted with cli.py drains, _WHALE_RECEIPT_ROOT, tests in test_daemon_cli.py and test_whale_outbox.py, the exclusive-create-write baseline line and docs/daemon.md (git grep = 0). ParsedMessage.active_leaf_fallback is declared in pipeline/ids.py _EXCLUDED_FIELDS (partition test passes) and serialized only in message JSON. The moved normalizer stays in prepared_message_sink.py so the closure baseline does not grow (the first attempt added a module and the schema-closure gate refused it).
  • worker-contract 4: every failure path is typed and visible: Pool start failure, submission failure, stall and worker death each yield one IngestRecordResult with outcome_code, retryable and evidence_ref (worker:pool_start:, worker:submit:, worker:progress_deadline, worker:BrokenProcessPool); validation raises instead of switching mode; occurred_at_bounds raises on an unreadable sink instead of answering None.
  • worker-contract 5: each new test fails when the behaviour it names is removed: Each new test states its anti-vacuity: restoring the inline fallback makes inline_runs non-empty and delivers raw-1 twice; charging every break as a defect turns the shared-death raws non-retryable, treating every break as transient turns the sole-death raw retryable; dropping refuse_remaining loses raw-3; reading messages first makes visits 3000 and decodes 4; by-id marking or last-occurrence parent lookup changes the dup and nearest-earlier paths; dropping the marker flips both explicit False paths on the second pass; copying the revision marker in the merge leaves the cohort paths False; the kill test's DUPLICATE-with-3-rows outcome is the b8of0 regression.
  • worker-contract 6: no secret, private path or personal data: Fixtures are synthetic (neutral ids, texts and /tmp paths); the only absolute paths in this result are the batch worktree and its receipts. The pre-commit secret-scan flagged a candidate span in revision_backfill.py's staged content; the diff there is a 3-line comment and parameter rename with no credential-shaped text.
  • review guide 1: siblings and owners: The admission rule's owner for sealed carriers is prepare_jsonl_blob; in-process parse routes still own their own call and are listed in unresolved. The active-branch meaning has one home (prepared_message_sink.py) with two physical forms. The worker-death classification is decided in three routes; the divergence is pre-existing and recorded rather than widened.
  • review guide 2: the fix itself: Review found and fixed defects inside the fixes: the marker write was also applied to attachment JSON (mypy caught it); cohorts were first keyed by id() of a pool that could be collected and reused; a TypeError at submission was first classified retryable (endless retry); the merge copied a revision's marker onto the cohort. BrokenExecutor is a RuntimeError subclass, so the retryable test covers both.
  • review guide 3: memory and limits: No cap or timeout added. The coordinator's refusal queue is a deque bounded by the chunk. The disk walk uses a temp table and per-row seeks, not a fetchall; occurred_at_bounds is one aggregate query. positions_by_id holds ints for a list that is already resident.
  • review guide 4: cost per unit: The chain walk is one indexed lookup per chain step (EXPLAIN QUERY PLAN test covers both queries); bounds replace a Python decode per message with one SQL aggregate; the producer-pair short-circuit removes a traversal entirely.
  • review guide 5: interruption: The stall branch terminates the pool as before and now also settles unsubmitted raws; the kill-recovery tests prove a SIGKILL inside the index write loses and duplicates nothing.
  • review guide 6: ordering and races: occurred_at_bounds reads current rows, so an unsealed sink edited after a call reports its new timeline (tested); sealed sinks are immutable. Pool replacement happens only for a raw whose submit raised, so no accepted raw is resubmitted.
  • review guide 7: failure classification: Shared worker death and a shut-down or broken pool are retryable; a sole worker death and a deterministic submission refusal are parser defects so they are not retried forever.
  • review guide 8: silent outcomes: Every raw of a chunk now yields exactly one result, including unsubmitted raws after a stall and every raw when the pool cannot start.
  • review guide 9: cleanup on failure: A replaced broken pool is shut down; the current pool is shut down in finally; the new tests close their stores.
  • review guide 10: identity and keys: active_leaf_fallback, is_active_leaf and is_active_path are excluded from the semantic hash; message and block ids do not depend on them. Changed files in the derived-identity closure, which must land before a rebuild: polylogue/core/timestamp_authority.py, polylogue/pipeline/ids.py, polylogue/sources/dispatch.py, polylogue/sources/live/batch.py, polylogue/sources/parsers/base_models.py, polylogue/sources/prepared_jsonl.py, polylogue/sources/prepared_merge.py, polylogue/sources/prepared_message_sink.py, polylogue/sources/revision_backfill.py, polylogue/storage/sqlite/archive_tiers/write.py (membership read from docs/plans/schema-closure-baseline.json; gate schema-closure ok, no new members).
  • review guide 11: lossless transforms: Lowering updates only leaf, marker and path fields and is idempotent; the merge clears only the marker with the leaf flag; timestamps keep precedence, one-sided and inverted handling (parametrized test).
  • review guide 12: degenerate inputs: Empty sessions return unchanged; a producer leaf without a provider id infers no path; a parent cycle ends the walk (tested); zero raws and worker_count below one are handled by max(1, ...).
  • review guide 13: consumers: Covered under worker-contract 3.
  • review guide 14: tests and stubs: monkeypatch targets follow the renames (write.normalize_active_branch); removed _drain_whale_receipt_outbox patches; the query-plan test imports the new constants; the stale Grok no-callback test now asserts the admission owner's refusal.
  • N/A review guide 15: trust boundaries: No argv, credential, file-permission or ownership handling is touched.
  • nested AGENTS (daemon, sources, storage) code review rules: No timeout that abandons progressing work is added; no live-archive write outside the writer route; no pre-acquisition exclusion predicate; no DDL, CHECK, migration or embeddings change; no rebuildable state used as durable authority.

polylogue-s8x8s: 3 pass(es) against docs/review/codex-review-guide.md, polylogue/sources/AGENTS.md (Code Review Rules), /realm/project/sinnix/dots/_ai/skills/orchestrate/references/worker-contract.md

  • worker-contract 1: each criterion met on the production path: AC2 goes through the production route: dispatch.parse_stream_payload -> codex.parse_stream -> _parse_records -> _CodexLookaheadIndex.retain_records. The new tests call parse_stream (the same entry dispatch uses), and the whale tests call parse_stream_payload itself. AC1 throughput, AC4 and addendum 4 are operational and unmet; the blocker is the polylogue-hqha5 finished-build measurement.
  • worker-contract 2 / guide 1: siblings of the defect class: Searched for other per-record pickle spools in the parsers: grep 'pickle.dumps(record|spool' polylogue/sources/parsers/*.py outside codex.py finds only Hermes durable-spool prose, so there is no sibling record spool. Inside codex.py, spool_records has one caller, the new retain_records spill (grep count 2: definition and call). The Sequence route in _parse_records was already in-memory.
  • guide 2: the fix itself: Found in pass 1: the local name 'retained' in _parse_records collided with the world_state branch's dict local (mypy, job 3106). Renamed it to in_memory (commit 65afa93). _retained_record_bytes is iterative, so deep nesting cannot raise RecursionError, and a seen-set guards cycles. _drain yields in order while releasing memory. An exception from the source iterator propagates exactly as it did before.
  • guide 3: memory and limits: The in-memory tier holds at most 8 MiB of estimated retained bytes plus the one record that crosses the budget; everything above that spills to the same disk index as before. The budget chooses a storage tier and never refuses or truncates input. Traced-peak controls pass: 40 MB bound at 120,000 records, and the peak does not grow with 10x the records (job 3172).
  • guide 4: cost per unit: The size walk costs O(nodes) per record and runs only until the spill; after the spill it stops. A stdlib microbenchmark on 10 MB of Codex-shaped records measured about 26 ms for the walk against about 38 ms for pickle-dump plus two unpickle passes plus the SQLite inserts. That is host-local and illustrative only; whale attribution belongs to polylogue-hqha5.
  • guide 5/6: interruption, ordering and races: This is a pure in-process transform. The scratch SQLite connection is still closed by contextlib.closing on every exit. Record order is preserved on both tiers and across the spill boundary (spill-midstream test).
  • N/A guide 7/8/9: failure classification, silent outcomes, cleanup: N/A: the change adds no except clause, skip or acquired resource. Admission accounting is unchanged: every record is still replayed, and conservation holds in the whale dispatch tests.
  • guide 10/11: identity and lossless transforms: The parse result is identical across tiers: the prefix test compares the full ParsedSession to parse(list) for every prefix on all three tiers, with lookahead-dependent records (repeated code-mode call ids, compaction, task_complete). codex.py is in the derived schema-identity closure (the schema-closure gate passed), so this must land before a rebuild starts.
  • guide 12: degenerate inputs: An empty stream returns [] and takes the Sequence route. A budget of 0 spills at the first record (spill-first case). A single oversized nested record spills (the nested-payload test).
  • guide 13 / worker-contract 3: consumers and predecessor: No interface changed. The always-spool call is replaced, not kept beside the new path. The whale-test comment and docstring that described disk-only retention now describe the budgeted tier (tests/unit/sources/test_codex_whale_fixtures.py:56-59, :107-108). grep 'spool|codex_records' docs finds nothing to update.
  • guide 14 / worker-contract 5: tests fail when behavior is removed: The memory tier goes red if streams are always spooled (the spy records a spool). Spill-midstream goes red if the retained head is dropped or reordered on spill (parse or spool mismatch). The nested test goes red if the estimate is shallow sys.getsizeof(record) (nothing spools under 16 KiB). The ordinal test goes red if next_ordinal reads _outcomes or _materialized runs. These red cases come from reading the code; the mutations were not executed.
  • guide 15 / worker-contract 6: trust boundary, secrets, private data: Fixtures are synthetic (replay-tier, nested, future_record_kind). The diff and this result hold no private paths or data; the paths cited are repository paths and the worktree receipt paths.

polylogue-aar35: 2 pass(es) against docs/review/codex-review-guide.md, polylogue/daemon/AGENTS.md and polylogue/sources/AGENTS.md Code Review Rules, orchestrate worker-contract generic list

  • Guide 1: siblings and owners: Pass 1 found that three places read HERMES_HOME: resolve_runtime_config, paths.hermes_sessions_path, and agent_integration/installer.py. They disagreed on a blank value (the installer turned it into Path('')). Fixed in 2a2b8c5: hermes_home() in paths/_roots.py is now the only reader (git grep HERMES_HOME -- polylogue shows only its docstring and body, plus docs and comments). Pass 1 also found a missed caller: test_hook_producer.py still monkeypatched the removed configured_provider; fixed in 7ee3f4b. Sweeps for every removed name (browser_capture_spool_path, hermes_root key, hook_sidecar_dir, hook_provider, drivepath keys, antigravity_language_server, their POLYLOGUE env vars, spool-path, --spool, WantedSource*/wanted-source) across the repo except CHANGELOG found only the canonical path helpers and the new refusal test.
  • Guide 2: the fix itself: The component_started lifecycle event used to read server.config.spool_path, which test fakes do not have, and 7 daemon tests failed on it. It now reads browser_capture_spool_root(), the same value make_server defaults to (polylogue/daemon/cli.py, the enable_browser_capture block). build_daemon_status's unknown-enabled default is still True: the removed spool expression could never be None, so it was always True before. Drive auth errors are still typed DriveAuthError, and their messages now name the canonical paths.
  • N/A Guide 3: memory and limits: N/A: the diff only deletes code or removes parameters. It adds no reads, buffers or caps. The one new probe is a single is_file() on the /usr/share path.
  • N/A Guide 4: cost per unit: N/A: no per-item work was added. discover_language_server gains one stat before the Nix-store scan.
  • N/A Guide 5: interruption: N/A: no loops, waits or multi-step state changes were added. The cold build's begin() only loses a validation read that ran before any generation was created.
  • N/A Guide 6: ordering and races: N/A: no check-then-use sequence was introduced. The spool and hook roots are now fixed at the archive root, so they cannot diverge between the receiver, the watcher and status.
  • Guide 7: failure classification: A removed key in polylogue.toml now fails the load with the existing typed ConfigError that names the key or its undeclared table. test_removed_path_override_is_refused (tests/unit/core/test_config_inventory.py) asserts the refusal text for all 7 TOML paths. The removed env vars are simply no longer read, because nothing declares them.
  • Guide 8: silent outcomes: polylogued status now always probes the live daemon first; before, the removed --spool flag forced a local recompute. The browser_capture status payload leaves out spool_path, as the default route already did. Nothing is skipped without a disposition.
  • N/A Guide 9: cleanup on failure: N/A: nothing is acquired on a new path. dev_loop_service no longer creates an artifact-root spool directory it had passed through --spool.
  • Guide 10: identity and keys: No hash or ID formula changed. source_manifest_continuity.py is in the derived-identity closure (docs/plans/schema-closure-baseline.json). Editing it and cold_build.py can move the candidate derived identity, so this must land before a rebuild starts. The schema-closure gate passed on 2a2b8c5.
  • N/A Guide 11: lossless transforms: N/A: no copy, replay or regeneration path changed.
  • Guide 12: degenerate inputs: A blank or unset HERMES_HOME falls back to /.hermes in hermes_home(). A missing /usr/share binary falls through to the Nix-store scan. An empty [sources] table is still refused by _undeclared_toml_keys, whose existing semantics report an undeclared table by name.
  • Guide 13: consumers: Updated every consumer: config inventory and defaults; resolve_runtime_config; polylogued run/status and browser-capture status/serve/action --spool; run_daemon_services and the writer-lease helper; configure_runtime_components; build_daemon_status and daemon_status_payload; daemon_watch_sources; watched_source_presence; status diagnostics; init; drive auth; the three hook carriers (hook_producer, packaging/polylogue-hooks, contrib/polylogue-hook); nix/lib/settings.nix spool-path; devtools dev_loop_service and isolated_environment; docs (configuration, daemon, hooks, hermes-operators, architecture, maintenance); and tests. One consumer is outside this repository: sinnix flake/overlay/package/polylogue-status-document.patch patches the old status_command spool plumbing. It is recorded in unresolved because this worker may not write there.
  • Guide 14: tests and stubs: Removed tests that exercised only the deleted behaviour (receipt round-trip, tampering, preflight, spool override, env and TOML overrides, --spool local answer). Converted the same-byte-replacement test to build_source_frontier. New tests and what turns each red: test_removed_path_override_is_refused (declaring a key again), test_detect_chat_sources_reads_hermes_home and test_hermes_root_is_hermes_home (ignoring HERMES_HOME), test_discover_language_server_finds_the_system_install (dropping the /usr/share probe), test_a_pending_capture_in_the_archive_spool_is_a_source (dropping the archive spool from the watch set). conftest now scrubs HERMES_HOME, so host state cannot leak into tests.
  • N/A Guide 15: trust boundaries: N/A: no secret handling changed. The Drive token and credential files keep their XDG locations and existing modes.
  • N/A Daemon AGENTS: timeouts and writer route: N/A: no timeout or archive mutation was added. The daemon only lost a parameter.
  • N/A Sources AGENTS: parser fields, detector tightness, pre-acquisition owner: N/A: no parser, detector or exclusion predicate changed. The antigravity edit is binary discovery only.
  • Worker 1: criteria met on the production path: Receipt machinery: the module shrank from 838 to 289 lines, and cold_build.begin() no longer reads a receipt. Overrides: each is gone from config.py (grep count 0 for every property name). The focused suite drives CLI run/status, resolve_runtime_config and discover_language_server: 1024 passed, and every one of the 10 failures reproduces on the base tree.
  • Worker 2: every site of the defect class: Same as guide item 1: one repo-wide git grep per removed name and env var. The installer's HERMES_HOME reader and the stale test monkeypatch were the only siblings found, and both are fixed.
  • Worker 3: predecessor deleted with callers, tests, docs: The receipt API, its tests and its doc sentence are deleted. So are the override keys, env vars, CLI options, nix option, docs rows and tests. No alias or fallback remains: a removed key is refused, not ignored.
  • Worker 4: failure paths typed and visible: A removed key raises ConfigError. Missing Drive files raise DriveAuthError naming the canonical path. An undiscoverable language server keeps its existing None route into AntigravityExportError.
  • Worker 5: each new test fails when its behaviour is removed: See guide item 14. Each new test's docstring names the change that turns it red.
  • Worker 6: no secrets or private paths: Fixtures use tmp_path and synthetic values. The only literal paths are the public vendor install path /usr/share/antigravity/... and the public /nix/store.

polylogue-5hcbg: 2 pass(es) against docs/review/codex-review-guide.md (checklist items 1-15, Compatibility, Limits, Do not flag), orchestrate worker-contract generic list (items 1-6), polylogue/daemon/AGENTS.md Code Review Rules

  • Guide 1 / contract 2: siblings and owners: The only production promotion of a cold-build candidate is ColdBuildGeneration.promote, called only from settle_cold_build in polylogue/daemon/cli.py (grep '_store.promote|store.promote(' finds one call site, cold_build.py:1046; grep 'generation.promote' finds only daemon/cli.py). That call now goes through promote_cold_build_covering_active_index, so every production promotion is covered; reconcile_promoted and reconcile_interrupted_promotions finish an already-swapped pointer and have nothing to compare. The retention predicate reuses the raw_sessions row, the same retention statement production_baseline.verify reads; no second classifier of 'retained' was added.
  • Guide 2: the fix itself (new exception reaches every caller): ColdBuildCoverageError is raised inside the settle try block and classified in classify_cold_build_settlement_failure (operations/intake_adapters.py) as ('active_coverage_incomplete', False), so the existing blocked path records it, emits daemon.cold_build.settlement, and retries only when settlement_evidence_revision changes (candidate index stat or source evidence). No other caller invokes the wrapper. A first draft put the check inside cold_build.py; devtools schema closure reported that file IN the index identity closure and a base/head identity computation showed the index identity moving (3010010c... to a9d7e842...). I moved the check to polylogue/operations/cold_build_coverage.py (closure: out) and restored cold_build.py to its base bytes; head identity is again 3010010c..., ops b3d33f04... unchanged.
  • Guide 3: memory and limits: The comparison pages the active sessions table by keyset (session_id > ? ORDER BY session_id LIMIT 512); per page it holds at most 512 rows plus two sets of the same size. Only two integers and one id grow across pages. The 512 is a paging size, not a cap: every active session is compared. No outcome-changing limit or timeout was added.
  • Guide 4: cost per unit: Keyset paging on the UNIQUE session_id, not OFFSET; three indexed queries per 512 sessions (sessions page, raw_sessions IN on its primary key, candidate sessions IN on UNIQUE session_id). The active pages come from one snapshot (explicit BEGIN on the read connection). The candidate and source.db are read inside the same writer-coordinator call, so no daemon write lands between pages.
  • Guide 5: interruption: The comparison is a read-only loop inside one write_coordinator.run_sync call, like the readiness pass beside it; it mutates nothing, so a cancel, kill, or restart mid-loop leaves nothing to clean up, and the next settle recomputes it. It does not poll cancellation; its cost is bounded by the active session count at three indexed queries per page.
  • Guide 6: ordering and races: Check and promotion run in one writer call (promote_cold_build_covering_active_index), so no daemon write lands between them. Residual: an external CLI writer is not excluded by the process-local lease (AGENTS.md Runtime), so a session written straight to the active index after the comparison and before the pointer swap is outside this check. That window is the same one the existing baseline verify has. Recorded in unresolved.
  • Guide 7: failure classification: The coverage refusal is deterministic and classified as non-retryable blocked, re-evaluated only on changed evidence, not retried on a timer. Read faults from the three connections are sqlite3 errors that the existing classifier maps (BUSY to sqlite_busy retryable, CANTOPEN to sqlite_open_unavailable retryable); none is turned into a negative answer. The refusal is recorded in settlement status with reason active_coverage_incomplete and emitted as daemon.cold_build.coverage_refused with registered fields (reason, generation_id, sessions).
  • Guide 8: silent outcomes: The check decides a refusal and nothing is skipped. Active sessions whose raw_id is NULL or no longer in raw_sessions are deliberately not coverage obligations, because no durable evidence remains that any build could replay, and rebuildable state is never the authority. The require_active_coverage docstring states this rule. The settle outcome stays 'blocked' with a named reason, never 'complete', while coverage is missing.
  • Guide 9: cleanup on failure: All three read connections are opened under contextlib.closing in one with-statement and close on every exit path. The refusal acquires nothing: no pointer change, no receipt write, no capacity observation (those run inside promote, after the check). An unsettled candidate is still discarded at daemon shutdown by the existing path.
  • Guide 10: identity and keys: Coverage is keyed by sessions.session_id, the generated origin:native_id column. It stays stable across raw revisions, so a candidate that accepted a newer revision of the same source still covers the session. No hash, ID formula, or receipt key changed.
  • N/A Guide 11: lossless transforms: N/A: the change copies, replays, and regenerates nothing. It only reads and refuses.
  • Guide 12: degenerate inputs: Missing active index: return. Empty active (the automatic fresh-root build): the first page is empty and it passes; the other running-daemon cold-build tests, which promote on a fresh root, stay green. The pointer already resolving to the candidate, or generation.promoted: return, and promote finishes the interrupted publication. A page with no retained raws: skipped with continue. raw_ids is never empty when rows is non-empty, so there is never an empty IN ().
  • Guide 13 / contract 3: consumers: The new names are exported through operations/intake_adapters.all and the daemon seam daemon/intake_adapters.all, and daemon/cli.py imports them from that seam as it does its other cold-build names. ColdBuildGeneration.promote's signature is unchanged, so tests calling or patching it still apply. docs/maintenance.md (cold build source baseline section) documents the refusal and its reason token. No CLI option, config key, schema, or generated reference changed. The --cold-build-index help text still describes promotion accurately.
  • Guide 14 / contract 5: tests fail when the behaviour is removed: test_explicit_cold_build_keeps_sessions_the_active_index_serves drives the real run_daemon_services with cold_build_index=True over an active index holding a session whose raw is retained but whose file was deleted outside the watched root. Red proof, run twice: with the check call removed (first in cold_build.promote, job 3186; then in promote_cold_build_covering_active_index, job 3213) the [False] case fails at the active-still-serves assertion (test_daemon_cli.py:4122), because the promoted candidate lost codex-session:cold-imported. The [True] case proves there is no false refusal when coverage is complete. The classifier test pins the typed mapping.
  • Guide 15 / contract 6: trust boundaries, secrets and private data: Fixtures are synthetic Codex JSONL under tmp_path. The error text carries only a count and one synthetic-origin session id. The diff holds no operator paths, archives, or secrets.
  • Contract 1: criterion met on the production path: The acceptance route is the production daemon cold build: the explicit flag, fair intake into the candidate, settle_cold_build, and promotion or refusal. Evidence: job 3223 (58 passed at f544fc6), including both parametrizations of the new daemon test, plus the two red runs above.
  • Compatibility, Limits, and daemon/AGENTS.md rules: The diff has no shim, alias, or dual path. settle_cold_build now calls the wrapper instead of generation.promote, and the direct call is gone. No cap or timeout was added. The comparison runs inside the daemon's single writer route (write_coordinator.run_sync), so it needs no declared_unguarded_write, and it abandons no in-progress work.

polylogue-8j9rh: 2 pass(es) against docs/review/codex-review-guide.md, worker-contract generic list (/realm/project/sinnix/dots/_ai/skills/orchestrate/references/worker-contract.md)

  • Guide 1: Siblings and owners: Every excision route resolves targets through resolve_session_excision_target (grep of resolve/apply/plan_session_excision outside excision.py: CLI excise.py, operations/mutation_actuators.py, security/lifecycle.py, all via plan/apply_session_excision), so the sidecar reach covers CLI, daemon actuator, lifecycle and cascade members alike. Ownership duplicates a decision the joins own (sources/live/tool_result_sidecars.join_from_index, prepared_message_sink.GeminiToolOutputIndex.join); pass 1 found my first predicate diverged from them: it read only matched events, so an owned but refused file (size_exceeded, read_error, value-bound, less-complete) with a pointer-only name stayed behind. Fixed by reading the joins' own recorded outcome: every sidecar event of the session names an owned file except no_owning* debt, the joins' single ownerless reason (both literals checked). The exact-stem rule is kept for files the join never recorded. Sidecar modules are in the derived-identity closure (docs/plans/schema-closure-baseline.json:338,345,348,384), so I kept the rule in security/excision.py (not in the closure) and did not touch them; schema-closure gate ok.
  • Guide 2: The fix itself: Resolution is read-only and adds no exception type: a corrupt session_events payload raises from json.loads and the excision refuses before any tier is touched, same as other index reads. Pass 1 found a mypy error from reusing the name directory (Path|None vs str) in _gemini_owned_sidecar_raw_ids; renamed to scope_directory. A retry after an interrupted apply re-resolves: already-deleted sidecar raws are simply absent, so it is idempotent. Sidecar raws carry per-raw pending logical keys (source_write.pending_raw_logical_source_key), so seeding them into _durable_revision_closure does not widen to other files.
  • Guide 3: Memory and limits: Pass 1 found the first gemini resolver fetchall'd every retained path under the project's tool-outputs/, which grows with the project. Replaced by deriving candidates from the chat identity's colon prefixes (at most a few range queries) and made the scope query iterate its cursor. Remaining fetchalls are bounded by one session (its tool_result tool ids, its sidecar events, its transcript paths), the same bound as the existing block_ids read. No cap or truncation added.
  • Guide 4: Cost per unit: Per transcript path one indexed range query on raw_sessions.source_path (idx_raw_sessions_source_path, source.py:457), using a half-open range rather than LIKE so the index stays usable; paths are deduplicated across revisions. One extra bounded revision-closure call per resolution. Cost is per excised session, not per archive.
  • N/A Guide 5: Interruption: N/A: the change adds reads to the up-front resolution only; the apply's per-tier transactions, ordering and receipt logic are unchanged.
  • Guide 6: Ordering and races: apply_session_excision already resolves under exclude_archive_blob_publishers; sidecar raws are resolved in the same source read as the other raw targets, so they share that exclusion. The dry-run/apply gap is the existing contract for every raw class.
  • Guide 7: Failure classification: No except clause added (grep of the diff for 'except': 0). Query failures propagate and the resolve refuses.
  • Guide 8: Silent outcomes: Owned files that ended as refused debt were a silent residual in pass 1 (fixed, see item 1). Files no transcript claims (no_owning_* debt, e.g. an orphan in tool-results/) are deliberately kept, stated in the module docstring and docs/security.md, and pinned by the subagent and gemini tests; whether the receipt should name them is listed in unresolved. The plan and receipt count the reach as source_sidecar_rows.
  • N/A Guide 9: Cleanup on failure: N/A: nothing is acquired; resolution only reads.
  • Guide 10: Identity and keys: No hashed field, ID formula or key changes. Filenames are compared exactly as RetainedSidecarFile.filename derives them (Path(source_path).name), and the stem uses the join's own rsplit('.', 1).
  • N/A Guide 11: Lossless transforms: N/A: no copy, replay or regeneration path changed.
  • Guide 12: Degenerate inputs: Empty ownership skips the scan; session id without a native part, no transcript raws, or a session missing from the index yields no sidecars; a filename without an extension uses the whole name, as the join does; a gemini native id always has two colons (gemini_cli_chat_identity), and a candidate that is not one path component is refused by resolve_tool_outputs_dir.
  • Guide 13: Consumers: New ExcisionTarget.sidecar_raw_ids and ExcisionPlan.source_sidecar_rows (keyword-only construction, grep 'ExcisionPlan(' / 'ExcisionTarget(': only excision.py), plan.as_dict key, receipt counts key, CLI preview line (cli/commands/excise.py), docs/security.md section. No exact-key-set assertions on plan or counts exist in tests (grep). No predecessor to delete: the strict xfail marker is removed.
  • Guide 14: Tests and stubs: All four sidecar tests drive LiveBatchProcessor acquisition and apply_session_excision. Red conditions: dropping the sidecar seed fails test_excising_a_forgets_the_tool_output_only_it_had (A-only raw retained, hash unmarked); owns() returning true fails test_excising_a_parent_keeps_its_subagents_sidecar (subagent raw removed); ignoring sidecar events fails it too (the parent sidecar b7x3kq.txt is pointer-named, not stem-named); dropping the gemini branch fails test_excising_a_gemini_chat_forgets_its_tool_output_sidecar (slug-named file only the event names). No monkeypatch targets touched.
  • Guide 15: Trust boundaries: Paths and filenames come from source.db and index.db and are used only in bound SQL parameters and comparisons; gemini candidates pass resolve_tool_outputs_dir's single-component check. No secrets or logging added.
  • Contract 1: criteria met on the production path: Each acceptance clause is exercised through production acquisition and apply_session_excision (job 3162, 89/89 passed at d69c649); see the bead criteria.
  • Contract 2: defect class handled at every site: The class is tool-output sidecars no excision reach names. Sidecar artifact rules exist for exactly two origins (grep kind="tool_result_sidecar" in sources/origin_specs.py: 2 hits, Claude Code and gemini-cli); both are covered and tested. The other sidecar-bearing table, history_sidecars, has no writer in the package (grep 'INSERT INTO history_sidecars': 0) and carries no session key.
  • Contract 3: consumers updated, predecessor deleted: Same as guide item 13; the xfail and the module docstring's 'does not yet reach' text are removed.
  • Contract 4: failure paths typed and visible: No fallback or swallowed error; unclaimed files are a documented, tested decision, and the open question is in unresolved.
  • Contract 5: each new test fails when its behavior is removed: See guide item 14 for the change that turns each test red.
  • Contract 6: no secret, private path or personal data: Fixtures are synthetic (invented uuids, zz_* text, -realm-project-sub following the existing fixture pattern). Scratch output stayed in the session scratchpad and is not committed; .agentctl/ is untracked.

polylogue-b8of0: 1 pass(es) against docs/review/codex-review-guide.md, /realm/project/sinnix/dots/_ai/skills/orchestrate/references/worker-contract.md (generic list)

  • codex-review-guide 1. Siblings and owners: The defect class is a test that forces its restart deferral through a knob the product no longer reads. perf(sources): overlap parsing, decode once, never abandon preparation #5691 (b5fd10a) retired the parse-stage warm deadline, so POLYLOGUE_LIVE_WATCHER_PARSE_STAGE_WARM_TIMEOUT_SECONDS became inert, the first restart page admitted the tail, and the all-DEFERRED assertion at tests/unit/sources/test_live_ingest_kill_recovery.py:275 failed (job 3061 at base 0914f89). I checked for other sites. grep -rln 'WARM_TIMEOUT|warm_timeout|warm window' polylogue tests docs devtools finds only a prose comment at polylogue/sources/live/parse_prefetch.py:1928 and no knob. Tests set 61 distinct POLYLOGUE_* variables with setenv or delenv; 57 are read in polylogue/ or devtools/. POLYLOGUE_LIFECYCLE_RECEIPT_DIR is read by tests/infra/daemon_service_harness.py:29, and the POLYLOGUE_TEST_* pair is forged input in a devtools test. That leaves POLYLOGUE_DB_PATH as a possibly stale knob, recorded in unresolved. The diff adds no product predicate. It reuses the deferral producer that remains (a failing live_parse_path_worker fills preparation_deferred and _defer_full_cursor_retry, polylogue/sources/live/batch.py:1792-1800), and tests/unit/sources/test_live_watcher_parse_stage_equivalence.py:877 and :929 drive the same producer.
  • codex-review-guide 2. The fix itself: The failing worker is installed with monkeypatch and restored explicitly before the final admission, so the watcher's own process stage prepares the tail and pytest teardown restores the patch again. The injected thread LiveParseStage is shut down in a finally block. LiveWatcher does not own an injected stage (watcher.py:394 _owns_parse_stage = parse_stage is None), so watcher.stop() leaves it alone and the test shuts it down. The new parse_stage keyword on _admit_pages defaults to None, which keeps the existing callers (_admit, the first-ingest test) on the production default stage.
  • N/A codex-review-guide 3. Memory and limits: N/A: the diff changes only test code and adds no read, cache, buffer, cap or timeout.
  • N/A codex-review-guide 4. Cost per unit: N/A: no product code changed. The test still offers three restart pages, as before.
  • codex-review-guide 5. Interruption: This is the subject of the test. A child SIGKILLed right after revision_governance._write_parsed_precedence_result returns for the append is followed by restart pages whose preparation defers. The test asserts the index still holds (3, 3, 1) and that no page reports DUPLICATE, then that the due retry materializes (6, 6, 1) with no parse errors (job 3091 passed).
  • codex-review-guide 6. Ordering and races: The thread stage uses max_workers=1, and three pages are offered sequentially on one watcher. The retry is made due only after the pages, with the delay set to 0 and defer_full_cursor_reconciliation called, as before. The diff adds no new concurrency.
  • codex-review-guide 7. Failure classification: The synthetic RuntimeError from the worker is the retryable worker-loss class. The product defers it without spending the cursor failure budget (test_deferred_preparation_does_not_spend_cursor_failure_budget), and the restart pages report DEFERRED, which the test now proves again.
  • codex-review-guide 8. Silent outcomes: This is criterion no-false-duplicate. Every restart page item carries a typed DEFERRED outcome, 'source retry pending', from FileIntakeAdapter (polylogue/operations/intake_adapters.py:853-860). A mutation run proves the test catches a silent acknowledgement: with classify_ingest_candidates returning needed, () (watcher.py:592), job 3108 failed at the DEFERRED assertion (test_live_ingest_kill_recovery.py:299) and two restart pages reported DUPLICATE.
  • codex-review-guide 9. Cleanup on failure: stage.shutdown() runs in a finally block even when a restart page raises. The parse-shard scratch directory is under the test's state_dir (workspace_env), which pytest removes.
  • N/A codex-review-guide 10. Identity and keys: N/A: no hash, ID or key changed.
  • N/A codex-review-guide 11. Lossless transforms: N/A: no copy, replay or regeneration path changed.
  • N/A codex-review-guide 12. Degenerate inputs: N/A: the fixture keeps the same six synthetic messages and adds no new input shape.
  • codex-review-guide 13. Consumers: The only interface change is an optional parse_stage keyword on the test-local helper _admit_pages. grep -n '_admit_pages(' tests/unit/sources/test_live_ingest_kill_recovery.py shows its three sites (definition, _admit, the append test), and each is consistent. The retired env knob has no remaining reader or setter anywhere, per the item 1 grep.
  • codex-review-guide 14. Tests and stubs: The monkeypatch target, parse_prefetch.live_parse_path_worker, is the name LiveParseStage resolves when it submits (parse_prefetch.py:1221), so the patch reaches the worker. The test drives the production route: FileIntakeAdapter.admit_page over LiveWatcher with open_operation_read. The only substitute is a thread stage in place of the process stage, which the product supports (use_processes=False). Anti-vacuity: at base the stale knob made the test fail (job 3061), and after the change the pending-retry mutation makes it fail (job 3108).
  • N/A codex-review-guide 15. Trust boundaries: N/A: the change handles no secrets, credentials or file permissions.
  • worker-contract 1. Criteria met on the production path: append-kill: job 3091 at 1b525da passed 2/2, including test_sigkill_inside_an_append_index_write_recovers_exactly, which asserts (6, 6, 1) and no parse errors through FileIntakeAdapter. no-false-duplicate: the same test asserts all restart pages are DEFERRED while the retry is pending, and the mutation probe (job 3108) shows it fails when that is removed. The cold-build clause rests on code reading: cold-build suspension applies only to RawMaterializationIntakeAdapter (intake_adapters.py:1385, wired at daemon/cli.py:3071), and FileIntakeAdapter has no suspension hook. No test runs this kill under an unsettled cold build; that is recorded in unresolved.
  • worker-contract 2. Defect class handled at every site: See review-guide item 1 for both greps (retired-knob references: 0 in tests and product; tests' POLYLOGUE_* variables: 61 total, 1 possibly stale variable recorded as unrelated).
  • worker-contract 3. Consumers updated, predecessor deleted: The retired knob's last test use is removed. The product had already deleted it in perf(sources): overlap parsing, decode once, never abandon preparation #5691, and no fallback or dual path was added.
  • worker-contract 4. Failure paths typed and visible: Restart pages must report the typed DEFERRED outcome, and a silent DUPLICATE fails the test (job 3108).
  • worker-contract 5. New tests fail when behavior is removed: Removing the pending-retry split in classify_ingest_candidates (returning needed, () at polylogue/sources/live/watcher.py:592) turns the test red at test_live_ingest_kill_recovery.py:299, with DUPLICATE outcomes (job 3108; the mutation was reverted, and git status --short is clean). Removing idempotent message identity or the retry's materialization would turn the (6, 6, 1) assertion red.
  • worker-contract 6. No secrets or private data: The diff touches only a synthetic test. The narration contains worktree paths and job IDs but no operator data.

Sinity and others added 30 commits September 29, 2026 15:02
The cold build's own source-baseline.json owns the rebuild denominator.
Remove WantedSourcePolicy, WantedSourceReceipt, RebuildPreflightReceipt,
their build/write/load/preflight functions, the cold build's
published-receipt validation, and their tests and docs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
A streamed Codex rollout is walked twice (lookahead, then materialization).
Every streamed input was pickled into the parse's scratch SQLite index and
unpickled on each pass. Streams whose decoded records fit an 8 MiB retained
byte estimate now replay from a list; a larger stream spills every record,
the retained head first, to the same index as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
The append-kill regression test forced its restart deferral with
POLYLOGUE_LIVE_WATCHER_PARSE_STAGE_WARM_TIMEOUT_SECONDS. #5691 retired the
warm deadline, so the knob does nothing, the first restart page admits the
tail, and the test's all-DEFERRED assertion fails. Force the deferral with
a failing preparation worker instead, the event that still schedules a
retry, so the no-false-DUPLICATE check keeps exercising a pending retry.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
An explicit --cold-build-index build promoted once its source baseline was
retained, so a session the active index served from a retained raw outside
the baseline (a manual import, a deleted transcript) vanished from every
read. Promotion now compares the candidate with the active generation and
refuses with ColdBuildCoverageError, a blocked settlement reason
active_coverage_incomplete, leaving the active generation serving.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Session excision now resolves the Claude Code tool-results/ and gemini-cli
tool-outputs/session-<id>/ sidecar raws a session owns (by the join's own
rules: tool_result tool_id stem or a matched sidecar event filename) from
each transcript's retained source_path, and seeds every retained revision
into the revision closure. Files a sibling transcript owns, and files no
transcript claimed, stay. Plan and receipt count source_sidecar_rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
mypy rejected reusing `retained` in _parse_records, where a world_state
branch binds the same name to a dict. The whale retention docstrings now
describe the budgeted in-memory tier and its disk spill.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…hunk inline

A submission fault after a delivered pool result replayed the whole chunk
in-process (pool:1, inline:1, inline:2, inline:3) and ran forced-process
work in the coordinator. A pool that cannot accept a raw now yields a typed
retryable result for that raw; a broken pool is replaced for raws it never
accepted; a worker death is retryable instead of a parser defect; a stall
refuses unsubmitted raws instead of dropping them. Validation keeps its
chosen process mode instead of falling back inline.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Remove hermes_root, browser_capture_spool_path (and every --spool
option), hook_sidecar_dir, hook_provider, drive_credentials_path,
drive_token_path and antigravity_language_server with their env vars,
nix option, callers, tests and docs. Hermes resolves from its own
HERMES_HOME; the capture and hook spools live under the archive root;
Drive files sit at their XDG locations; the language server is found
on PATH, in the vendor's /usr/share install, or in the Nix store. The
config loader refuses each removed key.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Two valid producer endpoints decide the session pair, so the messages are
no longer traversed first. A disk-backed prepared session answers its
occurred_at extrema from its stored rows instead of decoding every message;
the answer is read from the rows as they are, so a changed timeline still
changes the derived pair.

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

Owned-file debt events (oversize, unreadable, less complete than inline)
name sidecars the join resolved to the transcript, so excision claims them;
only no_owning_* debt is ownerless. The gemini-cli scope directory is now
derived from the chat identity's sessionId prefix instead of scanning the
project's tool-outputs, and the scope query streams. Fixes a mypy
reassignment of the directory variable. Tests now cover pointer-named and
slug-named sidecars owned only through the session's sidecar events.

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

The resident and disk-backed lowerings could disagree on a leaf whose
provider id repeats, both marked every occurrence of a chain id, and a second
pass read the first pass's storage-default leaf as producer evidence and
flipped explicit path=False values. The meaning now lives in
sources/active_branch.py: the marked leaf occurrence walks each occurrence's
own parent (nearest earlier occurrence, else the last), only chain
occurrences are marked, and a storage-default leaf carries a private
active_leaf_fallback marker so lowering is idempotent.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
The append kill test forced the restart page to defer with a 1 ms parse
warm window. polylogue-slc55 removed that deadline and its setting, so the
page now prepares and admits the tail, and the test failed on its stale
premise. It now asserts the current contract: the restart admits exactly the
six messages, and a later page finds nothing owed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
The outbox had no enqueue caller: nothing wrote a whale receipt, so the
startup and periodic drains only listed an empty directory. Large inputs are
admitted by the ordinary retained-input route; the separate whale lifecycle
this outbox recorded no longer exists. The module, its drains, tests, pattern
baseline entry and daemon doc sentence go together.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
prepare_jsonl_blob admitted sessions only when a caller supplied a
callback, and its Grok and collected branches relied on the retained
finalizer to apply the rule. It now applies the positive-evidence rule on
every branch before any callback, the retained finalizer no longer repeats
it, and the rule's docstring names its owners instead of a stale caller list.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
The only ledger regression bounded traced memory, which a sum-based
next_ordinal leaves green. The new test records alternating dispositions,
then guards the recorded outcomes and materialized runs so any recount
raises, and checks conservation afterwards.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
The resident normalizer moves beside its disk form in
prepared_message_sink.py instead of a new module, so the derived-identity
closure does not grow; the fallback marker is serialized for messages only
(it was also written into attachment JSON, which has no such field).

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

sources/live/cold_build.py is in the derived index identity closure, so the
coverage check there moved the index schema identity. The check now lives in
operations/cold_build_coverage.py and the daemon settles through
promote_cold_build_covering_active_index, one writer call; cold_build.py is
back to its base content.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Source discovery, runtime config resolution and the agent-integration
installer now share hermes_home(), so a blank HERMES_HOME means the
default everywhere.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…ool alone

A broken pool fails every raw in flight. With one raw held the death is
attributable and stays a parser defect, so a deterministic kill is not
retried forever; with several it is nobody's in particular, so each is
retryable. The preparation owner seals every carrier as admitted, and the
Grok no-callback test now expects the refusal every publishing route makes.

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

A sealed revision's storage-default leaf marker was copied onto the merged
cohort's messages, so when the latest revision's leaf had been a default
the lowering treated the merge's own leaf choice as one too and inferred no
active path. The merge now clears the marker with the leaf flag.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
A submission that fails because the pool is shut down or broken leaves the
raw retryable; any other refusal (its arguments cannot reach a worker)
repeats on every pass, so it is a parser defect instead of an endless retry.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…lylogue-20260929-130016-35798596/integration

# Conflicts:
#	polylogue/sources/prepared_merge.py
#	tests/unit/sources/test_prepared_merge.py
…s' into batch/polylogue-20260929-130016-35798596/integration
…5' into batch/polylogue-20260929-130016-35798596/integration
…g' into batch/polylogue-20260929-130016-35798596/integration

# Conflicts:
#	docs/maintenance.md
…h' into batch/polylogue-20260929-130016-35798596/integration
…0' into batch/polylogue-20260929-130016-35798596/integration

# Conflicts:
#	tests/unit/sources/test_live_ingest_kill_recovery.py
@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.

@Sinity
Sinity enabled auto-merge (squash) September 29, 2026 15:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 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-29T15:17:57.425423Z b50d91c PR opened
ℹ️ 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 c950478 into master Sep 29, 2026
3 checks passed
@Sinity
Sinity deleted the batch/polylogue-20260929-130016-35798596/integration branch September 29, 2026 15:09
Sinity added a commit that referenced this pull request Sep 29, 2026
…#5846)

## Summary

The fresh build must never keep the wrong input or report a file it did
not admit. This change covers seven reindex-2026 beads, grouped by
mechanism.

| Group | Bead | Outcome |
| --- | --- | --- |
| Admission outcomes | polylogue-3p8p7 | Retained replay decodes JSONL
strictly, over the same complete-record prefix the live path worker
parses. A decode refusal settles as terminal corrupt input with a
complete census receipt. |
| Admission outcomes | polylogue-xf8qp | Corrupt and truncated captures
are settled exclusions (`corrupt_input`), not admissions. The batch
metrics, the intake adapter, canonical ingest and the attempt
disposition all agree. |
| ZIP/blob ownership | polylogue-ihq32 | One function,
`retained_blob_source_candidates`, decides which source window proves a
retained blob. Backup recoverability and raw-derivation restoration both
call it. |
| ZIP/blob ownership | polylogue-0y17g | Raw derivation restores an
absent ZIP-member blob from its container, through acquisition's ZIP
admission. |
| ZIP/blob ownership | polylogue-zrb9y | A `<container>:<member>` path
is split only at a real ZIP container, in blob integrity, archive debt,
ZIP reacquisition and backup. |
| ZIP/blob ownership | polylogue-ltj6c | One ZIP member refusal-debt
record, `<zip>:#<ordinal>:<member>` with a typed reason, for both
content-identity and foreign-origin refusals. |
| Limits | polylogue-qlvyu | The 512-per-message in-memory sandbox
attachment cap is removed. So is its sibling, the directory-asset size
refusal on the ChatGPT route. |

polylogue-5hcbg and polylogue-8j9rh were already delivered by #5834
(c950478). This PR does not touch them.

## Problem

- **3p8p7.** Replay decoded known-provider JSONL leniently
(`_parse_one_raw`, `_parse_stream_raw`, and
`prepare_retained_jsonl_artifact` without `strict_jsonl_records`). A
rebuild therefore published a session missing a malformed record that
live intake had refused. Strict decoding alone livelocked the census: a
census worker's error crossed the thread boundary as a string and was
rebuilt as `RuntimeError`, which recorded a `failed` receipt, and
`uncensused_historical_revision_raw_ids` re-selects failed receipts on
every pass.
- **xf8qp.** The truncated-not-growing branch of
`_ingest_full_records_archive` records `TERMINAL_CORRUPT_INPUT` but left
the path in the succeeded set. The in-writer terminal decode branch did
the same. The intake outcome was therefore `ADMITTED`, and the batch
counted the bytes as ingested. A Claude Code capture with a malformed
record also failed `claude_semantic_frontier_for_prefix`, and its cursor
write went stale every pass. That made the page `RETRYABLE` forever,
reproduced by the new adapter test.
- **ihq32 / 0y17g.** Backup (`_source_recoverability_proofs`) and raw
derivation (`direct_source_windows`) decided windows separately. Raw
derivation read no legacy-append window and no ZIP member (it refused
with `container_member`). Backup's direct-file proof read only a whole
unchanged file, capped at `MAX_UNCOMPRESSED_SIZE` (`source_too_large`).
- **zrb9y.** `blob_integrity._path_is_container_member` was `":" in
path`, and `_source_path_availability`,
`archive_debt._source_artifact_exists` and `zip_reacquisition_payload`
all fell back to a first-colon split. As a result, a deleted loose file
whose name holds a colon, with an existing directory prefix, reported
its source as available.
- **ltj6c.** Content-identity refusals were debt on the ZIP path
(`_settle_zip_member_refusals`), while foreign-origin refusals were
per-member debt. That is two authorities for one concern.
- **qlvyu.** The in-memory ChatGPT route kept 512 sandbox attachments
per message and reported the rest as degraded, although that route
already holds the whole message in memory.

## Solution

- `prepared_jsonl.terminal_decode_evidence` is now the single rule for
which decode failures are terminal, shared by live intake and replay.
`batch_support.jsonl_parse_prefix_size` is the single rule for which
prefix a strict parse reads. It leaves out only an unterminated tail,
and live preparation now reads it too. Replay reads the tail without
scanning the whole blob (`jsonl_parse_prefix_size_of_handle`).
- `RetainedParseFailure` carries the decode kind across the census
worker boundary, and `PreparedRetainedInput.parser_decode_failure`
carries it for prepared inputs. `_settle_terminal_decode_refusal`
records the failure evidence, the parse-failed state and a complete
receipt. The failure artifact is not session-parsable, so
`raw_membership_census_rows` reports the raw as terminal on later
passes. The dead `prepare_retained_jsonl_carrier`, which had no caller
and carried a string error, is deleted.
- `_ArchiveFullWriteResult.settled_exclusions`,
`_FullIngestResult.settled_exclusions` and
`LiveBatchMetrics.settled_exclusion_paths` replace the `no_session*`
fields, and each exclusion carries a reason from
`SETTLED_EXCLUSION_REASONS`. A settled Claude capture with no semantic
frontier keeps its byte-prefix cursor, because its failure evidence
already forces a full replay.
- `storage/source_blob_restoration.py` owns
`retained_blob_source_candidates` and the window kinds. The kinds are
the backup proof tokens: file prefix, grown-file snapshot prefix, append
window or its observed `[0, end)` prefix, legacy append window, and ZIP
member. Backup now hashes and recovers windows by streaming. Raw
derivation stages them by streaming, and stages ZIP members through
`zip_reacquisition_payload`, keeping only byte-identical values.
`blob_integrity._current_raw_payload_bytes` and its helpers lost their
last caller and are deleted, together with their tests and the
`acquisition_boundary` allowlist entry.
- `split_zip_member_text` refuses a literal existing path. Every split
site goes through it or through `zip_member_coordinate`.
- `_record_zip_member_refusal(..., reason=, error=)` is the one debt
writer. `_reconcile_zip_member_refusals` clears stale member debt after
every completed scan, not only for bound providers.

### Derived-identity closure

These closure members change, so this PR must land before any rebuild
starts (`devtools schema closure`): `core/raw_coordinates.py`,
`sources/assembly_chatgpt.py`, `sources/live/batch.py`,
`sources/live/batch_support.py`, `sources/live/metrics.py`,
`sources/live/parse_prefetch.py`, `sources/prepared_jsonl.py`,
`sources/revision_backfill.py` and `storage/blob_integrity.py`. The
closure baseline does not grow: the schema-closure gate is ok. No DDL
changes.

## Verification

- `agentctl job start --workspace <wt> polylogue verify_quick`, job 3553
on dea458fcba: `verify: PASSED exit=0` (all static gates, including
mypy, layering and schema-closure). The pre-push `devtools verify
--quick` passed on 992dcd6, which is dea458fcba rebased onto master
c0dda6f. The rebase overlap is one non-conflicting `archive_debt.py`
label hunk.
- `agentctl job start --workspace <wt> polylogue pytest_focused -- <32
files>`, job 3554 on dea458fcba: `1435 passed, 9 failed`. The 32 files
are the new and changed tests, plus every test file of the changed
modules' routes: revision backfill, live batch and watcher, parse stage,
backup, blob integrity and conservation, raw derivation, revision
replay, ZIP addressing, ChatGPT parser and assembly, intake, canonical
ingest, and archive debt.
- The 9 failures are inherited. `pytest_focused -- --on-default-branch
<the 9 ids>` in a detached master worktree at b384edc (job 3501)
fails the same 9: `test_archive_debt` x2 (SchemaSkew),
`test_raw_observation_derivation` x4,
`test_retained_tool_output_convergence::test_gemini_full_tool_output_survives_the_loss_of_its_source_tree`,
`test_revision_replay::test_chain_replay_supersedes_equal_frontier_quarantined_membership_head`
and
`test_silent_ingest_loss::test_mid_stream_non_json_failure_raises_the_same_partial_decode_error`.
They belong to master-green.

## Self-review

Final pass (pass 3) over `git diff origin/master...HEAD`, against
`docs/review/codex-review-guide.md` and the orchestrate worker-contract
list. Pass 1 found three things, fixed before pass 2: the backup proof
must name the hashed window (the #5838 invariant my rewrite first
dropped for `[0, end)`), backup read windows into memory, and the replay
prefix scan read every blob twice. Pass 2 found the Claude stale-cursor
livelock and the directory-asset cap. Pass 3 found nothing new.

1. ✓ **Siblings and owners.** Decode terminality has one owner
(`terminal_decode_evidence`; `grep _terminal_decode_evidence polylogue`
finds 0). The strict-prefix rule has one owner,
`jsonl_parse_prefix_size`, read by the live path worker and all three
replay decode sites; `grep "_iter_json_stream("
sources/revision_backfill.py` shows only strict calls. Window choice has
one owner, used by backup and raw derivation. A grep for first-colon
splits in blob_integrity, archive_debt, zip replay and backup finds 0.
ZIP member refusal debt has one writer. ChatGPT caps: the
directory-asset refusal was a sibling and is removed. The ZIP route
keeps acquisition's ZIP admission, which is policy shared with
acquisition.
2. ✓ **The fix itself.** `_settle_terminal_decode_refusal` runs inside
the census batch transaction (`manage_transaction=not batched`).
`RetainedParseFailure` is a frozen dataclass with a `StrEnum` field, so
it is picklable. `jsonl_parse_prefix_size_of_handle` was checked against
`jsonl_complete_prefix` over 111,972 generated payloads and chunk sizes,
and agrees on every one up to trailing whitespace (probe script, not
committed).
3. ✓ **Memory and limits.** The sandbox cap and the directory-asset size
cap are gone. Backup windows are hashed and recovered by streaming,
which removes the `source_too_large` cap on direct files. The tail read
holds only the final line plus one chunk, and trailing whitespace is
dropped as it is read. No cap or timeout was added.
4. ✓ **Cost per unit.** Replay's prefix decision reads only the file
tail, not a second full pass. The legacy-append predecessor lookup runs
only for legacy rows and uses `idx_raw_sessions_source_path`.
5. ✓ **Interruption.** Raw-derivation staging still polls
`compute_cancel_requested`, and a cancelled stage discards its staged
blobs, as before. Census settlement commits at the existing unit
boundary.
6. ✓ **Ordering and races.** A source that changes between the window
hash and backup recovery fails `stage_exact_blob`'s digest check and
becomes `inexact_payload`. Raw restoration stages only exact digests,
and the writer publishes them.
7. ✓ **Failure classification.** Only `JSONL_RECORD` failures (and any
decode failure of an unknown provider) are terminal, matching live
intake. A known-provider JSON document decode failure keeps its former
`failed` receipt (residual below). Read faults stay `OSError` and remain
retryable.
8. ✓ **Silent outcomes.** Every settled path is excluded with a typed
reason, and the attempt disposition is `corrupt_input` or
`unsupported_shape`, never `success`. An empty candidate list is
`no_source_window` in raw derivation, and `no_replay_candidate` or
`legacy_append_window_missing` in backup.
9. ✓ **Cleanup on failure.** Staged blobs are discarded on every refusal
path: `stage_exact_blob` discards a mismatch, and
`_stage_absent_blob_restorations` discards on exceptions.
10. ✓ **Identity and keys.** No hash, ID formula or receipt key changed.
Member debt subjects keep `<zip>:#<ordinal>:<member>`.
11. ✓ **Lossless transforms.** Replay keeps every complete record and
drops only an unterminated tail, as live does. ZIP restoration keeps
only byte-identical values.
12. ✓ **Degenerate inputs.** An empty or whitespace-only payload parses
whole. A lone unterminated line gives prefix 0 and no records. A
zero-byte window stages an empty blob. A missing, non-ZIP or directory
container prefix yields `container_coordinate_missing` or
`source_missing`.
13. ✓ **Consumers.** Every reader of the renamed fields is updated:
intake adapter (admitted paths too), canonical ingest, and tests (`grep
no_session_paths` finds 0). The `recover` callback signature changes in
its only caller. `_RECOVERABILITY_FAILURE_KINDS` drops the two kinds
that are no longer produced. `docs/archive-backup.md` names the owner.
14. ✓ **Tests and stubs.** Each new test drives the production route and
names what turns it red:
-
`test_retained_replay_refuses_a_malformed_middle_record_with_a_terminal_census`
goes red under lenient decode (a session is published) or a failed
receipt (the raw is re-selected).
-
`test_retained_replay_parses_the_complete_prefix_before_an_unterminated_tail[bytes,stream]`
goes red under whole-payload strict decode, or when a terminated
malformed line is excluded.
-
`test_a_worker_decode_refusal_keeps_its_kind_across_the_worker_boundary`.
- `test_a_corrupt_capture_is_excluded_as_corrupt_input` goes red on the
former `ADMITTED` or the stale-cursor `RETRYABLE`.
- `test_both_routes_prove_and_restore_the_same_window[6 kinds]` and
`test_both_routes_refuse_a_source_that_no_longer_holds_the_bytes[6]`.
- `test_an_absent_zip_member_blob_is_restored_and_materialized`, which
drives converge.
-
`test_a_colon_path_names_a_container_only_when_its_prefix_is_a_real_zip`.
    - The updated ZIP refusal debt test.
- `test_in_memory_sandbox_links_are_all_recorded` and
`test_an_asset_larger_than_the_zip_member_bound_is_acquired_from_a_directory`.
15. ✓ **Trust boundaries.** Fixtures are synthetic, and nothing is
logged beyond the existing events.

Generic list: (1) each criterion is met on the production route, as
listed above; the unmet parts are in the residuals. (2) Sibling greps
are in item 1. (3) Predecessors are deleted:
`_terminal_decode_evidence`, `prepare_retained_jsonl_carrier`,
`_settle_zip_member_refusals`, `direct_source_windows`,
`stage_exact_direct_source_blob`, `_current_raw_payload_bytes` and
helpers, and the backup window helpers; a grep for all of them finds 0
outside test names. (4) Failure paths are typed (items 7 and 8). (5) Red
conditions are in item 14. (6) No secrets or private data are in the
diff.

## Residuals

- xf8qp: a truncated capture that is still stable (unchanged since
capture) is a deferral that parses its complete prefix, not an
exclusion. Only the not-stable and not-hot-proven branch is terminal.
That branch is tested on the batch route
(`test_captured_incomplete_jsonl_is_rejected_after_source_disappears`);
an intake-adapter test would need a source that changes mid-pass.
- A known-provider JSON document (not JSONL) that does not decode is
still a retryable `failed` census receipt, as in live intake. Making it
terminal is a live-intake policy change.
- Raw derivation restores from the recorded path. Backup also re-anchors
a relocated archive root (`_resolved_source_path`), so a ZIP moved with
the archive root is recoverable by backup only.
- The in-memory ChatGPT route's memory is linear in its input, like
every list it already holds. The scratch-spilled prepared route is the
bounded one.
- Legacy-append predecessor choice still orders by `acquired_at_ms`
(noted in #5838).

🤖 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