Skip to content

fix(sources): Close twelve live August findings across five areas - #5421

Merged
Sinity merged 8 commits into
masterfrom
work/aug-sources
Sep 22, 2026
Merged

Sinity merged 8 commits into
masterfrom
work/aug-sources

Conversation

@Sinity

@Sinity Sinity commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Summary

Twelve live P1 findings closed across sources, schemas, pipeline, browser_capture and the browser extension, from a triage of all 74 August-tranche findings in those areas.

46 STALE (62%), 12 LIVE-and-fixed, 4 WONTFIX, 12 LIVE-but-declined/collision/deferred.

Fixed

  • Parser admission classified the wrong argument. parser_admission read args[0], but drive.parse_chunked_prompt takes (provider, payload, fallback_id) — so the boundary classified the provider token as the payload. _payload_parameter now resolves the parameter from the signature at decoration time. Mutation: assert [] == ['drive_unknown_input'].
  • Compact browser captures bypassed the parser's guard during census. Mutation: assert {'untrusted-native-shape'} == {'a1','u1'} and assert set() == {'a1','u1'}, with the native-capture test staying green so a blanket refusal cannot pass.
  • Unchanged Drive caches were materialized to prove they were unchanged. Streamed and byte validators were measured equivalent over 9 document shapes — and the first draft was wrong: it short-circuited with any() and admitted a truncated document. Corrected to consume the whole parse. Mutation: assert [PosixPath('/...prompt.json')] == [].
  • Spool admission disagreed with archive precedence (3 findings). One shared predicate, models.envelope_has_native_provider_payload, now serves parser, census and receiver. Mutation: assert <CaptureConvergence.SUPERSEDED> is <CaptureConvergence.PUBLISH> twice, plus assert ['b1'] == ['t1','t2'].
  • Mission control never resolved the archive root on production startup. Mutation: assert [] == [PosixPath('/..._resolves_0')].
  • Three browser-extension defects: an aria-modal focus trap wrapped focus onto the chip (shell.append(panel, chip) puts it last in the shadow root, and focusables() queried the whole shadow) — two tests blessed the escape, not one; a selection idempotency key exceeded the 240-character API bound at 2,284; and the support packet exported unredacted content. Mutation output includes expected '...' not to contain 'MY PRIVATE PROMPT' and expected 2284 to be less than or equal to 240.
  • Two schema-audit holes: declared workload profiles were never audited, and bundle scope identities were never checked for opacity. Both measured as latent-hole closures — 0 workload profiles committed today, 186 declaration sites with 0 non-opaque — so they are ratchets, not new failures.

Declines backed by measurement, not opinion

Schema-privacy predicate (2 findings). The reviewer's premise is false at HEAD: across all 60 committed element schemas there are zero string values under a real enum/const/default/examples JSON Schema keyword. The 638 enum / 30 const / 761 default / 80 examples occurrences are observed-data property names inside x-polylogue-observed-distribution nodes, so a keyword-name-based collector would misread user data as schema keywords. And applying the broad UUID/hex/entropy predicate to all 1,673,619 bundle strings flags 59,882 — titles, descriptions, ISO timestamps, legitimate provider property names — which would make a required quick gate permanently red. check_published_paths already applies a leak predicate to every string, catching the reviewer's own email example.

Census fallback identity. The remedy is wrong here: the census's only available fallback is str(raw_id), which is not production's fallback_id, so adopting it converts an unsupported_or_malformed count into a false documents_absent_from_index.

Antigravity conversion filter. only_cascade_ids survives but is production-unreachable — both walk drivers continue past .pb CONVERSATION_PROTOBUF before parse_one_source_path, and export is keyed by cascade_id, so two same-stem files yield identical session content.

Admission state machine. AdmissionState is constructed, emits OBSERVED into a metrics callback, and is discarded; finish() and continuation() have no production caller. It is unfinished work, not dead code — binding it needs a durable receipt design plus a source.db migration.

Conditional blocker if the fresh-start ruling is relaxed

Three findings are moot only because the operator's route re-mints from sources. Measured read-only on the live archive and independently re-verified:

raw_sessions.logical_source_key:  claude-code 17015, codex 5485, chatgpt 212,
                                  gemini 94, unknown 8, hermes 7, claude-ai 5
rows in canonical -session: form:  0
raw_session_memberships:           31,959 keyed the same way

Production queries the canonical Origin form — append_ingest.raw_append_revision_parent is an exact-match lookup, and require_frozen_membership_authority compares the same way — and migrations/source/ holds only 002_excision_policy_projections.sql, so nothing rewrites them.

If the existing source.db is kept instead of re-minted, canonical-key equivalence, append-chain preservation and legacy content-hash reconciliation must be fixed first, or every new append quarantines and inactive-candidate construction raises FrozenSourceRemediationRequiredError.

Verification

command exit
devtools verify --quick at rebased HEAD 0, 25/25
devtools render all --check 0, out of sync count 0
devtools test × 7 selections (pre-existing files) 330 passed at HEAD vs 318 at base — zero failures either side, delta is +12 new tests
devtools test × 8 selections (new tests + consumers) 294 passed at HEAD vs 272 at base — zero failures either side
npm test (browser-extension) 408 passed at HEAD vs 406 at base

Inherited red, attributed: npm test fails the same 2 of tests/build.test.js at base and HEAD — ValueError: ZIP does not support timestamps before 1980, an artifact of a nix-derived source tree with 1970 mtimes, not a code defect.

Schema closure — reconvergence required

IN: sources/parsers/base_support.py, sources/dispatch.py, sources/drive/__init__.py, browser_capture/models.py, schemas/runtime_registry.py. out: browser_capture/receiver.py, browser_capture/server.py, sources/parsers/browser_capture.py, schemas/audit/workflow.py.

  • DerivedTier.index: 5274c9cc… → 8318d301c728d4731fcfd838d0627b7e282dbe0bfd010ddd44b99d269b03f4cf
  • DerivedTier.ops: unchanged

Must land before a fresh rebuild starts, never during one. Re-measure after rebase; other lanes move the same value.

What this tranche says about the selection filter

62% stale, against 35–60% for September. The dominant failure mode was again wholesale replacement rather than line edits: the hook-spool drain retirement invalidated 3 findings at once, the revision_backfill empty-replay rework 4, and INDEX_SCHEMA_VERSION 75→107 plus _PARSER_FINGERPRINT v2→v3 invalidated every deploy-ordering finding.

Worth recording against earlier guidance: the anchored-symbol pre-filter helped only twice here. Most stale findings kept their symbol and changed their body, so symbol presence is a weak signal for this area. Module and mechanism existence, and version-constant bumps, are the reliable ones.

Collisions, not edited

Streaming ZIP payload proofs (needs SerializedSplitPayload/MemberCandidate to carry a digest — operations/, daemon/) · Codex sidecar snapshots through the daemon route (needs durable source-tier storage; RawSessionRecord.sidecar_snapshot is Field(exclude=True) and never persisted) · stale unknown-origin raw_artifacts carrier after origin refinement (save_artifact_observation) · forwarding a validated message target_ref (blocked by api/archive.py:2401-2403, which accepts only session refs) · routing the candidate write through DaemonWriteCoordinator (daemon/).

Residuals

  • Deferred-cursor exception waives any global frontier violation, including a broken revision head or another path's cursor violation. A correct gate must consult raw_frontier_integrity_projection before the early return, which adds a projection scan to the benign path — needs a perf measurement and an owner decision.
  • A successful forced reparse supersedes only the two deferred-CAS carriers, so a previously terminal raw keeps its terminal evidence and disappears from a rebuilt archive after an index reset. retire_raw_failure_evidence exists and is already called from the same file on the failure path; the open question is its ordering.
  • replace_provider_packages refuses a family mismatch only when both ids are non-empty; an empty id on either side still matches by version ordinal.
  • _annotate_merged_schema_node recurses through properties/items/additionalProperties but not anyOf/allOf (599 and 15 occurrences), so nested annotations under a composite keyword are still dropped on regeneration.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

Sinity and others added 8 commits September 22, 2026 17:31
Problem: `parser_admission` read `args[0]` as the wire payload. Every
decorated parser but one takes the payload first; `drive.parse_chunked_prompt`
takes `(provider, payload, fallback_id)`, so the boundary classified the
provider token. A future-shaped Drive chunk therefore produced no
`drive_unknown_input` event and no `TYPED_UNKNOWN` ledger outcome, while the
synthesized ledger claimed one parsed outer record regardless of the real
chunk count.

Solution: resolve the payload parameter from the parser's own signature at
decoration time (named `payload` when present, else the first positional, so
`chatgpt_codex_sidecar.parse_codex_task`'s `task` still binds), and use that
index for both reading and for re-injecting the instrumented iterator.

Verification: `devtools test tests/unit/sources/test_admission_payload.py`
passes; restoring `payload = args[0] ...` makes
`test_drive_future_chunk_is_typed_unknown` fail with
`assert [] == ['drive_unknown_input']`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Problem: `lower_chatgpt_documents` lowered any `raw_provider_payload` carrying
a `mapping`, while `browser_capture.parse` ignores that mapping for a
`chatgpt-native-compact-v1` bridge projection and materializes
`session.turns`. The independent conservation census therefore measured a
document the archive never holds: every synthesized node id was reported as a
drop, and a compact capture with an empty mapping reported a session with zero
content units.

Solution: publish the parser's own predicate as
`browser_capture.has_chatgpt_native_payload` and have the census ask it,
scoped to ChatGPT envelopes as the parser is. A compact or non-ChatGPT capture
now falls through to the same turns projection production parses.

Verification: `devtools test tests/unit/sources/test_browser_capture.py`
passes. Restoring the bare `isinstance(native.get("mapping"), dict)` test
fails `test_compact_capture_census_lowers_envelope_turns`
(`assert {'untrusted-native-shape'} == {'a1', 'u1'}`) and
`test_compact_capture_census_survives_empty_mapping`
(`assert set() == {'a1', 'u1'}`), while
`test_native_capture_census_still_uses_the_mapping` stays green so a blanket
refusal cannot pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Problem: `iter_drive_raw_data` ran `_read_valid_cache` -- `read_bytes` plus a
whole-document `json.loads` -- before comparing the Drive revision against
`known_mtimes`. An unchanged large AI Studio document therefore allocated its
complete decoded object graph on every scan and discarded it, defeating the
constant-time cursor path this memory-bounded route is built around.

Solution: compare the revision first, and prove the cache still decodes with
`_cache_document_is_readable`, a streamed `ijson`/line proof that admits
exactly the documents `_read_valid_cache` hands bytes back for (including
refusing a truncated document, which needs the whole parse consumed rather
than short-circuited). Bytes are read only when a payload is produced.

Verification: `devtools test tests/unit/sources/test_drive_cache_skip.py`
passes. Restoring the eager read fails
`test_unchanged_cache_is_not_materialized` with a recorded read of
`drive-cache/prompt.json`; `test_corrupt_cache_is_reacquired` and the
nine-shape `test_validators_admit_the_same_documents` table pin that the
streamed proof is not simply permissive.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Problem: three receiver-side spool rules contradicted what the archive does
with the same capture.

- `_capture_is_newer_or_richer` discarded any capture listing fewer turns, so
  a provider-native payload arriving over a DOM fallback was refused at the
  spool even though `browser_capture_precedence` admits exactly that case
  downstream. The lower-fidelity artifact was retained permanently.
- The same function vetoed on `provenance.captured_at` before reading any
  session-side evidence. That clock is one extension instance's observation,
  not a session revision, so two instances with skewed clocks lost the
  strictly newer, richer revision.
- A superseded delivery echoed the identities of the *rejected* incoming
  envelope while correctly echoing `existing`'s dedup hash, so after a branch
  switch the extension marked messages captured that were never written and
  are not in the spool.

Solution: give the fidelity question one definition,
`models.envelope_has_native_provider_payload` (with the two provider
predicates moved beside the envelope they read), and use it in the parser, the
conservation census and the receiver. Order the admission rules so turn count
and provider revision decide before the observer clock, and project accepted
identities from whichever artifact is retained.

Verification: `devtools test tests/unit/browser_capture
tests/unit/sources/test_browser_capture.py` -> 248 passed; `devtools test`
over the four dispatch/spool-restoration/attribution files -> 71 passed.
Restoring the old ordering and the incoming-envelope ack fails
`test_native_replaces_fallback_with_fewer_turns` and
`test_skewed_capture_clock_does_not_veto_revision`
(`SUPERSEDED is not PUBLISH`) and `test_superseded_ack_names_the_retained_turns`
(`assert ['b1'] == ['t1', 't2']`), while
`test_stale_smaller_snapshot_is_refused` stays green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Problem: `run_daemon_services` constructs the receiver with `make_server(...)`
and no `archive_root`, and `BrowserCaptureReceiverConfig.default()` leaves the
field `None`. `existing_capture_state` still found the indexed session through
its own default-root fallback, but `_mission_control` then took the
`archive_root is None` branch unconditionally, so cost and assertions were
reported `archive_projection_unavailable` on every production request. Only
tests passing a temporary root ever exercised the archive reads.

Solution: resolve the default root in the handler, the way the assertion
candidate handler already does, and keep the degraded projection for the case
it is actually about -- an archive that cannot answer.

Verification: `devtools test tests/unit/browser_capture` -> 192 passed.
Dropping the `or default_archive_root()` fallback fails
`test_mission_control_resolves_the_default_archive_root`: the handler never
calls `mission_control_archive_facts` (`assert [] == [PosixPath(...)]`).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Problem, all three live at HEAD:

- `focusables()` queried the whole shadow root while the chip is rendered
  after the panel, so the Tab trap wrapped focus onto the chip -- out of the
  `aria-modal` dialog it exists to contain. Three tests asserted that wrap
  against a shadow-root-wide list, blessing the escape instead of detecting
  it.
- The selection idempotency key embedded the draft body verbatim. The
  receiver refuses a key over 240 characters
  (`_archive_capture_assertion_candidate`), the editor accepts 10,000 and a
  derived selection reaches 2,000, so an ordinary paragraph selection failed
  every save with `idempotency_key exceeds 240 characters`.
- The exported support packet serialized the capture retry queue (whole
  envelopes, including `session.turns` text) and `/v1/browser-actions`
  (each intent's drafted reply) verbatim, so following the in-app
  instruction to export and share it disclosed transcripts.

Solution: scope the focus trap to the dialog and scope the two tests with it;
derive a fixed-width `selection:<16 hex>` digest of the same three fields
(no `TextEncoder`/`crypto` dependency, so it holds in a content script and in
jsdom); and project the queue and action list to diagnostic metadata
(counts, timings, error strings, tab origin, text length).

Verification: `npm test` in browser-extension/ -> 2 failed | 408 passed,
against a base of 2 failed | 406 passed. Both failures are inherited and
environmental: `tests/build.test.js` shells out to `python3` zipping and dies
on `ValueError: ZIP does not support timestamps before 1980`. Reverting the
three production edits fails five tests -- `expected ... not to contain 'MY
PRIVATE PROMPT'`, `expected 2284 to be less than or equal to 240`, and three
`Object.is equality` focus assertions.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Problem: `audit_schema_bundle_privacy` inventoried element schema files only.

- A package declaring `workload_profile_file` ships a second public artifact
  that `SchemaRegistry.get_workload_profile()` serves at runtime, and a
  profile records observed structural values under `tokens`. Nothing loaded
  it, so an address or identifier landing there published with both required
  quick gates green.
- Nothing validated `bundle_scope_identities` on either manifest.
  `bundle_scope_identity()` exists so a catalog keeps routing capability
  without serializing the readable local path or session identifier it was
  derived from; a manual promotion writing the raw scope published it in
  catalog.json and package.json unnoticed.

Solution: validate every package- and element-level scope identity against the
`scope:<sha256>` form, and load each manifest-declared workload profile
through the committed snapshot, running the same privacy and published-path
predicates over it. A declared-but-absent or unreadable profile is an error,
not a silent skip.

Verification: `devtools test
tests/unit/schemas/test_promotion_audit_privacy_guard.py` -> 22 passed. The
committed bundle measures 0 non-opaque scope identities across 186 declaration
sites and 0 committed workload profiles, so the audit stays at 180 OK checks
and both additions are ratchets rather than new failures. Removing them fails
`test_audit_refuses_raw_scope_identity`, `test_audit_reads_workload_profile`
and `test_audit_refuses_absent_profile`, while
`test_audit_accepts_opaque_scope_identity` and
`test_committed_schema_bundle_privacy_guard_is_green` stay green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
`devtools gate mypy` type-checks tests too: the Drive stub client must satisfy
the whole `DriveSourceAPI` protocol, `_write` must declare
`BrowserCaptureWriteResult`, and the Drive payload fixture must be built as
`JSONValue` rather than `dict[str, object]`.

Verification: `devtools verify --quick` -> 25/25 gates ok (previously red at
`gate mypy` with 11 errors, then `gate lint` with an import-order error).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
@Sinity
Sinity enabled auto-merge (squash) September 22, 2026 15:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 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-22T15:49:59.597337Z 28e8a24 PR opened
🔒 Security Review ✅ Completed 2026-09-22T15:48:29.798564Z 28e8a24 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.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 28962a08-9ce3-482e-ba2c-9df15cb9c0f5

📥 Commits

Reviewing files that changed from the base of the PR and between 69394d3 and 28e8a24.

📒 Files selected for processing (19)
  • browser-extension/src/content/ambient_surface.js
  • browser-extension/src/popup.js
  • browser-extension/tests/content/ambient_surface.test.js
  • browser-extension/tests/popup.test.js
  • polylogue/browser_capture/models.py
  • polylogue/browser_capture/receiver.py
  • polylogue/browser_capture/server.py
  • polylogue/schemas/audit/workflow.py
  • polylogue/schemas/runtime_registry.py
  • polylogue/sources/dispatch.py
  • polylogue/sources/drive/__init__.py
  • polylogue/sources/parsers/base_support.py
  • polylogue/sources/parsers/browser_capture.py
  • tests/unit/browser_capture/test_receiver.py
  • tests/unit/browser_capture/test_spool_admission.py
  • tests/unit/schemas/test_promotion_audit_privacy_guard.py
  • tests/unit/sources/test_admission_payload.py
  • tests/unit/sources/test_browser_capture.py
  • tests/unit/sources/test_drive_cache_skip.py

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 7c91218 into master Sep 22, 2026
3 checks passed
@Sinity
Sinity deleted the work/aug-sources branch September 22, 2026 15:48

@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: 28e8a249b7

ℹ️ 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 on lines +765 to +767
payload = envelope.raw_provider_payload
if envelope.session.provider is Provider.CHATGPT:
return has_chatgpt_native_payload(payload)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Treat compact captures as native during spool admission

When a chatgpt-native-compact-v1 capture with fewer turns arrives after a DOM fallback, this returns false because has_chatgpt_native_payload() explicitly excludes compact projections. _capture_is_newer_or_richer() consequently marks the capture SUPERSEDED, even though the parser tags it with COMPACT_BROWSER_CAPTURE_INGEST_FLAG and archive precedence treats that flag as native; the higher-fidelity capture is therefore discarded before ingestion and the DOM artifact remains permanently.

Useful? React with 👍 / 👎.

Comment thread polylogue/schemas/audit/workflow.py Resolved
Comment thread browser-extension/src/popup.js Resolved
Comment thread polylogue/sources/drive/__init__.py Resolved
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 ef10e59):

Resolving the fixed, stale and refuted threads; tracked threads stay open.

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