Skip to content

fix(sources): reconstruct durable append frontiers - #4549

Merged
Sinity merged 1 commit into
masterfrom
fix/durable-append-frontiers-2
Sep 2, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/durable-append-frontiers-2

Conversation

@Sinity

@Sinity Sinity commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Re-land of #4520 (bead polylogue-aex0), flattened onto current master after the original branch was auto-closed by a force-push to master's tree. Content unchanged apart from a docstring naming the current codex header helper.

Bead: polylogue-aex0

🤖 Generated with Claude Code

https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz

Flattened from feature/fix-durable-append-frontiers (15 commits, PR #4520,
auto-closed by a bad force-push) onto current master; lane text excluded.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 2d672279-c2f3-4c47-a74f-485048981407


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Sinity
Sinity merged commit db182b6 into master Sep 2, 2026
2 of 3 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 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
📝 Code Review ✅ Completed 2026-09-02T16:57:11.017096Z 373d090 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 deleted the fix/durable-append-frontiers-2 branch September 2, 2026 16:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 373d090e65

ℹ️ 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".

Comment thread polylogue/sources/live/batch.py Resolved
Comment thread polylogue/sources/sqlite_snapshot.py Resolved
Comment thread polylogue/sources/live/batch.py Resolved
Sinity added a commit that referenced this pull request Sep 3, 2026
…4587)

## Summary

Fixes the eleven verified Codex review findings in the sources / daemon
/
operations sweep. Each was re-confirmed at this branch's base before
being
changed; none were taken on faith from the sweep file.

## Findings and what changed

| # | PR | Site | Claim | Action |
| --- | --- | --- | --- | --- |
| 1 | #4455 | `daemon/backup.py` `_source_recoverability_proofs` | a
full-snapshot append row is hashed as a byte window | fixed: falls back
to the full prefix `[0, end)` when the window does not prove the blob |
| 2 | #4457 | `operations/append_acquisition_replay.py` | unbounded
`handle.readline()` during replay | fixed: bounded at 1 MiB, matching
live acquisition |
| 3 | #4506 | `sources/live/deferred_cursor.py` | semantic frontier
re-derived from current bytes with no comparison to retained evidence |
fixed: recomposed frontier must reproduce the recorded **body** digest |
| 4 | #4506 | `sources/origin_specs.py` | ChatGPT derives
`inheritance_branch_point` from `mapping.parent`/`mapping.children` |
fixed: declared structurally absent |
| 5 | #4515 | `sources/live/source_selection.py` | no typed-vs-generic
tiebreak, so a typed source loses ownership to a nested generic root |
fixed: ownership resolved among sources that accept the path |
| 6 | #4539 | `sources/live/watcher.py` | tool-outcome semantics changed
without a parser-fingerprint bump | fixed: `live-batched-v2` ->
`live-batched-v3` |
| 7 | #4549 | `sources/live/batch.py` | legacy promotion commits durably
before append planning succeeds; resynthesized cursor never returned |
fixed: promotion deferred behind a successful plan; cursor handed back
to the caller |
| 8 | #4549 | `sources/sqlite_snapshot.py` | `sqlite_sequence` excluded,
so insert-then-delete on AUTOINCREMENT yields no digest change | fixed:
AUTOINCREMENT state included |
| 9 | #4549 | `sources/live/batch.py` | full-head Claude authority
computed from the live file | fixed: live prefix must reproduce the
retained blob digest |
| 10 | #4554 | `parsers/base_support.py` -> write boundary | idless
model turn yields `("model_output", None)` and the write rejects the
whole session | fixed at the write boundary (see note) |
| 11 | #4558 | `sources/origin_specs.py` | fingerprint memo keyed on
`(path, mtime, size)` | fixed: keyed by content digest |

None were refuted. Master moved while this work ran; `git diff` over all
eleven files across that range is empty, so every cited line still
described
current code.

### Finding 1: live exposure remains unconfirmed

The code-level defect is real and now covered by a test. Its **live**
reachability is not established: every current production caller of
`admit_raw_observation` (`revision_governance.py:825,3995,4126`) passes
`prior_head=None`, which never reaches the append arm that writes the
full-payload-with-tail-offsets shape. This fixes the defect without
claiming
it was reachable in production.

### Finding 6: schema-regime classification

Classified as **none of the schema-regime classes** -- it is not a
schema
change. There is no DDL edit and no derived-tier version bump, so no
`DerivedDeltaClass` declaration in `storage/sqlite/lifecycle.py`
applies; that
table is keyed on index-schema version pairs.

It is a *parser-semantic* change, whose declared route is the
fingerprint bump
itself. `base_support.py` is already inside the origin-spec
parser-semantic
closure (verified: `_semantic_source_paths` for a parser resolves it),
so the
origin-scoped fingerprint recomputed on its own with #4539. The gap was
only
the live watcher's hand-written literal. Bumping it marks every existing
live
cursor as stale, and the watcher routes those sources back through parse
on
its next pass -- the production convergence route. Nothing forces a
rebuild by
hand.

**Operational consequence:** the first daemon pass after this lands
re-ingests
every live-watched source once. That is the intended cost of the
correction,
but it is a real one.

### Finding 10: fixed at the write boundary, not the parser

The sweep points at `base_support.py:633-635`. The parser genuinely
cannot fix
this: `attachment_from_meta` takes `message_id: str | None` and there is
no
identity to name when it is `None`. The stored message id exists only at
the
write boundary, which is where the producer is now supplied -- covering
both
the parser-declared and role-derived paths. The fallback completes
missing
provenance and never overwrites parser-supplied evidence.

### Findings 3 and 9 are one fix

Both derived Claude authority from bytes on disk at planning time rather
than
from retained evidence, so a rewrite preserving the prefix length
inherited
the previous observation's authority. Finding 3 (deferred cursor)
compares the
recomposed frontier's body digest against the recorded one; finding 9
(full-head resynthesis) requires the live prefix to hash to the retained
blob.
The reconstructed-chain branch already proved its prefix byte by byte
and is
left alone.

Finding 3's check is deliberately on the **body**, not the whole
frontier
token: `ClaudeSemanticFrontier` is "replaceable header plus stable
body", and
an equality check on the token broke
`test_deferred_claude_cursor_rebases_frontier_after_header_rewrite`,
which
protects legitimate rebasing onto a rewritten header.

## Verification

Anti-vacuity was verified mechanically, not asserted: with all ten
source
files reverted to master and the new tests kept, every new test fails.

```
git checkout <master> -- <the ten source files>
devtools test tests/unit/sources/test_reviewed_acquisition_defects.py \
  tests/unit/storage/test_attachment_idless_model_turn.py \
  tests/unit/sources/test_live_deferred_append_dedup.py \
  tests/unit/sources/test_live_append_cursor_resynthesis.py \
  tests/unit/daemon/test_backup.py -n 2
-> 15 failed, 79 passed
```

The 15 are the 13 new tests plus the 2 existing expectations this change
updates. `test_backup_still_proves_a_window_shaped_append_row`
**passes** on
master -- it is the control proving finding 1's fix did not
over-generalize
into "always read the full prefix".

With the fixes restored, the same selection is green:

```
devtools test tests/unit/sources/test_reviewed_acquisition_defects.py -n 2         -> 5 passed
devtools test tests/unit/sources/test_live_deferred_append_dedup.py -n 2           -> 8 passed
devtools test tests/unit/sources/test_live_append_cursor_resynthesis.py -n 2       -> 13 passed
devtools test tests/unit/daemon/test_backup.py \
  tests/unit/storage/test_attachment_idless_model_turn.py -n 2                     -> 68 passed
devtools verify --quick                                                            -> all 12 gates ok
devtools render all --check                                                        -> exit 0, no "out of sync"
```

Collateral selection over the consumers of the changed modules (live
watcher,
source snapshot, source differential, catchup planning, codex state, and
the
four attachment suites):

```
devtools test tests/unit/sources/test_live_watcher.py \
  tests/unit/sources/test_source_snapshot.py \
  tests/unit/sources/test_source_differential.py \
  tests/unit/sources/test_live_catchup_planning.py \
  tests/unit/sources/parsers/test_codex_state.py \
  tests/unit/storage/test_attachment_acquisition.py \
  tests/unit/storage/test_attachment_first_class_ids.py \
  tests/unit/storage/test_source_attachments.py \
  tests/unit/storage/test_attachment_relink.py -n 2
-> 1 failed, 218 passed
```

After the fixture fix below, the one affected file was re-run on its
own:

```
devtools test tests/unit/sources/test_live_watcher.py -n 2   -> 125 passed
```

The other eight files were green in the combined run and are untouched
by
that fixture change; no combined re-run was made, so the "219" total is
not
claimed as an observed number.

The single failure was
`test_parser_fingerprint_change_triggers_reingest`,
caused by this branch and not inherited. It simulated a fingerprint
change by
monkeypatching `_PARSER_FINGERPRINT` to the *literal*
`"live-batched-v3"`,
which finding 6 makes the real value -- so the patch became a no-op, no
change
was simulated, and no reingest fired.

The bump is not miswired; the fixture collided with it. The sentinel now
derives from the real constant (`f"{_PARSER_FINGERPRINT}-changed"`), so
the
test asserts the same behaviour and cannot silently no-op on a future
bump.
Finding 6's own test
(`test_superseded_parser_fingerprint_refuses_append_
planning`) independently proves a `live-batched-v2` cursor refuses
append
planning, and went red when the constant was reverted.

Selected scope only: this proves the selected files, not the corpus.

## Residual risk

- **Finding 6 forces a one-time live re-ingest** of every watched source
on
  the next daemon pass.
- **Finding 8 changes `sqlite_logical_revision`** for every
AUTOINCREMENT
database, so previously recorded identities differ once and those
sources
  re-acquire on next observation. Self-healing, but not free.
- **Finding 5 changes ownership for overlapping default roots** beyond
the
  reported case: a `.db` under `~/.codex/sessions/` now resolves to
`codex-state` rather than `codex`, because only `codex-state` accepts
it.
That looks correct, but it is a behaviour change the finding did not
name.
- **Finding 7** delays promotion until planning succeeds, not until the
plan
is *applied*. Closing that gap needs a larger refactor of the ingest
stage.
- **Finding 11** reads parser sources instead of stat-ing them. A
per-process
digest cache keyed on full inode identity including `st_ctime_ns` (which
`os.utime` cannot restore) keeps this correct and measurably faster than
before: 0.818 ms/call warm vs 1.343 ms/call for the previous stat-keyed
  signature, over a 449-file / 9 MB closure.
- Three tests are reported red on master itself
  (`test_archive_tiers_api_session_costs_read_index_tier`,
  `test_existing_same_version_ops_database_receives_additive_call_log`,
`test_record_context_delivery_requires_initialized_user_tier`). None are
in
  files this branch touches and none were in the selections run here.

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sinity added a commit that referenced this pull request Sep 14, 2026
…ts (#5171)

## Summary

Eleven unrelated failures on `master`, triaged one at a time. **Four
were product defects** and are fixed here; five were stale tests, each
naming the change that made it stale; two are left red with their cause
established.

## Evidence

Full-corpus `verify_all` on frozen `master` (`890a2921e`), job 1570,
receipt `.cache/verify/runs/20260914T200510Z-all-4027943-f8bc83ff`,
22,524 selected, **147 failures with zero schema skew**.

## Per-failure classification

| # | Failure | Classification |
| --- | --- | --- |
| 1 |
`test_verified_backup_avoids_rehashing_scratch_blobs_after_validation` |
**Stale test** (harness blind after #5147) |
| 2 |
`test_discovered_project_toml_capability_keys_are_refused_and_logged` |
**Product defect** (#5134) |
| 3 | `test_seed_demo_archive_creates_ready_queryable_archive` |
**Product defect**, filed — **left red** |
| 4 | `test_seeded_archive_fixture_resolves_through_the_registry` |
Order-dependent, not reproducible |
| 5 | `test_a_session_absent_from_the_index_is_still_tombstoned` |
**Product defect** (inherited from #5154) |
| 6 | `test_archive_ingest_large_zip_artifact_streams_to_blob_reference`
| **Product defect** (#5117) |
| 7a | `test_every_live_declaration...[blob-integrity]` | **Product
defect** |
| 7b | `test_every_live_declaration...[session-fingerprint-stamps]` |
Poisoned shared cache, filed |
| 8 | `test_append_plan_resynthesizes_an_append_kind_head` | **Stale
fixture** (polylogue-u19l) |
| 9 | `test_full_ingest_writes_archive_with_route_observability` |
**Stale test** (#5049) |
| 10 |
`test_tier_prototype_is_atomically_published_and_restored_read_only` |
Order-dependent, not reproducible |
| 11 | `test_declared_devtools_route_runs_the_real_seeded_check` |
**Stale test** (#5097 deleted the route) |

## The four product defects

**(6) A ZIP member's bytes were dropped entirely.** #5117 correctly
threaded `max_record_bytes` into the JSONL classification probe, but
`scan_jsonl_session_artifact`'s oversized-record branch *synthesises* a
`parse_as_session=True` classification ("uninspected oversized provider
JSONL record retained for streaming parse"). That retention rule exists
for a raw whose only other classifier is a weak path heuristic. Used as
*positive* evidence in `_admit_non_session_zip_artifacts`, it overrode
the OriginSpec-declared terminal artifact rule — so a
`subagents/workflows/.../journal.jsonl` member was routed as a session,
refused by polylogue-9ykn for want of positive conversational evidence,
and **the bytes were lost** (`raw_artifacts=0`, `raw_sessions=0`). An
inspection that read nothing has not answered the narrower question this
caller asks. The path rule now stands and the skipped inspection is
named via `sources.zip.artifact_probe_unbounded` — the same posture
#5117 chose for its own ZIP probe ceiling. Verified outside pytest:
`raw_artifacts=1`, `blob_size == len(payload)`.

**(2) A refusal that would not say what it refused.** #5134 emitted
`keys=rejected` (a `list`) on `config.capability_keys_refused`, but
`keys` is not in the structured-log allowlist (`logging_fields.py`), so
`emit` dropped it — and even registered, `_scalar` would have reduced a
list to `<list>`. Registered a `config_keys` token field and emit the
joined names. The field is drawn from a closed set of declared setting
names, never a user value.

**(7a) A first-party control file reported as blob corruption.**
`blob_gc_index_watermark` writes
`.polylogue-index-liveness-watermark.json` into the blob namespace root,
but `BlobStore.iter_namespace` exempted only `.polylogue-blob-namespace`
and `.staging` — so its own control file surfaced as a *critical*
`invalid_namespace_entries` finding telling the operator to "quiesce
blob writers". `blob_store` now owns the reserved-name set (it is the
module that decides what may sit in that root) and the watermark module
imports it, so the two cannot drift.

**(5) A tombstone that committed and then aborted.** #5148 added the
tombstone-without-index-row path; #5154 then made
`ArchiveStore.delete_sessions` resolve every id and raise `KeyError` for
one with no row. The apply committed the durable suppressions and *then*
raised, losing the receipt for a tombstone that had already landed. Only
ids PREPARE recorded in `present_in_index` now reach that call — exactly
the complement of the `tombstoned_without_index_row` set the receipt
already names, and deleting a row that is not there is a no-op anyway.

## The stale tests

**(1)** #5147 (`ae9149902`) replaced `blob_path.read_bytes()` in
`_verify_archive_file_set_backup` with a 1 MiB chunked stream.
`tests/infra/backup_read_counter.py` instruments only `Path.read_bytes`
and `backup._sha256_file`, so the scratch proof read became *invisible*
— the blobs are still read and hashed. The counter now also counts
`Path.open` on blob paths. Anti-vacuity: rereading scratch blobs during
receipt construction doubles `open:scratch`; dropping the restore proof
zeroes it.

**(8)** polylogue-u19l (`f3bbf413a`, carried by #4549) stopped splicing
a synthetic `session_meta` header into Codex append blobs so stored
bytes stay a literal slice of the live file. This one fixture still
wrote `_session_meta + delta` while declaring a 124-byte window over a
185-byte blob, so `verified_reconstructed_prefix_hash` could never match
— every sibling fixture in the file already used literal deltas.
Anti-vacuity: dropping `append_head` from the head-kind guard returns
`None`.

**(9)** #5049 (`73766c276`) added `repair_message_fts_index_sync` to
live full ingest precisely because the `defer_fts=True` contract's
promised repair was never performed — "a freshly ingested 50k-message
session searched as empty" until the next 60s tick. The test still
asserted `indexed == 0`. Anti-vacuity: deleting that call zeroes it.

**(11)** The route it pinned was deliberately deleted by #5097 ("Delete
the dormant verify export command and blob-conservation alias"), whose
no-caller grep missed this test. `devtools verify blob-conservation` now
falls through to the `verify` tier runner, which refuses inside an agent
job and exits 2. The product check is healthy (`referenced_blobs ==
present_blobs == 1`). Retargeted to the one surviving declared route,
`polylogue ops maintenance blob-conservation --output-format json`, and
renamed accordingly.

## Left red, with cause established

**(3) `test_seed_demo_archive_creates_ready_queryable_archive`** — bead
**`polylogue-wrvy2`** (P0, open) is accurate and matches exactly:
`codex-session` declares `topology_capabilities.parent_dispatch.state ==
"structurally-absent"`, so `write.py` never mints
`session_links.parent_tool_use_block_id`, and the `delegations` resolved
branch (`archive_tiers/index.py:1594-1596`) joins on precisely that
column — the row lands as `edge_only`. The bead's open question is
*adjudication*: is the codex capability declaration wrong, or does
`demo/seed.py:845` assert an outcome its own origin forbids? That is a
design decision, not something to settle inside a test-failure sweep.
Confirmed accurate and left red, as instructed.

**(7b) `[session-fingerprint-stamps]`** — not reproducible at head. A
fresh schema-coverage artifact built in-process stamps the current
fingerprints and reports `ok`. The receipt's artifact (`build_id =
git:890a2921`) carries `recipe_id` / `source_semantics_id` /
`archive_schema_id` that no clean process at that commit computes: it
was published into the shared `/realm/tmp/polylogue-seeded-artifacts`
cache by a process with uncommitted product changes, and `build_id`
records the commit but cannot record dirtiness. Filed as
**`polylogue-c4a1o`** (P2).

**(4) and (10)** — pass at head in every run made; the `SchemaSkewError`
appears only in multi-file runs. A prototype-cache hypothesis was
**refuted** empirically: recorded tier prototypes carry an *empty*
`schema_identity` table, so a page copy cannot stamp a stale identity.
Classified as in-process order-sensitive contamination with the
mechanism unlocalised — recorded on `polylogue-c4a1o` as adjacent
evidence, explicitly not as a claim that they share its cause. **Not**
called flaky: no wait is involved.

## Verification

```
devtools test tests/integration/test_backup_verification_read_amplification.py \
              tests/unit/core/test_config_resolution_regression.py \
              tests/unit/sources/test_live_append_cursor_resynthesis.py \
              tests/unit/sources/test_live_batch_support.py \
              tests/unit/storage/test_blob_conservation.py \
              tests/unit/operations/test_mutation_actuators.py \
              tests/unit/pipeline/test_archive_ingest_shared_raw.py \
              tests/unit/maintenance/test_archive_verification.py
devtools test: FAILED exit=1 receipt=.cache/verify/runs/20260914T231245Z-focused-test-159592-60c25774/run.json
  317 passed, 88 failed.
```

Every one of those 88 is the `CHECK constraint failed: native_id IS NOT
NULL OR content_identity IS NOT NULL` class owned by another agent —
parsed from the receipt's `pytest-report.json`, **non-CHECK failures:
0**. They are concentrated in `test_archive_verification.py`, which
builds archives through the affected fixtures. None of the eleven
failures in scope remains red except (3), which is deliberate.

`devtools gate format` / `lint` / `mypy` (2869 files) / `layering` — all
clean.

## Schema closure — **all six product files are IN**

```
IN  polylogue/sources/decoder_zip.py
IN  polylogue/config.py
IN  polylogue/logging_fields.py
IN  polylogue/operations/mutation_actuators.py
IN  polylogue/storage/blob_store.py
IN  polylogue/storage/blob_gc_index_watermark.py
```

**This moves the derived schema identity. It must land before a fresh
rebuild starts, never during one.**

## Residuals

- (3) stays red under `polylogue-wrvy2`; (7b) and the order-dependent
pair under `polylogue-c4a1o`.
- (5) is fixed at the actuator. A session vanishing *between* PREPARE
and APPLY still raises. Whether `delete_sessions` should treat an absent
session as an error at all is arguably the real #5154 question and needs
`archive.py`, which was outside this change's scope.
- (11): `polylogue ops maintenance blob-conservation` prints an `Archive
root: …` banner ahead of its JSON on a `--output-format json` surface.
The test slices from the first brace rather than reaching into
`polylogue/cli/**`; the banner-on-JSON behaviour is untouched and
arguably wrong.

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

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

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

## Summary

Lands the verified part of ChatGPT worker 9's pass over Codex review
findings in `polylogue/sources` (beads polylogue-1tyq5.90, .91, .92; 75
findings). 13 fixes are kept, each with a regression test that fails on
master. The other 62 are recorded below as fixed-already, stale, refuted
or not reached.

## Problem

The findings are Codex P2 review threads on earlier PRs. The kept ones
reproduce on current master:

- ChatGPT extracted-export asset acquisition follows leaf symlinks, so
it archives bytes from outside the export.
- Replay's bounded probe drops the Claude project keys, so a retained
UNKNOWN project whose keys sit past the 8 KiB prefix stays UNKNOWN and
is refused.
- Drive-like lowering drops `source_path` when it reclassifies a Gemini
CLI document, so a matching sidecar is skipped.
- The Drive cache rejects valid `null` JSONL records and large integers,
and leaks its temporary file when a write or close fails.
- Import preflight reports SUPPORTED even when it records a degradation
caveat.
- A lost best-effort `cursor_update` leaves a completed attempt with
`materialized_count=0`.
- Source-only (acquire-only) intake still requires the Antigravity
language server before it keeps `.pb` bytes.
- The JSONL blank-line regex matches every newline-terminated payload,
so the `bytes.count` fast path never runs.
- The ops checkpoint holder looks for `-shm` beside a symlinked `ops.db`
rather than beside its target.
- A sealed, complete cold-build count loses its zero ETA once it stops
advancing.
- Hook paste enrichment checks the write lease against the
index-generation directory instead of the archive root.

## Solution

- `sources/assembly_chatgpt.py`: the walk admits only lstat-regular
files. Each asset is opened with `O_NOFOLLOW|O_NONBLOCK`, checked with
fstat, then streamed with `write_from_fileobj`. Asset refusals are
emitted as one structured event, `sources.chatgpt.asset_refused`.
- `sources/revision_backfill.py`: `docs`, `prompt_template` and
`is_starter_project` added to the probe's retained root keys.
- `sources/dispatch.py`: `_lower_drive_like_payload` forwards
`source_path` through both recursive branches and the Gemini CLI spec.
- `sources/drive/__init__.py`: a successful decode is enough to validate
a cache, and ijson runs in its lossless number mode. One cleanup path
covers temporary creation, write, close and replace.
- `sources/import_preflight.py`: any caveat now reports DEGRADED, which
is still admissible. The bounded-trajectory test expectation changes to
match.
- `sources/live/batch.py`: the completed progress update carries
`materialized_count`. Source-only intake skips the language-server
cohort, so `.pb` files take the ordinary raw snapshot.
- `sources/live/batch_support.py`: the regex no longer treats the empty
line after a final newline as blank.
- `sources/live/cold_build.py`: the holder resolves `ops.db` before
deriving `-shm`. A sealed count at or above its denominator returns ETA
0.
- `sources/live/hook_paste_enrichment.py`: the lease check uses the
configured archive root.

Worker changes not landed:

- `census_parse_stage.py` idle-wait fix: the module has no production
instance and polylogue-rykzt retires it. The live `LiveParseStage` has
no such event pair.
- `parse_prefetch.py` cohort scoping: already on master through #5691
(`_prepare_existing_session_writes(paths=...)`).
- Source-only ZIP provider stamp (92-01): it does not fix the reported
case. The OTel GenAI spec declares a catch-all `.*\.json$` rule, so
`declared_artifact_provider` returns None for every `.json` member,
`tool-results/dump.json` included.
- The worker's `docs(review)` commit: per-finding records belong in this
body, not in tracked files.

## Verification

- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w9 --wait` → job 2346: `verify: PASSED exit=0
... head=edfab65f2749`
- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w9 --wait --
tests/unit/sources/test_codex_debt_w9_regressions.py
tests/unit/sources/test_import_preflight.py
tests/unit/sources/test_drive_source_client.py
tests/unit/sources/test_live_batch_support.py
tests/unit/sources/test_cold_build_generation.py
tests/unit/sources/test_cold_build_durability_policy.py
tests/unit/sources/test_revision_backfill.py
tests/unit/sources/test_dispatch_payloads.py` → job 2347: `passed 470,
failed 1, total 471` at head edfab65. The one failure,
`test_import_preflight.py::test_unidentified_trajectory_rows_keep_distinct_identities`
(a `LogicalExportError` from `parse_trajectory_db`), fails the same way
on unmodified master (jobs 2284 and 2348).
- Proof that the tests fail without the fixes: the final
`test_codex_debt_w9_regressions.py` was copied into a worktree at
unmodified master and run as job 2348, with 17 failures (`17 failed in
21.74s`). That covers every kept finding's test. The 92-13 ETA test
fails only on its complete-count case; its two control cases pass on
both heads, as intended.

## Self-review

- **Sibling sites.** The other asset reader is the ZIP branch, which
reads members, not filesystem paths. `_lower_drive_like_payload` has one
caller and `_enrich_archive_paste_from_hooks` has one. The
cache-validator change covers both Drive routes (byte and streamed).
Other `-shm`/`-wal` derivations elsewhere in the daemon are outside this
finding and are listed as a residual. The 92-01 gap is shared by the
ordinary live ZIP route and `retained_acquisition.py`, which is why the
one-route stamp was dropped rather than landed.
- **Cancellation and shutdown in loops.** No loop or wait was added. The
asset loop keeps its per-file `continue` on `OSError`.
- **Unbounded reads.** Assets still stream through `write_from_fileobj`
under the existing `MAX_UNCOMPRESSED_SIZE` check. The Drive validators
keep their streaming form.
- **Fail-open fallbacks and compatibility shims.** None added.
Source-only `.pb` intake retains raw bytes without parsing, and parsing
still needs the language server once derived tiers return. There is no
alias or dual path.
- **Removed symbols.** None removed. Tests patch `local_agent`,
`tempfile` and `time` directly rather than through attributes the source
modules do not export.
- **Tests prove the production route.** The tests drive `parse_payload`,
`iter_drive_raw_data`, `preflight_import_source`,
`LiveBatchProcessor.ingest_files` / `_ingest_full_paths_sync`,
`jsonl_complete_prefix`, `_hold_ops_checkpoints`,
`enrich_paste_from_hooks` and the retained-UNKNOWN detector
`_detect_unknown_retained_provider`, which is the same private entry
point `test_revision_backfill.py` already uses. The ETA test calls the
`accepted_progress` property on a hand-set generation.

## Per-finding dispositions

Counts: 13 fixed, 0 dropped as not real, 22 fixed-already, 3 stale, 2
refuted, 35 not reached.
Per bead: .90 6 fixed / 6 fixed-already / 2 stale / 1 refuted / 10 not
reached. .91 3 / 5 / 1 / 1 / 15. .92 4 / 11 / 0 / 0 / 10.

| key | disposition | evidence | test |
|---|---|---|---|
| 90-01 (#4803) | fixed | `sources/assembly_chatgpt.py`: Regular-file
lstat admission and no-follow/nonblocking opened-file validation prevent
leaf-symlink and FIFO substitution from being acqu... |
`test_w9_asset_acquisition_rejects_symlink_leaves` |
| 90-02 (#4234) | stale | dead `census_parse_stage.py`, retired by
polylogue-rykzt; live `LiveParseStage` has no such event pair | — |
| 90-03 (#4928) | refuted | `sources/codex_state_evidence.py`: The
requested reconciliation depends on upgrading an earlier archive. This
batch explicitly targets fresh v1 and forbids migrations/... | — |
| 90-04 (#4889) | not reached | `sources/codex_state_evidence.py`:
Same-ID admission still needs an acquisition-state preservation proof;
leave replay/storage reconciliation to follow-up. | — |
| 90-05 (#4229) | stale | `sources/codex_state_evidence.py`:
event_identity and its hook-event emission are gone; Codex thread state
is now projected through codex_state_projection instead. | — |
| 90-06 (#5626) | not reached | `sources/codex_state_evidence.py`: State
snapshot chunks are processed within the same writer ownership; no
bounded writer-handoff implementation supplied. | — |
| 90-07 (#4622) | not reached | `sources/codex_state_evidence.py`:
Backlog is fetched as a whole and consumed in one retained-receipt pass;
replacing this needs end-to-end paging, not a cap. | — |
| 90-08 (#5626) | not reached | `sources/codex_state_evidence.py`:
Replaying a shorter logical state value does not reconcile removed
trailing chunk observations. | — |
| 90-09 (#5581) | not reached | `sources/codex_state_evidence.py`: The
frame consumer still needs explicit cancelled/expired-read propagation
instead of interpreting an empty projection as current. | — |
| 90-10 (#4174) | not reached | `sources/cursor.py`: ZIP skip accounting
counts every physical member, unlike the declaration-aware acquisition
population. | — |
| 90-11 (#4661) | fixed-already | `sources/decoder_zip.py`: Explicit
suffix/predicate callers disable inferred declaration-path widening. | —
|
| 90-12 (#4661) | fixed-already | `sources/decoder_zip.py`: Only strong
artifact declarations widen the inferred member admission route. | — |
| 90-13 (#4661) | fixed-already | `sources/decoder_zip.py`:
Unknown-inbox admission now uses cross-provider strong declarations;
ordinary live ZIP acquisition retains their sidecars. | — |
| 90-14 (#4661) | fixed-already | `sources/decoder_zip.py`: Source-only
ZIP admission supplies is_declared_artifact_path, so declared non-JSON
sidecars are retained. Provider stamping is a separate fin... | — |
| 90-15 (#4721) | fixed | `sources/dispatch.py`: The bounded streaming
document probe retains the three Claude project shape keys, without
retaining their unbounded values. |
`test_w9_retained_unknown_project_is_detected_beyond_prefix` |
| 90-16 (#4720) | fixed | `sources/dispatch.py`: Drive lowering forwards
source_path through recursive wrappers and the Gemini CLI document
specification; all internal callers updated. |
`test_w9_drive_lowering_preserves_gemini_source_path` |
| 90-17 (#4184) | not reached | `sources/dispatch.py`: Current master
adds chatgpt_rejected_mapping_candidates; consumer-to-durable-accounting
trace remains incomplete, so no resolution claimed. | — |
| 90-18 (#4652) | fixed-already | `sources/dispatch.py`:
lower_chatgpt_documents now lowers shared decode records inside specs as
well as the direct top-level case. | — |
| 90-19 (#4188) | not reached | `sources/dispatch.py`: Codex-task
conservation exclusion still needs population-level treatment, not
simply returning an empty document list. | — |
| 90-20 (#5584) | fixed-already | `sources/dispatch.py`: The production
streamed generic caller normalizes ijson numbers before
parse_generic_messages_stream; no additional dispatcher normalization is
... | — |
| 90-21 (#4654) | not reached | `sources/dispatch.py`: Shared-decode
conservation and parser identity precedence require a joint
production-route fix. | — |
| 90-22 (#4188) | not reached | `sources/dispatch.py`: DOM capture
fallback IDs still require the same normalization as the production
parser; old supported input is not automatically exempted by the... | —
|
| 90-23 (#4174) | fixed | `sources/drive/__init__.py`: Both
cache-reading and streamed revision-proof routes accept syntactically
valid null JSONL records. | `test_w9_drive_cache_accepts_null_jsonl` |
| 90-24 (#4174) | fixed | `sources/drive/__init__.py`: The finally
cleanup covers tempfile write and close failures as well as rename
failure, preserving the previous destination. |
`test_w9_drive_failed_cache_publication_removes_temporary` |
| 90-25 (#5421) | fixed | `sources/drive/__init__.py`: Lossless ijson
number parsing prevents repeated downloads of Python-JSON-readable large
integers. |
`test_w9_drive_unchanged_large_integer_cache_does_not_download` |
| 91-01 (#5447) | not reached | `sources/hook_producer.py`:
Alternate-producer/compaction quiescence needs a complete
writer-protocol trace; no fix or dismissal claimed. | — |
| 91-02 (#4269) | not reached | `sources/hooks.py`: Legacy-root source
identifiers remain positional; no interface replacement/consumer update
supplied. | — |
| 91-03 (#4932) | fixed | `sources/import_preflight.py`: Supported
inputs with degradation caveats report DEGRADED. The existing
bounded-trajectory test expectation is updated to the same hones... |
`test_w9_trajectory_preflight_reports_degraded_steps` |
| 91-04 (#4275) | stale | `sources/live/admission.py`: The unreachable
terminal branch cited by the review has been removed; current policy
reacquires non-accepted receipts. | — |
| 91-05 (#5263) | not reached | `sources/live/append_ingest.py`:
Asserted hook-carrier baseline versus byte-proven resynthesis needs a
coordinated authority-proof change. | — |
| 91-06 (#5530) | not reached | `sources/live/append_ingest.py`: Success
artifact observation still precedes single-session/chain-authority
acceptance. | — |
| 91-07 (#4683) | not reached | `sources/live/batch.py`: Offered/default
queued population is computed after blocking filters. | — |
| 91-08 (#5403) | not reached | `sources/live/batch.py`: Re-resolving
historical blocked spellings can implicate a retargeted symlink
destination; needs durable-identity handling. | — |
| 91-09 (#4587) | not reached | `sources/live/batch.py`: Direct deferred
resynthesis is preserved, but deferred flush still re-reads an absent
ops cursor; full deferred-plan regression not supplied. | — |
| 91-10 (#5015) | not reached | `sources/live/batch.py`: Deferred
catch-up convergence still needs its own canonical receipt or duration
attribution to the originating attempt. | — |
| 91-11 (#4809) | fixed-already | `sources/live/batch.py`: ingest_files
catches escaped failures and finalizes the attempt, including
writer-hold budget failures. | — |
| 91-12 (#4713) | not reached | `sources/live/batch.py`: Current byte
accounting labels unattempted bytes, but that does not establish a
per-file deferred/excluded disposition for an outer-loop time-... | — |
| 91-13 (#4730) | not reached | `sources/live/batch.py`: A structural
halt still marks subsequent unattempted source groups as failed rather
than refused/unattempted. | — |
| 91-14 (#4874) | not reached | `sources/live/batch.py`: Materialized
sessions versus successfully parsed file units still needs all
reader/telemetry consumers reviewed together. | — |
| 91-15 (#4874) | fixed | `sources/live/batch.py`: The completed
progress event repeats the already-computed unique materialized-session
count after best-effort cursor_update loss. |
`test_w9_completed_ingest_repeats_materialized_count` |
| 91-16 (#5300) | not reached | `sources/live/batch.py`: Live metrics
now expose deferred_file_count, but typed catch-up receipt/CLI
propagation is not fully established here. | — |
| 91-17 (#4330) | fixed | `sources/live/batch.py`: Source-only
acquisition bypasses Antigravity language-server protobuf conversion and
retains original bytes. |
`test_w9_source_only_protobuf_does_not_invoke_converter` |
| 91-18 (#5526) | refuted | `sources/live/batch.py`: This asks to
migrate debts stored under predecessor subjects. Prior archive state is
explicitly out of scope for fresh v1; current code emits ... | — |
| 91-19 (#4175) | fixed-already | `sources/live/batch.py`: Full
file-backed JSONL acquisition computes and carries complete_prefix_size
rather than requiring an in-memory raw payload. | — |
| 91-20 (#4229) | fixed-already | `sources/live/batch.py`: Boundary
determination now checks the tail; an interior malformed line does not
truncate the cursor before later accepted records. | — |
| 91-21 (#4883) | not reached | `sources/live/batch.py`: Snapshot scope
selection for a renamed Antigravity SQLite store needs further current
policy tracing; no fix or refutation claimed. | — |
| 91-22 (#5263) | not reached | `sources/live/batch.py`: Full
hook-carrier raw bytes/frontier authority with a partial tail still
needs coordinated baseline treatment. | — |
| 91-23 (#4661) | fixed-already | `sources/live/batch.py`: ZIP safety
admission now precedes provider sniffing on the ordinary live route. | —
|
| 91-24 (#4661) | fixed-already | `sources/live/batch.py`:
Declaration-owned sidecars are excluded from ordinary ZIP provider
sniffing. | — |
| 91-25 (#4661) | not reached | `sources/live/batch.py`: --explain still
sniffs the whole infolist and retains provider_hint when constructing
member classification; route equivalence remains open. | — |
| 92-01 (#4661) | not reached | worker fix dropped: OTel `.*\.json$`
rule makes `declared_artifact_provider` ambiguous for every `.json`
member | — |
| 92-02 (#4549) | fixed-already | `sources/live/batch.py`: Legacy
promotion is now a deferred thunk, not an eager write during initial
reconstruction. No legacy upgrade code added. | — |
| 92-03 (#4587) | not reached | `sources/live/batch.py`: Full-head
reconstruction still requires the old full-file digest before composing
a mutable-header Claude semantic frontier. | — |
| 92-04 (#5568) | not reached | `sources/live/batch.py`: Equal-metadata
measurement-only update handling needs an accepted-change regression; no
new fix supplied. | — |
| 92-05 (#4587) | not reached | worker refutation rejected: promotion
thunk is live; no proof v1 never writes frontier-less appends | — |
| 92-06 (#4660) | fixed-already | `sources/live/batch.py`: Cursor
publication compares the post-proof file observation with the pre-proof
observation. | — |
| 92-07 (#4660) | fixed-already | `sources/live/batch.py`: Non-frontier
prefix hashing charges cursor hash-read bytes. | — |
| 92-08 (#4660) | fixed-already | `sources/live/batch.py`: Publication
rebases the accepted body end against the current Claude header length.
| — |
| 92-09 (#4662) | fixed-already | `sources/live/batch.py`: The rebased
publication_end is used for the cursor offset and corresponding
file-length guard. | — |
| 92-10 (#4662) | fixed-already | `sources/live/batch.py`: Claude
frontier read bytes are charged before rejecting an unavailable/invalid
proof. | — |
| 92-11 (#5258) | fixed | `sources/live/batch_support.py`: The regex no
longer treats the virtual empty EOF after a delimiter as a physical
blank line; actual blank lines retain their existing ... |
`test_w9_jsonl_boundary_keeps_newline_fast_path` |
| 92-12 (#5389) | fixed | `sources/live/cold_build.py`:
Checkpoint-holder attachment checks the SHM file beside the resolved
physical SQLite filename. |
`test_w9_ops_holder_accepts_symlinked_database` |
| 92-13 (#5609) | fixed | `sources/live/cold_build.py`: A valid sealed
complete count reports zero ETA after the advancement freshness window;
incomplete and unsealed stale counts still report ... |
`test_w9_completed_cold_build_eta_does_not_expire` |
| 92-14 (#5609) | not reached | `sources/live/cold_build.py`: Projection
refresh time, not receipt acceptance time, still renews the advancement
clock. | — |
| 92-15 (#5619) | fixed-already | `sources/live/cold_build.py`:
refresh_faulted_baseline calls _reset_accepted_progress(merged), then
refresh_accepted_progress; the denominator and weights no longer re... |
— |
| 92-16 (#4185) | not reached | `sources/live/cursor.py`:
Completed-with-failures reader/metric label propagation needs all public
consumers updated together. | — |
| 92-17 (#4730) | not reached | `sources/live/dedup.py`: Structural
failure installs a per-source halt; the test autouse fixture only clears
the global degraded flag. | — |
| 92-18 (#4795) | fixed | `sources/live/hook_paste_enrichment.py`: The
enrichment route carries the configured archive root into its
write-lease check instead of treating a generation index dir... |
`test_w9_hook_paste_uses_archive_lease_for_generation_index` |
| 92-19 (#4713) | fixed-already | `sources/live/metrics.py`:
LiveBatchMetrics.to_payload serializes both excluded_file_count and
excluded_reasons. | — |
| 92-20 (#5546) | not reached | `sources/live/parse_prefetch.py`:
Attempt cleanup exists, but retention of every unconsumed
candidate/shard across warm cohorts is not fully resolved here. | — |
| 92-21 (#5546) | not reached | `sources/live/parse_prefetch.py`:
Hashless worker errors remain reusable across changed source content;
freshness/deferred disposition needs a full route fix. | — |
| 92-22 (#5568) | fixed-already | #5691:
`_prepare_existing_session_writes(paths=...)` scoped to current
candidates | — |
| 92-23 (#5634) | not reached | `sources/live/parse_prefetch.py`:
Per-path reconciliation opens concurrent read frames without
establishing independent scan admission in this function. | — |
| 92-24 (#5542) | fixed-already | `sources/live/production_baseline.py`:
Baseline.verify delegates to
unretained_source_decisions/open_readonly_connection; the manually
interpolated SQLite URI is gone. | — |
| 92-25 (#5640) | fixed-already | `sources/live/production_baseline.py`:
Baseline emits its hashing phase before archive-member expansion and
decomposition. | — |

## Derived-identity closure

These changed files are members of
`docs/plans/schema-closure-baseline.json`, so the derived schema
identity moves: `sources/assembly_chatgpt.py`, `sources/dispatch.py`,
`sources/drive/__init__.py`, `sources/live/batch.py`,
`sources/live/batch_support.py`, `sources/live/cold_build.py`,
`sources/live/hook_paste_enrichment.py`, `sources/revision_backfill.py`.
`sources/import_preflight.py` is not a member. Membership was read from
the committed baseline, not recomputed, because the bulk pool that runs
`devtools schema closure` jobs was paused. No module was added to the
closure.

## Residuals

- 92-01 stays open: declaration lookup needs to prefer a unique
raw-only/fact rule over broad session patterns, applied on all three ZIP
routes.
- 92-05: the worker's fresh-v1 refutation was rejected, because the
legacy-append promotion thunk is live code and `ops.db` is disposable.
The finding stays open.
- Other `-shm`/`-wal` path derivations (`daemon/status.py`,
`daemon/health.py`, `daemon/backup.py`, among others) do not resolve
symlinks and were not reviewed here.
- Preflight now reports DEGRADED for a bounded trajectory probe or a
truncated directory walk, not only for parser flags.
- `test_unidentified_trajectory_rows_keep_distinct_identities` already
fails on master.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at bf68918):

  • P1 polylogue/sources/live/batch.py:4145: Fixed on master (checked at bf68918): For a plain FULL head (neither append nor reconstructed), the live prefix must reproduce the retained blob digest before the Claude frontier is composed (batch.py:6470).

Resolving every thread listed; confirmed defects are fixed under the named bead.

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at c950478):

Resolving every thread listed; confirmed defects are fixed under the named bead.

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