Repository navigation
fix(daemon): raw materialization refuses only the broken source paths - #4700
Conversation
The frontier proof now attributes its refusal to exact source paths: violation-named paths (cursor ahead of accepted material, broken head chain) are excluded from the materialization pass and recorded as retryable raw_parse_recovery debt; authority gaps are admitted because materializing the path is what resolves them; a refusal no path explains still blocks the whole pass. The trickle drain, the whale pass, and the raw_parse_recovery stage share the attribution; a whale seed on a refused path is a typed refusal instead of an empty clean pass. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
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. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ce6d0f1a7
ℹ️ 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".
|
Verification: focused run on the branch head via the host pytest slot (pueue task 2168831) — 17 passed, 0 failed. Quick gate green on the same tree. 🤖 Generated with Claude Code |
…o refuse (#4704) ## Summary Four admission defects that each left the raw-frontier source-selection gate with a row it could neither compare nor settle, so a fresh daemon refused its whole catch-up backlog. ## Problem Fresh-root rehearsals stopped ingesting with `live watcher source-selection gate blocked: N cursor/head authority row(s) could not be compared`. Four distinct causes: - **polylogue-6vacn** — Gemini CLI writes one session as several complete checkpoint files that share a `sessionId` and no byte prefix (`session-2026-04-02T10-09-56cb9ec1.json` and `…T10-12-…` carry the same id with different bytes). A byte-revision cohort over that logical key can only fail to order them, so admission logged `no unique byte-revision candidate accepted` and dropped through, leaving both raws `quarantined` with no receipt of any kind for the gate to read. - **polylogue-6q16u** — a quarantine was lifted the moment the watcher noticed a path deserved re-deciding, before anything was admitted. The row then sat `excluded = 0` carrying its old byte offset until the next acquisition pass, and the raw-frontier cursor map reads exactly that shape as committed ingest authority with no accepted head. A live database whose stat changes on every poll re-entered that window on every poll. - **polylogue-lqo6a** — both `raw_artifacts` upserts replace `artifact_kind` unconditionally on `artifact_id` conflict, so an ordinary path classification landing on a terminal failure carrier's id takes the row back. `_terminal_artifact_paths` then reads the path as neither terminal nor headed, forever. - **polylogue-6xqhp** — a cursor advanced to EOF for a path with no `raw_sessions`, `blob_refs`, `history_sidecars`, `raw_artifacts` or `source_items` row: bytes consumed, nothing retained, and no route able to re-read them. ## Solution - `Origin.GEMINI_CLI_SESSION` declares `frontier_kind = "whole-snapshot"`, a new value on the existing source-level continuation law meaning successive observations are competing complete snapshots rather than continuations. Admission routes such an origin through the same typed membership authority browser captures already use, which yields one accepted head and a typed decision for the rest. - An unorderable byte cohort with no retired siblings now records `DEFERRED_CAS_FRONTIER` failure evidence and defers, instead of dropping through and leaving an untyped quarantined raw. - `_needs_work_from_state_uncorroborated` reports the fresh attempt without clearing `excluded`. The quarantine is lifted by the cursor write of an ingest that actually retained something, so a path that fails again stays quarantined and a never-admitted path never presents a stale byte offset as committed authority. - Both `raw_artifacts` upserts carry a shared guard (`terminal_carrier_overwrite_predicate`) refusing an ordinary classification that would replace a terminal failure carrier; only failure-evidence writes may change a carrier's kind. - `_record_full_cursor` refuses to advance when the source tier holds no row for the path, recording retryable `raw_parse_recovery` debt instead. The raw-id lookup it guards on was already being performed. Deliberately not done: no gate exemption is widened, and the per-path drain refusal owned by #4700 is untouched. ## Verification Fresh daemon on a scratch root over a frozen read-only copy of only the gemini-cli and codex-state sources plus the three Claude JSONL files named in polylogue-lqo6a (789 MB, `/realm/tmp/work/lane-raw-admission`), production route `polylogued run`: ``` refused by cursor authority: 0 no unique byte-revision candidate: 0 broken_heads: 0 gemini-cli-session:56cb9ec1-ece5-4705-ac40-a3e1b1569c25 -> 1 head both raws of the colliding pair: raw_membership_census status = complete refusing to advance cursor past bytes that left no source evidence: 0 ``` Before this branch the same pair produced two untyped quarantined raws, a broken head, and repeated whole-backlog refusals. `devtools verify --quick` — all 13 gates ok; `render all --check` reports nothing out of sync. Residuals: one `source_raws_without_accepted_head` gap remains for the second file of the pair. That is a gap, not a violation — the path is typed and materializing it is what resolves it — and #4700 is what stops gaps from blocking. `state_5.sqlite` was still awaiting `finalize_codex_state_snapshots` when the rehearsal's time budget ended; that finalizer is unchanged here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
Codex review threads on this PR whose cited code is gone (checked against master at 23f91a5):
Resolving these threads. |
|
Closing out open Codex review threads on this PR (evidence checked against master at 0914f89):
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 5d56c3a):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Summary
Raw materialization now refuses only the source paths whose authority the frontier proof names as broken and converges every other raw; each refusal is recorded as retryable
raw_parse_recoveryconvergence debt for that path. The daemon trickle drain, the whale pass, and theraw_parse_recoverystage all use the per-path attribution; the reindex preflight keeps the global gate.Problem
Rehearsal-4 (
/realm/tmp/work/rehearsal-4) logged 906raw materialization source-selection gate blocked: 2 active index raw seed(s) have a broken predecessor chain ...; 8 cursor/head authority row(s) could not be compared; ...refusals from_drain_raw_materialization_once; every drain since 14:05Z refused the whole backlog (raw_total 1263 vs raw_materialized 624). Read-only diagnosis of the archive before it was wiped:56cb9ec1,44d35feb) each present in two files with one session id. The index holds a byte head (selected_baseline, "newest unique byte-proven full baseline") whose raw the source tier now records asrevision_authority = quarantined; the sibling raws are quarantined full rows with no receipt. Tracked in polylogue-6vacn (evidence appended).logs_2.sqlite,thread_history_1.sqlite) whose unsupported-candidate exclusion was revived by the live database's changing mtime and then refused by the per-path watcher gate before it could be re-excluded (a loop this PR closes: gaps are admitted); 3 Claude JSONL files with onlysummary/file-history-snapshotrecords, refused with a typed parse error whose terminal failure carrier was overwritten by acoordinator_session_streamclassification (polylogue-lqo6a); 2 gemini sibling files from the pairs above; 1tool-results/sidecar whose cursor advanced to EOF with no source-tier evidence (polylogue-6xqhp).Only the gemini pairs are violations; the other six are authority gaps that processing resolves and that refusal keeps alive.
Solution
RawFrontierBlockedPathsseparatessource_paths(violation-named, refused) fromgap_source_paths(admitted);raw_frontier_source_selection_refusalexposes the attribution.repair_raw_materializationand both candidate selections takeexcluded_source_paths._drain_raw_materialization_once/ whale pass: unattributed refusal still raises; attributed paths are excluded and recorded as debt; a whale seed on a refused path is a typed refusal rather than an empty clean pass.raw_parse_recoverystage: only the path's own refusal defers it.Verification
devtools test tests/unit/storage/test_raw_retention.py tests/unit/daemon/test_raw_parse_recovery.py tests/unit/storage/test_repair.py tests/unit/daemon/test_daemon_cli.py -k "blocked_source_paths or drain_raw_materialization or whale_writer_route or raw_parse_recovery_stage or refused_source_paths or deferred_cursor"— queued on the host pytest slot as pueue task 1666 (polylogue:test:2168831); this line is updated with the result when it completes.devtools verify --quick(format, lint, mypy, generated surfaces, layering, patterns, doc-commands, schema-manifest, oracle-integrity, testmon-selection, consumer-reachability, timestamp-doctrine, schema-privacy): all gates ok after provisioning the worktree venv (uv sync --extra dev --group audit --frozen; a.claude/worktreescheckout has none by default, polylogue-8dfcy).devtools render all --check: noout of sync.python -m devtools.verify_atlas: 149 stale findings, all pre-existing —docs/atlas/daemon.mdand00-core.mdcitedaemon/cli.py/convergence_stages.pyat verification commit 24be873, which 14 earlier commits already changed; not re-verified here.Residuals
🤖 Generated with Claude Code
https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid