Repository navigation
fix: retain JSON evidence through size-independent preparation - #5557
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Warning Review limit reachedNext included review available in 52 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51f6bd11c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| preparation = self._parse_stage.pop_path(str(path), blob_hash=raw_id) | ||
| if preparation is not None: | ||
| path_preparations_by_raw_id[raw_id] = preparation | ||
| path_preparations_by_source_path[str(path)] = preparation |
There was a problem hiding this comment.
Re-detect JSONL providers from the captured blob
When an inbox JSONL file is atomically replaced with another provider's valid JSONL between _jsonl_provider_and_session_artifact() and write_from_path(), pop_path() correctly rejects the stale preparation, but this branch retains the provider detected from the old bytes. The resulting RawSessionRecord therefore stores the captured blob under the wrong origin and leaves that incorrect durable raw behind even if a later retry detects the new provider; mirror the JSON-document branch by deriving the provider from the captured blob before admission.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Deferred, not fixed here. Cross-origin provider re-detection is being replaced by location binding (the path's configured origin decides the provider, and a mismatching capture fails closed) in the daemon-config work. Mirroring the JSON-document re-detection for JSONL would add the path that change removes. This thread is handed to that owner.
…s decoded - a member's text is chosen exactly as decode_json_bytes chooses it: the first of JSON_TEXT_ENCODINGS (now owned by content_identity and used by decoder_json) under which the whole payload decodes, with NULs and leading byte-order marks dropped, else UTF-8 ignoring errors. BOM-less UTF-16/32 members the decoder reads now share their UTF-8 identity; a JSON failure still decodes the rest before settling, as the decoder picks an encoding by decodability, not by parse. - a spilled long key reaches the hasher as a marker for its decoded text instead of being re-escaped into the token stream. - open containers are bounded at 2^20 (array runs count once): far past the depth the source decoder can recurse, so no decodable member is affected; a deeper member takes its byte identity. - test: retarget the source-only ZIP test's monkeypatch from the removed _detect_provider_from_raw_bytes (inherited failure from #5557) to detect_provider_from_path_sample_evidence. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6
…#5682) ## Summary Second intake pass (stacked on #5643). - Every ChatGPT mapping node now goes through the scratch carrier. That includes tool chains, multimodal parts, reasoning timings, code-interpreter runs and authorship evidence, not only text nodes. - A decoded value too large for one SQLite cell is refused as a counted conservation gap, never truncated. - Live, retained-replay and cold-build publication of one raw now produce identical rows. - Remaining SQLite connections are closed, and intake readers are migrated onto the profiled factories. - Seven old, unanswered Codex P1 findings from earlier PRs are fixed here or dismissed with evidence. ## Problem - **ChatGPT collecting fallback:** any node outside a narrow text-only shape sent the whole mapping back through the collecting parser. Normalized messages, attachments and events then grew with the conversation. - **Oversized values:** nothing bounded a single giant scalar, and the ChatGPT parser capped sandbox-link attachments at 512 per message, dropping the rest. - **Route characterization:** the route test pinned a "delta" that was an artefact of acquiring the retained raw without the revision identity live intake assigns. - **Connection leaks:** spool connections used `with sqlite3.connect(...)`, which commits but never closes. - **Stale test fixtures:** three tests failed on master against stale fixtures: - one patched a helper that no longer exists; - one used a fake with an out-of-date signature; - one expected pre-fresh-v1 migration behaviour. ## Solution - **One ChatGPT normalization, two stores.** `chatgpt.parse(..., spill=)` collects messages into a `MessageEntries` store. It is a list for the collecting parser and scratch for preparation. Ordering, parent resolution, the active leaf and generation-timing ownership are written once and read through the store. Declared sibling order is answered from the spilled `children` rows. The old text-only fast path is deleted. - **Physical value limit.** `polylogue.sources.value_bounds` reads `SQLITE_LIMIT_LENGTH` from the linked SQLite. - The ijson member normalizer, bundle records and ChatGPT keys refuse any value whose UTF-8 encoding exceeds it, with `ValueBoundRefusedError`. - Source conservation types that refusal as `value_bound_refused`, a counted warning. - The sandbox attachment cap and the Gemini sidecar size caps are removed; attachments spill to scratch instead. - **Route equality.** The characterization test acquires the retained raw under live's revision identity and asserts identical source and index rows across all three routes. - **Connections.** A `spool_connection` context closes spool databases. The live batch, watcher, batch observability and raw-retention readers use `open_readonly_connection`, and sibling tiers use `attach_readonly_database`. - **Old P1 findings:** - #5610: a browser-capture envelope that also carries a mapping keeps the capture route. - #4720: a Gemini sidecar that is still being written, or is shorter than the inline envelope, becomes debt and does not replace the envelope. Claude Code also leaves the path-independent parse cache, for the same sidecar reason as Gemini CLI. - #4850: the sibling tool-id index composes the full revision plus its appended tails. - #5603: interrupted attempts stay `running` until the rewind read has succeeded. - #5630: a resumed completed ingest decodes the nested `historical_receipt`. - #5250 and #5630 (abandoned manifests): already fixed on master. Evidence is in the review thread replies. - #5557: deferred to the location-binding change in daemon config. ## Verification - `devtools test` over 14 files (prepared JSONL, the ChatGPT parser, source conservation, route characterization, live watcher/append/batch, raw retention, daemon ingest idempotency, Gemini sidecars, cursor recovery, machine receipts, reviewed defects, route interpretation): 741 passed, 1 failed. The one failure is the Gemini oversize-sidecar expectation that changed with the cap removal. It is fixed and its rerun is below. - `devtools gate mypy`, `layering`, `patterns` and `schema-closure` pass locally; the cursor-recovery test file was rerun on the final head. - Hosted quick gate on this head. ## Schema closure This moves the derived schema identity, so it must land before the rebuild. `decoder_json.py`, `prepared_jsonl.py`, `prepared_message_sink.py`, the live batch/watcher/observability modules and `raw_retention.py` are in the closure. The baseline grows by one module, `polylogue/sources/value_bounds.py`, because the decoder now imports the storable-value limit from it. ## Residuals - behu4 shapes that still load whole objects, all code-ready with no decision pending: - Claude AI `chat_messages` (the evidence graph in `normalize_chat_messages`); - Drive and chunked prompts; - Hermes ATIF and OTel; - the Grok fallback. - The Claude Code tool-result sidecar join keeps its 64 MiB-per-file and 256 MiB-aggregate caps. - Storing values above SQLite's cell limit is an undecided future question, not committed work. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4 --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…5729) ## Summary Fixes six tests that fail on master and one intake bug. Five tests encoded contracts that earlier PRs changed on purpose, and are realigned. The intake bug: a SQLite database that could not be read at probe time was excluded for good. ## Problem A focused run on `7e5b96e15d` failed six tests: | Test | Broken by | Cause | | --- | --- | --- | | `test_live_full_ingest_offloads_sync_work_to_keep_loop_responsive` | #5557 | `_ingest_full_paths` now passes `prepared_json_paths`; the test stub rejected the keyword. | | `test_source_only_full_ingest_streams_admitted_zip_members_without_decoding` | #5557 | #5557 removed `_detect_provider_from_raw_bytes` from `live.batch`, and `monkeypatch.setattr` failed on the missing name. | | `test_every_planned_path_is_accounted_for`, `test_offered_bytes_split_puts_a_refused_file_in_the_refused_bucket` | #5557 | #5557 retains a JSON document of any shape and lets the parser record unsupported-shape evidence. The `notes.json` fixture meant to be refused therefore succeeds. | | `test_authentication_refusal_is_not_an_indeterminate_mutation` | #5705 | The exception text is now the daemon's detail (`machine authentication required`), not the code. | | `test_restart_recovers_indeterminate_mutation_without_replaying_it` | #5688 | Startup recovery now resolves an `unknown` run by convergent replay, so the restarted daemon applies once more. | Intake bug: the Codex, Hermes and Antigravity recognizers catch `sqlite3.Error`/`OSError` and answer "not ours". `classify_pre_acquisition` turns that answer into an exclusion, and `_mark_excluded_cursor` records `excluded=True`. A database that is locked or unreadable during the probe (EACCES, SQLITE_BUSY/CANTOPEN) was never retried while its observation stayed unchanged. #5724 had guarded only the cold-build baseline against this. ## Solution - Tests: accept `prepared_json_paths` in the stub. Point the ZIP no-decode guard at `detect_provider_from_path_sample_evidence`. Refuse a JSONL record stream that no origin claims instead of a JSON document. Assert `rejected.value.outcome == "unauthorized"`. In the restart test, count the one startup replay and check that the retried request id does not dispatch again. - Intake: `classify_pre_acquisition` probes a SQLite path before excluding it and raises a retryable read fault. The batch records that fault as an ordinary retryable failure. Bytes that are not a database stay excluded. The baseline's own probe and `_retryable_read_fault` move into `batch_support`, so intake and the baseline apply the same rule. The baseline branch those helpers made dead is removed. `batch.py`, `batch_support.py` and `production_baseline.py` are in the derived schema-identity closure (`devtools schema closure`), so this must land before a rebuild starts. ## Verification - `devtools test tests/unit/sources/test_live_watcher.py tests/unit/sources/test_raw_admission_settlement.py tests/unit/sources/test_live_batch_support.py tests/unit/sources/test_production_baseline.py tests/unit/sources/test_cold_build_generation.py tests/unit/daemon/test_daemon_operation_route.py`: `418 passed`, 1 flaky. The flaky test was `test_cancelled_long_delete_retains_writer_until_blocked_apply_releases`: a 25 ms deadline returned `completed` under load, and the test passed when rerun alone. - After the final baseline cleanup: `devtools test tests/unit/sources/test_production_baseline.py tests/unit/sources/test_cold_build_generation.py`: `64 passed`. - `devtools verify --quick`: `PASSED` (includes mypy, patterns, schema-closure). - The new `test_unreadable_state_database_stays_retryable_instead_of_excluded` drives a mode-0 `state_5.sqlite` through `_ingest_full_paths_sync`. Without the probe, the file is not failed and gets an excluded cursor. ## Residuals - If a lock clears between the recognizer's failed read and the probe, the file is still excluded. That window was already accepted for the baseline in #5724. Closing it needs the recognizers to propagate read faults. - The unbounded JSONL session scan is filed separately and is not changed 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]>
…#5715) ## Summary Recovers the tail of an append whose process was killed mid-write, and turns four kinds of stuck or silent ingest/daemon failure into terminal, visible outcomes. Beads: polylogue-b8of0, polylogue-7c5k6, polylogue-wyi9p, polylogue-oulj2, polylogue-hu24g, polylogue-xf8qp, polylogue-zt8is, plus two status residuals of polylogue-qw8zp / polylogue-10a3q. ## Problem - **Append kill loses the tail (b8of0).** Kill the process inside an append's index write, then restart. The first page defers the path and schedules a 60 s retry. The next page reads that not-yet-due retry as already admitted and acknowledges it as `DUPLICATE`. Later passes defer forever, because the writer refuses a prepared field union ("no longer applies") that its own precedence decision no longer needs. The index stays at 3 of 6 messages. - **Worker death or hang never escalates (7c5k6).** Every `BrokenProcessPool` was deferred, and a deferral resets `failure_count`, so a file that kills its worker is retried every pass for the whole build. A hung worker is stopped only at shutdown and holds its slot until then. - **Deterministic intake failures retry forever (wyi9p).** Every escaped exception became `RETRYABLE`, and the attempt counter restarted after each cooldown. A `sqlite3.Error` escaping page admission bypassed `daemon.intake.page_refused`. - **Embedding cap fails open (oulj2).** An unreadable spend probe returned `0.0`, which granted the whole monthly budget. - **Six swallowed failures (hu24g):** the Drive config read, both heartbeat alert probes, the debt-retry pass, the Gemini typed-extraction fallback, the Codex thread-state currency check, and the browser-capture census. - **Zero-session files are reported admitted (xf8qp)**, so the operator's admitted count includes files that produced nothing. - **The delegation snapshot refuses more than 100k rows or 64 MiB (zt8is).** Those caps reject valid input. - **Status during a first build:** the discovery overlay replaced the build's mode and ETA with `discovery_pending` / `None` while discovery paged. A root with no active generation had no status frame, so the snapshot read "unavailable" for the entire first build. ## Solution - `watcher.classify_ingest_candidates` splits a page into paths that are needed now and paths that are waiting on a scheduled retry; it is the only selection route (`select_ingest_candidates` is removed). `FileIntakeAdapter` reports a pending path as `DEFERRED`, never `DUPLICATE`. The writer drops a prepared union its precedence does not need and writes the parsed rows it already holds. - `LiveParseStage` (rebuilt on #5691's read-ahead model) charges each worker loss to the one file whose task a worker held. `_run_holding_attempt` marks the parent-assigned attempt directory when a worker takes a task and when it lets go, so the tasks held at a pool break are exactly those started and not finished. One held task is charged. Several are deferred uncharged and become solo suspects, which run on an otherwise idle pool (and are never read ahead) until a worker comes back from them, so each later loss names one file. Losses are counted per observation (size, mtime_ns, inode). The third consecutive loss on an unchanged observation is a non-deferred failure carrying `failed_observation`, and `pop_path` applies it only to a capture of that same revision; the cursor's failure budget then quarantines the file. - Hangs: #5691 bounds only read-ahead (lifetime and preemption) and leaves required work waiting forever, so this PR keeps one hang mechanism, for required work only, and measures it the way #5691 measures progress. A process worker whose attempt directory has not grown for 600 s plus its source size at 256 KiB/s is stopped through `_stop_process_workers`, the same restart-and-settle path that reaps read-ahead. Only that path is charged; interrupted required siblings lose their restart deferral and the waiting warm resubmits them. Slow work that keeps writing is never stopped. The earlier submission-time deadline reaper, its `_path_started` clock and the plural `failed_attempts` restart argument are gone. - `AdmissionResult.transient` records whether a failure can clear on its own. Locks, OS errors and storage faults are transient and retry without bound. An unchanged item that repeats the same non-transient failure is isolated after `max_deterministic_cooldowns` (3). The page handler also catches `sqlite3.Error` and emits `page_refused`. - The spend probe returns `None` when unreadable, and the pass then refuses with `spend_unmeasured`. - Each of the six hu24g sites now emits an event, returns the failure to its owner (the debt retry re-raises into the loop's `last_error`), or narrows its handler (Gemini now catches only `ValidationError`). - Zero-session paths are carried through the batch result and the metrics, and are reported `EXCLUDED`. - Delegation evidence is read in 1,000-row keyset pages, whose key coalesces only NULL exactly as the SQL order does. Both caps are gone, and the snapshot digests every row. - The overlay keeps build keys once a planned denominator exists. `_status_frame` returns `no-active-generation` for a missing active index. - Retargets a stale monkeypatch in the ZIP streaming test, which named a detector `batch.py` has not imported since #5557. **Schema identity:** `devtools schema closure` marks `sources/live/{batch,batch_support,metrics,parse_prefetch,watcher}.py`, `sources/dispatch.py`, `sources/codex_state_evidence.py` and `storage/sqlite/archive_tiers/write.py` IN, and the new `idx_delegation_facts_query_order` changes index DDL. This PR moves the derived identity (`parse_prefetch.py` included), so it must land before the fresh rebuild starts. ## Verification On head `dbccb4817b`, through AgentCTL jobs (never in-process): - `agentctl job start polylogue verify_quick` (job `c1c21522`): `verify: PASSED exit=0 ... head=dbccb4817b15` - `agentctl job start polylogue pytest_focused -- <15 files: derivation kernel laws, parse-stage equivalence, live watcher, daemon cli, derivation admission, parse prefetch, watcher locking, prefetch cache, dispatcher intake measurement, fair intake, delegation materializer, page selection, batch convergence, excluded-cursor proof, canonical ingest>` (job `f43837d3`): `580 passed, 3 failed`. Four daemon-cli tests failed in the batch and passed on isolated rerun (host load; one of them, the cold-build transient settlement test, also passed alone on the previous head as `2 passed in 47.56s`). - The 3 failures reproduce identically on master `0156f3b97a` (clean detached worktree, `pytest_focused -- --on-default-branch`: `3 failed`), so they are inherited, not caused here: `test_live_batch_convergence::test_page_admission_runs_lease_free_owners_outside_the_writer_gate`, `test_live_watcher_locking::test_watcher_queues_behind_daemon_maintenance_writer`, `test_dispatcher_intake_measurement::test_dispatcher_page_compaction_cost_is_one_scoped_hold_at_archive_scale`. New behavior tests, each naming what would make it fail: - append kill: 3 restart pages all `DEFERRED` (pre-fix: `DUPLICATE`), then 6/6/1 messages and no parse errors; a scheduled retry is `DEFERRED` with zero cost at the adapter and `pending` in watcher classification - a killer file escalates on its third loss on real process pools; a pool break charges only the task still held; two held tasks charge neither and run alone until attributed; a restart-preserved success or a worker error ends the streak; rewritten content starts a new streak and an escalated failure does not apply to it - a hung required preparation is stopped at its hang bound and charged alone while the sibling is prepared in the same warm; a slow preparation that keeps writing is never stopped - deterministic isolation with a draining sibling; a lock never isolates; an `IntegrityError` page emits `page_refused` - unmeasured spend refuses the pass; one test per hu24g site; a zero-session file is `EXCLUDED` - a population larger than a page materializes completely; an empty-string block id keys the keyset as `COALESCE` does - the overlay keeps the build ETA; the status frame names a root without a generation ## Self-review A full read of the PR diff against master after the merges. Each item says how it applied. - **Cancellation and shutdown in every loop.** `_warm_until` checks `cancelled` on every poll, and the hang reaper runs inside that loop. It never waits itself: it stats attempt directories and restarts the pool. After `_closing`, pool-death attribution returns the shutdown deferral and does not restart the pool. After an unverified stop (`_cleanup_blocked`), it charges nothing. That second case fixes a finding: a later collection of the same break would otherwise have charged a sibling a second time. - **Unbounded reads and state.** The hang signal is one `scandir` per running required path per poll. `_path_worker_losses` and `_path_solo_suspects` grow only with distinct files that lost a worker. They are cleared when a worker comes back from a file, and they are not pruned for files that are never seen again (see Residuals). - **Fail-open fallbacks.** A loss with no submission observation is deferred, not charged: it cannot be bound to a revision. An escalated failure applies only while the file's (size, mtime_ns, inode) is unchanged. - **Sibling sites of each defect class.** The per-path bookkeeping (future, observation, progress, attempt directory, in-flight bytes) is released in one helper, `_release_slot`. Collection, pool restart and thread-orphan reaping all use it. That removed the parallel `_path_sizes` and `_path_started` dicts, each of which every release site had to remember. A streak ends at every site where a worker comes back from a file: a collected success, a collected exception, and a success the restart preserved. Two sibling defects were found and fixed. `DelegationPageKey.after_row` used `or`, so an empty-string block id keyed on the child session id, a position the SQL `COALESCE` order never has; it now coalesces NULL only, with a test. `pop_path`'s changed-source branches were checked against #5643's `_discard_retained_path`. A failed result never carries retained members, so the new `failed_observation` branch needs no discard. - **Master's new FAILED site.** Master added a FAILED outcome at the post-publication requiredness recheck (`requiredness inspection: {exc}`). Like this branch's other exception-backed FAILED sites, it now names the exception type and carries `transient`, with a test. - **Compatibility shims.** One was found and removed. The adapter kept `select_ingest_candidates` as a fallback beside the new `classify_ingest_candidates`, and `LiveWatcher.select_ingest_candidates` had become a wrapper. Classification is now the only selection route. Fakes, `docs/daemon.md` and the excluded-cursor proof receipt name it. - **Tests prove the production route.** The worker-loss tests run real process pools through `warm_paths`/`pop_path`. The worker helper is wrapped by the production `_run_holding_attempt`, so the markers are the production ones rather than test-written. The hang test runs a warm on a thread with a join bound, so a missing reaper fails instead of hanging. A slow worker whose attempt directory keeps growing proves the bound measures lack of progress, not time since submission. The scheduled-retry split had no test; it now has a watcher test (pending vs. settled exclusion) and an adapter test (`DEFERRED`, `actual_cost` 0, never `DUPLICATE`). ## Residuals - `_path_worker_losses` and `_path_solo_suspects` are cleared when a worker comes back from a file, but they are not pruned for a file that never returns. They are bounded by the distinct files that lost a worker during one daemon's life. - A worker lost under a retained-member preparation (#5643 runs those on the same pool during reconciliation) restarts the pool without attribution, so such a loss is never charged. It errs toward under-charging, never toward a false charge. - 7c5k6 "visible in status": escalation reaches the cursor quarantine through the writer's generic parse-failure path (`batch.py` per-record `except Exception` → `mark_raw_parse_failed`). I confirmed this by reading the source; no end-to-end quarantine test drives a killer file through five cursor failures. - The hu24g optional ratchet (a devtools pattern rule for broad excepts) is not included. 🤖 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]>
|
Closing out open Codex review threads on this PR (evidence checked against master at bf68918):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at bf68918):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
## Summary Fix all 25 confirmed Codex P1 findings of polylogue-ez5b9 (sources-live and sources-parsers) in one change. This PR now carries the coordinator's seven fixes plus everything from AgentCTL batch run `polylogue-20260929-115511-f46562fd` (workers ez5b9.1 parsers/artifacts/rendering, ez5b9.2 prepared acquisition, ez5b9.3 baseline/watcher). That run was abandoned once its content was carried here, so this is the only vehicle. The branch is rebased onto current `master`. ## Problem The findings (threads linked in the table) share one theme: intake decided an outcome from evidence other than the bytes it published. Examples: a vendor conversion was published against later protobuf bytes; provider detection sampled a different revision than the one sealed; a cursor was authorized from source evidence read before another writer ran. Others: whole cohorts ran past the writer budget; a torn JSONL record was skipped on the way to the frontier; growth hid behind the cursor; the baseline could not recognise retained growth or staged SQLite coordinates. Several parser shapes were also lost or mis-keyed before storage: project documents, ID-less tool steps, argument-less commands, relocated cwds, bare usage records, OTel identity. ## Solution | Finding | Thread | Fix | Production-route regression | | --- | --- | --- | --- | | 11.F006 | [#4330](#4330 (comment)) | The converter's verified SHA-256 is carried to capture (`AntigravityExportOutcome.source_sha256`). A capture that hashes differently is released and refused with `source_changed_after_conversion`. | `test_antigravity_conversation_acquisition.py::test_vendor_conversion_cannot_publish_a_later_protobuf_revision` | | 11.F007 | [#4330](#4330 (comment)) | One `admit_acquisition` item boundary covers ordinary files and each vendor conversion (`admit_path`). The vendor server starts only for an admitted item. | `::test_vendor_cohort_checks_the_pass_budget_between_conversations`, `::test_vendor_admission_refusal_happens_before_server_start` | | 11.F023 | [#4809](#4809 (comment)) | The same per-item checkpoint raises a typed `WriteHoldBudgetError` between conversions without poisoning items. | `::test_vendor_cohort_propagates_writer_budget_refusal_without_poisoning_items` | | 11.F016 | [#4663](#4663 (comment)) | The append cursor's observed size is bounded by the plan, including Claude's mutable-header delta, so unprobed growth stays visible. | `test_live_batch_support.py::test_append_publication_does_not_hide_growth_after_planning[codex,claude-code]` | | 11.F019 | [#4694](#4694 (comment)) | Hook publication queues `hook_paste_enrichment` debt for the affected old sessions before the hook rows are written, under the same lease. Re-matching is idempotent. | `test_hook_paste_enrichment.py::test_late_hook_publication_schedules_its_old_session_not_the_next_batch[debt_write_fails]`, `::test_replaying_paste_evidence_does_not_move_it_to_a_nearby_prompt` | | 11.F021 | [#4809](#4809 (comment)) | Append ingest checks the write-hold budget at start, per plan, parse, replay, materialize and completion. The typed refusal propagates, and the retained raw stays retryable. | `test_live_batch_support.py::test_append_budget_refusal_retains_retryable_raw_without_poisoning_source` | | 11.F030 | [#5428](#5428 (comment)) | Pinned source-tier evidence is read inside the cursor writer admission, not across the preceding await. | `test_live_sidecar_evidence_cost.py::test_cursor_evidence_is_pinned_after_writer_admission` | | 11.F033, 11.F036 | [#5546](#5546 (comment)), [#5557](#5557 (comment)) | The carrier names its decode failure (`DecodeFailure`). The writer re-raises `PreparedDecodeError`, and `classify_decode_failure` is the single classifier; `_is_json_stream_decode_error` is deleted. | `test_live_watcher_parse_stage_equivalence.py::test_path_worker_decode_failure_reaches_terminal_unknown_evidence` | | 11.F035 | [#5546](#5546 (comment)) | `source_snapshot` copies the source once. Sampling, frontier, parse and seal read that copy, and the seal carries its digest. | `::test_path_worker_binds_provider_parse_and_seal_to_one_snapshot` | | 11.F037 | [#5557](#5557 (comment)) | A stage-owned JSON document without a carrier for its captured bytes is released and deferred (`live.ingest.json_capture_deferred`). It is never decoded under the writer hold, even when preparation raised. | `::test_changed_json_after_preparation_defers_without_writer_decode[both]`, `::test_preparation_exception_does_not_restore_whole_json_writer_decode[discovery,preparation]` | | 11.F039 | [#5250](#5250 (comment)) | Live full intake (writer, prewarm, path worker) and append decode JSONL strictly for every provider. A malformed complete record is `terminal_corrupt_input`, with the raw retained. | `::test_known_provider_jsonl_with_a_malformed_middle_record_is_terminal[in-writer,worker]`, `test_live_batch_support.py::test_append_refuses_a_malformed_middle_record` | | 11.F051 | [#5546](#5546 (comment)) | A `BrokenProcessPool` at submit collects finished futures, replaces an idle broken pool once, and retries the submission. A second break leaves the path deferred. | `::test_a_pool_broken_while_idle_is_replaced_at_the_next_submission[pending_completion]` | | 11.F053 | [#5542](#5542 (comment)) | Every baseline decision uses `_retained_source_path`, which is the provenance sidecar's original path for a staged SQLite snapshot, the same coordinate acquisition retains. | `test_production_baseline.py::test_a_staged_sqlite_import_is_baselined_at_the_path_acquisition_retains` | | 11.F055 | [#5542](#5542 (comment)) | Retention of a grown file is proven by streaming and hashing the baselined prefix of a larger full capture, or of a byte-proven contiguous append chain rooted at one. A blob read fault is retryable. | `::test_a_revision_that_grew_before_intake_is_proven_by_the_larger_retained_capture`, `::test_baselined_and_earlier_accepted_revisions_are_proven_through_an_ordered_append_chain`, `::test_a_chain_that_does_not_reproduce_the_revision_leaves_it_unretained[5 defects]`, `::test_a_retained_blob_read_fault_is_retryable_not_unretained` | | 11.F065 | [#4801](#4801 (comment)) | Cursor reconciliation takes the newest of the newest materialized and the newest decided-unresolved raw, ordered by `(acquired_at_ms, raw_id)`. | `test_live_watcher.py::test_cursor_reconciliation_restores_the_newest_archived_outcome[3 cases]` | | 11.F069 | [#5020](#5020 (comment)) | `WatchSource.path_artifact_kinds` replaces `allow_path_scoped_artifacts`. `codex-state` admits exactly its `session_index` and `prompt_history_log` sidecars. | `test_production_baseline.py::test_the_default_codex_state_source_baselines_only_its_declared_jsonl_sidecars`, `test_ingest_worker_assembly.py::test_codex_retained_root_sidecar_titles_survive_without_a_live_tree` (now via `default_sources()`) | | 12.F001 | [#4883](#4883 (comment)) | An ID-less trajectory call gets the step-keyed id `<message id>:tool`. An ID-less result pairs only with a sole adjacent ID-less call whose declared name agrees. | `tests/unit/sources/parsers/test_antigravity.py::test_trajectory_id_less_tool_steps_persist_their_pairing_and_file_edit`, `::test_trajectory_id_less_result_pairs_only_an_unambiguous_adjacent_call[5]` | | 12.F011 | [#4803](#4803 (comment)) | An assistant text node with `metadata.command` and empty or absent args is a `TOOL_USE` with input `{}`. Its non-JSON text stays on the block. | `test_parsers_chatgpt.py::test_chatgpt_zero_argument_command_is_a_tool_call_its_result_pairs_with[empty,absent]` | | 12.F012 | [#4721](#4721 (comment)) | The project filename is stored as `metadata["name"]`, projected to the derived column `blocks.name`. Markdown, HTML and plaintext media renderers render the carried body (fenced or escaped). | `test_parsers_claude_ai_catalog.py::test_claude_project_documents_render_body_and_file_name_after_persistence` | | 12.F013 | [#4721](#4721 (comment)) | `looks_like_session_document` admits the parser's own project and account-memory detectors. | `test_ingest_shape_admission.py::test_claude_project_export_reaches_parse_project_through_ingest`, `::test_claude_account_memory_export_reaches_its_parser_through_ingest` | | 12.F014 | [#4717](#4717 (comment)) | Relocated cwds lead `working_directories`, latest first. Chunk merge applies the same rule from relocation events. | `test_claude_code_sidecar_evidence.py::test_resume_route_opens_the_relocated_cwd_after_persistence`, `::test_chunk_merge_keeps_the_relocated_cwd_first_across_revisions` | | 12.F018 | [#4870](#4870 (comment)) | An event counts as a replacement only when neither its message link nor a same-session message with its native id exists. The provider id is compared byte for byte. The evidence key is renamed `replacement_events`. | `test_corpus_fidelity.py::test_revision_gate_counts_only_events_that_replace_a_missing_message[4]` | | 12.F020 | [#4886](#4886 (comment)) | A bare `token_usage_record` stating a known counter joins either stream shape without marking it. | `test_ingest_shape_admission.py::test_codex_rollout_with_bare_token_usage_record_ingests_its_usage`, `::test_codex_bare_token_usage_record_needs_a_known_counter` | | 12.F026 | [#5530](#5530 (comment)) | Each OTel identity component escapes `%` and `:` before the join. | `test_otel_genai.py::test_session_identity_components_cannot_run_into_each_other` | The parser and membership changes alter values derived from bytes already observed, so both manual invalidation tokens are bumped: `_PARSER_FINGERPRINT` goes to `live-batched-v4` and `RAW_AUTHORITY_PARSER_FINGERPRINT` to `revision-membership-v5`. **Derived-identity closure.** `devtools schema closure` puts these changed files inside the closure: `archive/artifact_taxonomy/support.py`, `archive/hydration.py`, `archive/revision_authority.py`, `sources/dispatch.py`, `sources/live/{append_ingest,batch,hook_paste_enrichment,parse_prefetch,production_baseline,watcher}.py`, `sources/parsers/{antigravity,codex,otel_genai}.py`, `sources/parsers/claude/{ai_parser,code_parser}.py`, `sources/prepared_jsonl.py`, `sources/source_parsing.py`, `storage/runtime/archive/records.py`, `storage/sqlite/archive_tiers/{archive_tiers_specs,write}.py` and `storage/sqlite/queries/attachment_blocks.py`. This PR must land before a rebuild starts. The only schema change is additive-derived: the `blocks.name` index.db column. It has no durable-tier migration. ## Verification Candidate `4313bff197b1b0420ede997247d9843195c81e69`, on `master` 5d56c3a. - `agentctl job start polylogue pytest_focused --workspace <worktree> -- <64 affected files>` (the selection is every test file the diff touches, plus the route and sibling suites): job 3396: `8 failed, 2569 passed`. All 8 failures are inherited (listed below). An earlier attempt, job 3387, was OOM-killed by systemd-oomd under host memory pressure and was retried unchanged. - `agentctl job start polylogue verify_quick --workspace <worktree>`: job 3388: succeeded, all 12 gates passed. - Inherited failures, classified on a detached `master` worktree with `--on-default-branch` (jobs 3335 and 3356 on 749f608, job 3384 on c950478, job 3401 on 5d56c3a), fail identically on master. They are filed as polylogue-ouv5f: - `test_import_preflight.py::test_unidentified_trajectory_rows_keep_distinct_identities` - `test_retained_tool_output_convergence.py::test_gemini_full_tool_output_survives_the_loss_of_its_source_tree` - `test_artifact_taxonomy.py::test_antigravity_brain_metadata_sidecar_is_rejected_from_live_and_schema_routes` - `test_tool_result_unknown_reason_contract.py` (3 Antigravity cases) - `test_source_laws.py::test_parse_payload_dispatches_claude_code_messages_and_single_records` - `test_revision_replay.py::test_chain_replay_supersedes_equal_frontier_quarantined_membership_head` - All fixtures are synthetic. No operator archive was read or mutated. ## Self-review Checklists re-read: `docs/review/codex-review-guide.md` (including "Do not flag" and the `polylogue/sources/AGENTS.md` review rules) and the generic list in `orchestrate/references/worker-contract.md`. It took four passes over `git diff origin/master...HEAD`: - Pass 1 found the two manual invalidation tokens left unbumped, which the guide names as a finding. They are now bumped. - Pass 1 also found retained routes that still decoded JSONL leniently. Making them strict was tried; pass 2 showed it livelocked the parser census, so it was reverted and filed as polylogue-3p8p7. Pass 2 also found the canonical-ingest vendor stub missing master's `excised` keyword; it now accepts it. - Pass 3 was driven by a focused run, where `test_live_route_interpretation.py::test_a_later_index_revision_re_derives_the_titled_session` failed on the branch but passed on master. A per-file bisection in probe worktrees traced it to `revision_backfill.py`, which had been restored from a newer master than the branch base. Restoring it to the base fixed the failure; the file is now unchanged against master. - Pass 4, on the rebased head, found nothing new. Final pass: 1. ✓ **Siblings and owners.** The ordinary-file and vendor acquisition routes share one item-admission closure (`admit_acquisition`). `classify_decode_failure` is the only decode classifier: grep for `_is_json_stream_decode_error` finds 0 hits. Strict decode covers all four writer sites, both prewarm sites, the path worker and append. The retained replay sites stay lenient on purpose (see Residuals and polylogue-3p8p7), and the ingest-worker validation-mode contract (#1745) is unchanged. Relocated-cwd order has one owner, `order_working_directories`, which serves both the parser and chunk merge. Baseline coordinates have one owner, `_retained_source_path`, which delegates to acquisition's `original_sqlite_source_path`. 2. ✓ **The fix itself.** The new `AntigravitySourceMutationError` is caught per item in `iter_antigravity_language_server_sessions` and becomes a failed path. `WriteHoldBudgetError` is re-raised ahead of the broad `except Exception` in the append and vendor paths. `PreparedDecodeError` subclasses `ValueError`, so existing `ValueError` handlers keep working. The census livelock that strict replay would have introduced is not shipped. 3. ✓ **Memory and limits.** `source_snapshot` and `_prefix_digest` stream in 1 MiB chunks. The baseline prefix proof reads one path's raw rows only for revisions with no exact match. No cap or truncation was added. 4. ✓ **Cost per unit.** Pinned cursor evidence is still one batched read per page. Chain roots are memoized, and identical blob sequences are hashed once. Hook debt targets only the sessions in the carrier. 5. ✓ **Interruption.** Write-hold checkpoints cover every append stage and each vendor item. Paste debt commits before the hook rows under one lease. A refused capture is released and the raw stays retryable, as the budget-refusal tests show. 6. ✓ **Ordering and races.** The protobuf is bound by digest from conversion to capture, and the JSON carrier is bound to one snapshot's digest. Cursor evidence is read under the admitting writer. A growth test grows the file after planning. 7. ✓ **Failure classification.** Blob read faults in the baseline proof raise `ProductionBaselineReadUnavailableError`, which is retryable. Mutation after conversion is a retryable item failure. A deterministic append decode failure goes through `_record_failed_cursor` and its 5-failure exclusion cap, not an unbounded retry. 8. ✓ **Silent outcomes.** Unattempted vendor items carry `REFUSED_UNATTEMPTED_TIME_BUDGET`. A deferred JSON capture emits `live.ingest.json_capture_deferred` and records deferral debt. A malformed live record gets terminal raw evidence instead of a silent skip. 9. ✓ **Cleanup on failure.** A mismatched capture calls `release_refused_capture`. A deferred JSON capture calls `discard_pending_receipt` and discards its carrier. Budget exhaustion calls `blob_store.discard_pending()`. The snapshot directory is removed in `finally`. 10. ✓ **Identity and keys.** OTel components are escaped injectively, and plain spellings are unchanged. The ID-less Antigravity tool id is step-keyed (`<message id>:tool`), not positional. The corpus-fidelity anti-join compares raw provider ids byte for byte (the whitespace case is tested). The `pipeline/ids.py` hash partition is untouched. 11. ✓ **Lossless transforms.** Chunk merge keeps relocation order across revisions. Re-matching paste evidence does not move it to another prompt. The ChatGPT call block keeps its non-JSON text. 12. ✓ **Degenerate inputs.** An empty or fully refused vendor cohort starts no server. A bare usage record without a counter stays refused. A document without a body renders its header alone. 13. ✓ **Consumers.** `allow_path_scoped_artifacts`, `indexed_events` and `_is_json_stream_decode_error` have 0 remaining references (`grep -rn` across `polylogue`, `devtools`, `tests` and `docs`). Every stub of `iter_antigravity_language_server_sessions` and `_antigravity_raw_snapshot` matches the new signatures. `docs/daemon.md` and `docs/maintenance.md` describe the new behaviour. The layering baseline digest for `production_baseline.py` is re-anchored, with an unchanged site count. 14. ✓ **Tests and stubs.** Each finding has a test on its production route (table above), driving `LiveBatchProcessor`, `ingest_append_plans`, `ingest_record`, archive persistence and read-back, or the watcher reconciliation, not a helper. Removing the named fix turns the listed test red: for example, drop `admit_path` and the pass-budget test converts all three items. Clock-driven tests use `frozen_clock`. Stubs follow the changed signatures (item 13). 15. ✓ **Trust boundaries.** No secrets or operator data. The pre-commit secret-scan candidates are pre-existing spans in `revision_backfill.py` and `test_live_batch_support.py`, not lines of this diff. Generic list: (1) every criterion is met on the production path, per the table; (2) siblings are covered in item 1; (3) consumers are covered in item 13; (4) failures are typed, per items 7 and 8; (5) each new test fails without its fix (item 14); (6) the diff carries no private data. ## Residuals - Retained replay still decodes known-provider JSONL leniently, so a rebuild can publish a session without a malformed record that live intake refused. Strict replay decoding was tried in this branch and reverted: the parser census records the parse exception as a `failed` receipt, re-selects it on every pass, and replay planning then never completes. Filed as polylogue-3p8p7, which needs a typed terminal census outcome. - A JSONL record over SQLite's value bound fails as `terminal_corrupt_input`, not under a size-specific reason. - A stage-level preparation exception now defers the page's JSON documents instead of decoding them under the writer (F037). A prefetch that failed deterministically would keep them deferred, with visible debt. - `canonical_archive_ingest` builds its `WatchSource`s with every path rule admitted, as before this change. The `codex-state` sidecar boundary is a daemon-default property. - The Codex hosted review is usage-limited on this PR (its gate reports "not required"), so no hosted code review covered this head. 🤖 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]>
## Summary Resolves the 23 confirmed Codex P1 findings tracked in polylogue-rs02d: 20 are fixed here, 10.F016 was already fixed on master, and 10.F013 and 10.F017 move to polylogue-g4w5d: acquisition, backup, browser capture, Codex lineage, MCP, mutations, query origins, retained assembly, revision backfill, schemas, and live sources. The lanes of the previous owner were integrated onto current master; this PR adds the missing pieces and the fixes that the integration review found. ## Problem Each row below is a Codex review thread confirmed against master 64a9bd0 by triage run `r4-other-sources`. The reproductions are in the bead and in each linked thread. ## Solution | Finding | Thread | Disposition | Regression test | |---|---|---|---| | 10.F039 Stream preserved ZIP payload proofs | [#4439](#4439 (comment)) | Fixed: backup replay goes through the streamed unit replay; a candidate holds digests and a reopener, and backup recovery plus raw derivation's blob restoration (#5846) stream the unit's bytes (`operations/zip_acquisition_replay.py`, `operations/archive_backup.py`, `storage/derived/raw.py`) | `tests/unit/sources/test_export_member_addressing.py`, `tests/unit/storage/test_blob_integrity.py` | | 08.F016 Authenticate the loopback receiver before releasing its token | [#4208](#4208 (comment)) | Fixed: the native host challenges `POST /v1/receiver/attest` and releases the bearer only for the bearer-keyed HMAC over a fresh challenge | `tests/unit/browser_capture/test_native_host.py` | | 08.F015 Bound native credential refresh to one retry | [#4208](#4208 (comment)) | Fixed: one native refresh per health check; a second 401 reports `unauthorized` | `browser-extension/tests/background.test.js` | | 10.F006 Preserve fallback identity for ID-less ChatGPT fragments | [#4188](#4188 (comment)) | Fixed: the census keys a document by the id `chatgpt.parse` gives it, fallback included | `tests/unit/sources/test_parsers_chatgpt.py` | | 10.F001 Scope parent lookup to the rollout's Codex root | [#4941](#4941 (comment)) | Fixed: the writer reads the parent in the install root of the raw's retained source path; unscoped reads answer only where every root agrees | `tests/unit/storage/test_agent_thread_state_graph.py`, `tests/unit/storage/test_topology_hook_authority_conflict.py` | | 10.F003 Rebuild retained rows before rejecting older exports | [#4941](#4941 (comment)) | Fixed: an older export folds the objects it names in as superseded rows ranked by durable receipt order | `tests/unit/storage/test_agent_thread_state_graph.py`, `tests/unit/sources/test_codex_state_live_ingest.py` | | 08.F045 Preserve indeterminate daemon submissions | [#5480](#5480 (comment)) | Fixed: MCP no longer swallows `DaemonMutationIndeterminateError`; the shared serializer returns `code="indeterminate"`, `retryable=false` and the request id. Sibling: MCP also refused no non-completed envelope (`cancelled`, `timed-out`, `degraded`, `disconnected-before-acceptance`) and returned it as a result; it now refuses them as the CLI kernel does, and both read one `DAEMON_INDETERMINATE_OUTCOMES` | `tests/unit/mcp/test_rs02d_outcomes.py` | | 08.F043 Cover postmortem and pathology MCP projections | [#4810](#4810 (comment)) | Fixed: `postmortem_outcome` and `pathology_outcome` in `analysis/postmortem.py` decide the outcome from coverage receipts; MCP attaches it. The CLI analyze routes carry the same pre-existing gap and are filed as polylogue-t4115 | `tests/unit/mcp/test_rs02d_outcomes.py` | | 08.F022 Require callers to present the delete preview token | [#4249](#4249 (comment)) | Fixed: the facade delete authorizes only the caller's own `mutation.session.delete.preview`; API gains `prepare_delete_session`; MCP `write` gains `prepare_delete_session` and requires `fields.preview_ref`; `POST /api/reset` requires `preview_ref`; the self-authorizing `delete_session_product` is removed | `tests/unit/api/test_facade_contracts.py`, `tests/unit/operations/test_mutations.py`, `tests/unit/daemon/test_daemon_http.py`, `tests/unit/mcp/test_rs02d_outcomes.py` | | 10.F009 Keep unknown-export available as a public origin filter | [#4060](#4060 (comment)) | Fixed: the unknown-export spec is a public filter origin | `tests/unit/sources/test_origin_specs.py`, `tests/unit/daemon/test_http_origin_validation.py` | | 10.F023 Preserve ZIP member order when selecting retained sidecars | [#4853](#4853 (comment)) | Fixed in three parts. (1) Selection ranks the lowest member ordinal within one acquisition time. (2) The source-walk stream stamps one acquisition time per ZIP pass. (3) Retained lookup names a ZIP member by its own basename: it had taken `PurePosixPath("<zip>:library_files.json").name`, so replay recognized no zipped asset index or asset id at all | `tests/unit/pipeline/test_ingest_worker_assembly.py` | | 10.F030 Move the exact FTS audit outside the component loop | [#4982](#4982 (comment)) | Fixed: raw-derivation publications pass `exact_fts_audit=False`; the `fts_readiness_binding` stage runs the one archive-wide inspection after block writes retire the binding | `tests/unit/storage/test_raw_observation_derivation.py` | | 10.F034 Restore constant-time raw-to-key lookups | [#5395](#5395 (comment)) | Fixed: census keeps a raw-to-key reverse map | `tests/unit/sources/test_revision_backfill.py` | | 10.F035 Validate enrichment with the resolved retained provider | [#5557](#5557 (comment)) | Fixed: publication validates under `artifact.resolved_provider` | `tests/unit/pipeline/test_codex_retained_state_title_production_route.py` | | 08.F049 Include WAL state in the observation revision | [#4923](#4923 (comment)) | Fixed: a live SQLite member's revision is the digest of its logical export, and its structure comes from that export's header in the same read transaction | `tests/unit/schemas/test_source_inference.py` | | 10.F015 Skip opaque JSON attachments before ZIP observation | [#4936](#4936 (comment)) | Fixed: `opaque-non-applicable` members are skipped by the ZIP walk and refused by schema-unit extraction | `tests/unit/schemas/test_observation_runtime.py`, `tests/unit/schemas/test_source_inference.py` | | 08.F050 Preserve annotated Claude Code block content | [#4951](#4951 (comment)) | Fixed: conservation plants annotated `content` unless it repeats the typed body | `tests/unit/core/test_wire_conservation.py` | | 10.F010 Route `.jsonl.txt` through JSONL recognition | [#4365](#4365 (comment)) | Fixed: recognition uses the shared `is_jsonl_source_path`. `_PARSER_FINGERPRINT` moves to `live-batched-v5` so cursors excluded as unsupported under v4 are retried | `tests/unit/sources/test_origin_specs.py` | | 10.F038 Persist terminal admission receipts before discarding state | [#4275](#4275 (comment)) | Fixed by removal: the `AdmissionState` machine had no production caller and persisted nothing; the durable accepted outcome is the raw row plus its `raw_payload` receipt. `sources/live/admission.py` and its tests are deleted | `tests/unit/pipeline/test_acquisition_persist_failure_cursor.py`, `tests/unit/architecture/test_one_intake_route.py` | | 10.F040 Detect the ZIP provider before preserving raw-only members | [#4853](#4853 (comment)) | Fixed: `zip_member_admission` sniffs the provider before admission; the source walk, retained acquisition, production baseline and the daemon ZIP route all use it | `tests/unit/sources/test_assembly_chatgpt.py`, `tests/unit/sources/test_live_batch_support.py` | | 10.F013 Reparse owners when a late sidecar is retained | [#4850](#4850 (comment)) | **Not fixed here; tracked in polylogue-g4w5d.** The lane's owner reparse failed its own production-route test (the owner reparses with the sidecar visible, but the published block keeps the preview), so it was withdrawn | none (the failing test moves to the successor) | | 10.F016 Parse the same immutable snapshot that is hashed | [#5546](#5546 (comment)) | Already fixed on master by #5823 (`633ec18ffc`): `parse_prefetch` detects, bounds and parses one `source_snapshot` and seals its `source_sha256`. The lane's copy-based version was dropped in favour of it | master's #5823 regressions | | 10.F017 Fence sidecar inputs with the prepared transcript | [#5546](#5546 (comment)) | **Not fixed here; tracked in polylogue-g4w5d.** The lane's fenced resolver sealed a digest, but a carrier prepared with an absent or older sidecar still published stale text in its own test, so it was withdrawn | none (moves to the successor) | Derived-identity closure members changed (land before a rebuild starts): `browser_capture/models.py`, `schemas/observation.py`, `schemas/observation_runtime.py`, `schemas/source_inference.py`, `sources/codex_state_projection.py`, `sources/dispatch.py`, `sources/live/batch.py`, `sources/live/production_baseline.py`, `sources/live/watcher.py`, `sources/origin_specs.py`, `sources/retained_assembly.py`, `sources/revision_backfill.py`, `sources/source_acquisition_components.py`, `storage/sqlite/agent_thread_state.py`, `storage/sqlite/archive_tiers/revision_governance.py`, `storage/sqlite/archive_tiers/write.py`, `surfaces/payloads.py` (all under `polylogue/`). `sources/live/admission.py` leaves the closure. Manual token: `_PARSER_FINGERPRINT` moves to `live-batched-v5` (master took v4 in #5823). ## Verification All runs used AgentCTL declared operations. Final head `c2335d6116`, on master `633ec18ffc`. - `verify_quick` (job 3433 at `9e7b3aa4a7`, plus the pre-push gate at `c2335d6116`): `verify: PASSED exit=0`. The hosted `ci/circleci: quick-gate` passes. - `pytest_focused -- -n 4 <184 affected test files>` (job 3434 at `9e7b3aa4a7`) stopped at the operation's 2 h limit after 5053 passed and 52 failed; the pool ran it on one xdist worker. The 40 files it did not reach ran in job 3556: 745 passed, 24 failed. The fixture change since then was run in job 3566. - Every failure in those runs is inherited or load-dependent: - They fail identically on master in a detached worktree (`pytest_focused -- <ids> --on-default-branch`): jobs 3383, 3402, 3411 at `5d56c3a26f`, and jobs 3517, 3555, 3560, 3569 at `b384edcec9`. Examples: `test_repository_lifecycle_laws`, `test_marks_identity_preserving`, `test_browser_capture` (daemon-required facade route), `test_query_composition_laws`, `test_raw_observation_derivation` SQLite cases, `test_archive_ingest_shared_raw`, `test_observation_runtime::test_structured_raw_only_sidecar_is_observed_by_normal_source_inference`, `test_synthetic_wire_support`, `test_enums::test_origin_values_match_archive_issue_contract`, `test_tutorial`, `test_write_path_state_machine::test_cascade_excision_removes_rawless_inherited_child`. - Or they pass alone on this branch: `test_daemon_status` FTS readiness (job 3530) and `test_daemon_cli::test_daemon_watcher_hints_wake_fair_intake_and_canonical_derivation` (job 3558). - Failures this branch caused were fixed here: the MCP delete test, the ZIP whole-blob-detection law, the F023 and F034 lane tests, the `zip_reacquisition_payload` rename, and the Codex contradiction fixture (`test_parent_session_accounting`, 7 passed in job 3566). **After rebasing onto master `5ebcfe59d2`** (head `2707271fa5`): #5842 moved currency to receipt order and #5846 moved backup and blob restoration, so the rebase merged those by hand and extended 10.F039 to raw derivation's ZIP blob restoration. - `verify_quick` job 3655 and the pre-push gate: `verify: PASSED exit=0`. - `pytest_focused -- -n 4 <24 files covering backup, blob restoration, retained assembly, and Codex lineage>` (job 3656): 703 passed, 11 failed. All 11 are inherited or load-dependent. The five `test_live_batch_support` cases and `test_daemon_operation_route::test_cancelled_long_delete_retains_writer_until_blocked_apply_releases` hit 120 s timeouts under the loaded pool and pass alone on this branch (jobs 3849, 3890) and on master (jobs 3774, 3889). `test_archive_maintenance::test_bench_blob_gc_dry_run_candidate_scan` fails on master too (job 3889). The rest were classified above. ## Self-review Checklists re-read: `docs/review/codex-review-guide.md` and the orchestrate worker contract. Four passes. Findings from passes 1 and 2 (including those the full test run surfaced) were fixed or withdrawn in this PR; the final pass over the rebased diff found nothing new. **Pass 1 findings (fixed):** (a) 10.F023 was incomplete: the source-walk stream stamped each record with its own `now()`, so the ordinal rule never applied off the daemon route (`acquisition_streams.py`). (b) The daemon ZIP route kept its own copy of the provider sniff (`live/batch.py`). (c) MCP returned `cancelled`, `timed-out`, `degraded`, and `disconnected-before-acceptance` envelopes as results, and the CLI kernel and MCP each held their own literal indeterminate set. (d) MCP classified postmortem/pathology gaps inline instead of in one owner. (e) The WIP outcome tests asserted message wording. (f) `agent_thread_state._write_rows` executed caller-supplied SQL that the census cannot see. (g) `_PARSER_FINGERPRINT` was not bumped although excluded `.jsonl.txt` cursors could never revive. **Pass 2 findings (fixed):** (h) Running the lane tests showed that 10.F013 and 10.F017 never passed, on the lane or here. They were withdrawn to polylogue-g4w5d rather than shipped. 10.F016 had meanwhile landed on master (#5823). (i) The rebase onto master's backup `recover` needed exact bytes, which the digest-only unit lacked; recovery now streams through `open_replayed_zip_unit`. (j) Master added a test on the removed `zip_reacquisition_payload`. (k) Retained ZIP member names were wrong (10.F023, above). (l) Two tests encoded the old contracts: the MCP delete without a preview, and a whole-blob-detection law that forbade the bounded sniff. (m) The F034 test counted the prefetcher's one per-phase snapshot as a per-member scan. 1. ✓ **Siblings and owners.** ZIP admission: `grep -rn "sniff_zip_provider(" polylogue` shows the single call inside `zip_member_admission`; the source walk, retained acquisition, production baseline, and daemon ZIP route all use it. The source-only ZIP route deliberately interprets no bytes and keeps declared-path admission. Indeterminate outcomes: one `DAEMON_INDETERMINATE_OUTCOMES`, read by `cli/operation_kernel.py` and `mcp/server_cutover.py`. Insight outcomes: `postmortem_outcome`/`pathology_outcome` own the decision; the CLI analyze routes carry the same pre-existing gap, filed as polylogue-t4115. Delete consent: every `delete_session_safe(` caller passes `preview_ref` (grep: daemon/http.py, api/archive.py, mcp/server_cutover.py, tests). 2. ✓ **The fix itself.** The new MCP refusal path returns typed `error_json` with the daemon's code; `DaemonMutationIndeterminateError` reaches `_exception_to_error_json`, which serializes it (`test_shared_exception_boundary_preserves_identity_without_internal_paths`). The opener's `LookupError`, `OSError`, `BadZipFile`, and `ContentIdentityRefusal` are caught at the one `recover` call and recorded as an unproven `error:<type>`, not an escape. 3. ✓ **Memory and limits.** A container candidate holds digests and an opener, never bytes; recovery streams into `stage_exact_blob` (`test_full_evidence_backup_streams_a_recovered_whole_zip_member` refuses any unbounded `ZipExtFile.read`). No new cap or timeout on valid input; the native host's 5 s idle bound is per socket step, and a slow receiver is retried on the next health check. 4. ✓ **Cost per unit.** 10.F034 replaces the per-member linear key scan with a dict. 10.F030 moves the archive-wide FTS audit out of the per-component loop. Residual: `read_spawn_parents` scans a scope's invoked edges twice per export write (scoped and unscoped); this is proportional to graph size, per export rather than per session, as before. 5. ✓ **Interruption.** MCP cancellation still cancels the submitted request id; `_daemon_operation`'s cancel loop is unchanged. The late-sidecar reparse (10.F013) is withdrawn, so this PR adds no new multi-step live state. 6. ✓ **Ordering and races.** The acquisition time is one value per ZIP pass. 10.F016's single-snapshot parse is master's (#5823). The 10.F017 sidecar race stays open in polylogue-g4w5d. 7. ✓ **Failure classification.** A live SQLite export fault maps to `decode_failed unreadable_source`, the same classification an unreadable file already had. Receiver attestation separates `receiver_unreachable` (retry) from `receiver_authentication_failed`. 8. ✓ **Silent outcomes.** Postmortem/pathology now carry `empty`/`degraded` with named gaps (`match_cap_exceeded`, `session_profile_unavailable`, `session_digest_unavailable`, `longest_tool_gap_unavailable`). An opaque ZIP attachment reports `intentionally_excluded` rather than vanishing. 9. ✓ **Cleanup on failure.** The live snapshot scratch directory is removed in `finally`; the backup package staging root is removed as before; the ZIP opener closes its `ZipFile` on every exit. 10. ✓ **Identity and keys.** The ChatGPT census key is the parser's own id rule (`chatgpt.py:3104,3133`). `MemberCandidate.open_payload` is `compare=False`, so candidate identity stays its digests. Codex parents are read in the rollout's install root; unscoped reads answer only where every root agrees. 11. ✓ **Lossless transforms.** The older-export fold keeps the current export's rows and adds only superseded rows it names; ranking is by durable receipt order. 12. ✓ **Degenerate inputs.** Absent and empty `tool-results/` digest to the same population, which is also what the retained tier records. A ZIP with only opaque members is `intentionally_excluded`. A zero-finding complete pathology scope is `empty`. 13. ✓ **Consumers.** Removed or renamed: `replay_zip_entry_acquisition_payloads`, `zip_reacquisition_payload`, `delete_session_product`, `sources/live/admission.py`, `_write_rows`; grep count 0 for each in polylogue/tests/devtools/docs. `docs/api-parity.md` was regenerated; the closure baseline dropped `admission.py`; `docs/atlas/mcp.md`, `docs/daemon.md`, and `docs/browser-capture.md` describe the new contracts. 14. ✓ **Tests and stubs.** Monkeypatch targets follow the moved sniff (`test_live_batch_support.py` now patches `source_acquisition_components.sniff_zip_provider`). Each new test names the change that turns it red in its docstring (e.g. per-record clock in `test_source_walk_stamps_one_acquisition_time_per_zip_pass`, whole-member `read()` in the backup streaming test). 15. ✓ **Trust boundaries.** The bearer never crosses the socket before the receiver proves possession (HMAC with a domain separator). The MCP indeterminate payload exposes only the request id, not the internal path (`test_shared_exception_boundary_preserves_identity_without_internal_paths`). Generic list: 1. ✓ Each of the 20 fixed findings has a named production-route regression in the table; 10.F038 is resolved by removing the unwired state machine, since its durable owner is the raw row plus the `raw_payload` receipt. 10.F016 cites master's #5823. 10.F013 and 10.F017 are unmet here and stay open in polylogue-g4w5d, with the evidence from the withdrawn attempt. 2. ✓ Sibling search, by grep: `sniff_zip_provider(`, one call site; `DAEMON_INDETERMINATE_OUTCOMES`, two readers; `delete_session_safe(`, three production callers, all passing `preview_ref`. 3. ✓ Predecessors are deleted with their tests (`tests/unit/sources/test_admission.py` is removed). 4. ✓ Failures are typed and visible: MCP errors carry codes; backup recovery records `error:<type>`/`inexact_payload`; outcomes carry named gaps. 5. ✓ Each new test fails when its behavior is removed, as stated in its docstring. 6. ✓ No secrets or private data: fixtures are synthetic (`synthetic-*` ids, tmp paths). ## Residuals - 10.F013 and 10.F017 are not fixed. They are tracked in polylogue-g4w5d with the withdrawn attempt's evidence (bundle and patch in the finisher scratch, and the failing regression tests). - CLI `analyze --postmortem/--portfolio` still emit no terminal outcome (pre-existing): polylogue-t4115. - `read_spawn_parents` scans a scope's invoked edges twice per Codex export write. The cost is proportional to graph size, per export rather than per session. - `sniff_zip_provider` inspects at most `_ZIP_SNIFF_MEMBER_LIMIT` members. The limit is pre-existing, and the inbox routes now share it. - `_PARSER_FINGERPRINT` moves to `live-batched-v5`, so the next watcher pass re-examines every live file whose cursor carries v4. - Many tests in the affected selection fail identically on master (listed under Verification); they are outside this PR's scope and not fixed 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]>
Summary
Admit JSON and JSONL through retained, blob-backed worker preparation without choosing the live or replay route by file size.
Problem
The live watcher used an 8 MiB threshold and provider whitelist for JSON documents. A supported document could be retained below that boundary but refused or silently excluded above it. Retained replay also returned to a bounded inline payload cache for ordinary JSON. Duplicate byte content from different paths could exchange path-dependent prepared sessions, and a slow JSON worker could defer before the observed bytes were retained.
Solution
Select JSON/JSONL preparation by source shape, capture raw bytes before a pending worker defers, and bind worker results to the captured blob revision. Derive provider identity from those captured bytes and reject stale success or error results. Carry preparations and write outcomes by source path and record identity rather than blob hash alone; identical bytes can then preserve distinct fallback IDs and cursor outcomes. Retained JSON replay uses sealed worker carriers, sharing one carrier only when its identity inputs match.
Verification
devtools verify --quickpassed: receipt20260926T205933Z-quick-3783726-9981e538.20260926T203407Z-focused-test-3687384-32fdf2a4), worker failure (20260926T203449Z-focused-test-3689912-d2c6297c), deferred fair retry (20260926T201435Z-focused-test-3642707-7819de42), identical-byte mixed outcomes (20260926T205715Z-focused-test-3767736-3771f380), duplicate paths/pending unlink (20260926T205853Z-focused-test-3780251-7d1a7a2b), and ZIP/Antigravity compatibility (20260926T210452Z-focused-test-3805803-624ec546).Residual
Whole-document JSON still materializes in worker memory, and the separate raw-materialization owner retains a 64 MiB limit. Those limits remain open in
polylogue-9m93s/polylogue-i07pw; this change is not whale-scale qualification. Dead-worker scratch cleanup during a long run is tracked separately inpolylogue-n8ssw. No archive construction was performed.