Repository navigation
fix(sources): fix parser, source-walk and fingerprint review findings - #5798
Merged
Merged
Conversation
Lands the verified part of the worker-10 salvage for the Codex review debt in polylogue-1tyq5.93/.94/.95 (sources parts 4-6). Parsers: Antigravity step timing, tool outcomes (row exit codes, string and object errors, not_reported vs unsupported_construct), camelCase edit fields, envelope-preserving payload unwrap, per-step refusal of an invalid typed step, and parent-alias canonicalization; ChatGPT list aggregate results, per-run output/exit_code evidence, project-scoped citation URLs, non-string content_type discriminators and text-only transcriptions; browser-capture extracted-content precedence, claude-file: reconciliation and cached-match revalidation; Claude web byte-conflict attachments; Claude Code and Codex counters that stay unknown unless they are non-negative integers; Codex data-URL references; Codex state chunk coordinates without the physical rowid. Admission: conservation refuses ordinals outside the denominator, a tool_use part with no payload is a malformed refusal, material origin uses the TEXT projection, and repeated future records keep one event per occurrence. Discovery and identity: linked directories are chosen in name order; the source walk still follows directory links but stops at a link to a directory already entered; the fingerprint refuses bytes that changed after signing and no longer SQL-normalizes Python call operands; the schema-closure command resolves paths from the caller's directory and refuses missing ones; the Hermes streaming envelope keeps a container-valued marker's presence; observation contracts cover every provider wire. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…d name Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity
marked this pull request as ready for review
September 29, 2026 03:51
Sinity
enabled auto-merge (squash)
September 29, 2026 03:51
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Resolve by intent: - base_support.py: take master's AdmissionObserver (#5711). It retains one unknown-input event per wire type by design, so the branch's per-occurrence event count (94-18) is dropped with its test and fixture. - browser_capture.py: keep master's content-hash comparison, then the branch's exact claude-file id shortcut when neither side has a witness. - antigravity.py: keep both the alias-claimant map and master's summary-key reservation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity
added a commit
that referenced
this pull request
Sep 29, 2026
## Summary Lands the verified part of ChatGPT worker 11's pass over Codex review findings in `polylogue/sources` (parts 7-8) and `polylogue/schemas` (beads polylogue-1tyq5.96, .97, .86, .87; 71 findings). 22 fixes are kept, each with a regression test that fails on master. The other 49 are recorded below as fixed-already, stale or not reached. ## Problem The kept findings reproduce on current master: - OTel GenAI: a structured, numeric or boolean `gen_ai.tool.call.result` becomes an empty result block, and span fields outside the projected set (end time, links, trace state, flags, dropped counts) are missing from `otel_span_evidence`. - Revision backfill: the frozen-shard lookup hand-formats `origin:native_id` without the identity helper's strip, so a padded native id raises `ShardRefusedError`. The owned-generation emptiness probe validates the final index layout, so a generation with deferred secondary indexes reports schema skew instead of the nonempty-generation refusal. - Source cut: staging can be created inside a bound source root. Two SQLite ids sharing a stem (`state.first`, `state.second`) both map to `state.jsonl`. Any sibling directory with the request prefix is deleted as orphaned staging. Archive-member items are checked against the whole ZIP's size and digest, so every intact archive cut is reported as mutated. - Source census: a directly configured file counts as zero candidates, symlinks and FIFOs drop out of the denominator, `inspection_bytes` claims read I/O it never measured, and an lstat fault silently drops a candidate from the production walk. - Schemas: the audit's package exemption misses provider aliases (`XAI`, `GROK`). A content-bearing property name beside an existing dynamic map is kept as a literal property, and the annotation audit skips named fields retained beside a collapsed map. `SchemaCommitPrivacyError` and `SchemaArchiveEvidenceError` escape the devtools `ValueError` boundaries as tracebacks. The module schema CLI resolves the archive from the generation directory. Relation annotations are cached by object id, so an in-place edit is ignored. The drift walk drops an allOf base's union branch, loses the dynamic-keys marker across unannotated conjuncts, and discards `$ref` sibling declarations. ## Solution - `sources/parsers/otel_genai.py`: a non-string result is serialized as sorted JSON (absent stays absent); evidence carries `unprojected_span_fields`. - `sources/revision_backfill.py`: the lookup uses `identity_law.session_id`; the probe opens with `validate_index_layout=False`. - `sources/source_snapshot.py`: `execute_source_cut` refuses a destination overlapping a bound directory root (resolved paths). The SQLite export name appends `.jsonl`. Staging carries an owner marker naming the request; reclamation deletes only marked, non-symlink directories, and the marker is removed before publication. `reacquire_candidate` hashes each archive member by name from the copied ZIP, opening each ZIP once. - `sources/source_walk.py`: the census resolves file-or-directory like `_resolve_source_paths`, takes supported-name entries before the regular-file filter, records walk errors, and reports `candidate_bytes` (renamed and documented as entry size). `_walk_source_paths` keeps a supported-name candidate whose lstat fails, so the per-file read records the failure on the cursor instead of the scan reporting it as absent; unsupported names are filtered before any lstat. - `schemas/audit/workflow.py`: canonicalizes the provider before the subject lookup. `schemas/audit/checks.py`: counts named fields beside a collapsed map. - `schemas/generation/dynamic_keys.py`: beside an existing map only individually dynamic names fold into it. - `schemas/operator/commit.py`, `schemas/sampling_db.py`: both refusal types derive from `ValueError`. - `schemas/operator/schema_inference.py`: passes the configured `ArchiveLocation`. - `schemas/synthetic/relation_solver_runtime.py`: the cache key is a SHA-256 of the canonical JSON, parsed from that snapshot. - `schemas/validator.py`: the allOf base selects its union branch first, a dynamic-keys marker on any conjunct survives the merge, and `$ref` siblings join the resolved node. Worker changes not landed: - 96.02 (OTel parent edges): master now declares OTel `message_parent` as a derived topology capability in `_otel_genai_spec`, the finding's second option, so removing the parent mapping would contradict the declared contract. Recorded as fixed-already. - The worker's lstat fix propagated the error out of `_walk_source_paths`, so one vanished or unreadable entry (even an unsupported temp file) aborted the whole source scan. Replaced by keeping the candidate for the per-file failure route. - The worker's `reacquire_candidate` refused duplicate ZIP member names, which the cut itself publishes; it now reads by name as the cut does. ## Verification - `agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w11` → job 2600 at head 152a132: `verify: PASSED exit=0`. - `agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w11 -- <24 test files>` → job 2602 at head 152a132: `805 passed, 3 failed`. The 3 failures (`test_common_live_batch_retries_a_failed_vendor_conversion`, `test_dynamic_key_maps_do_not_emit_drift_warnings`, `test_antigravity_brain_metadata_sidecar_is_rejected_from_live_and_schema_routes`) fail the same way on unmodified master (job 2551). The earlier head 649039f gave `807 passed, 3 failed` (job 2550); 152a132 merges #5798, #5779 and #5704, which overlap this diff only in `source_walk.py` (#5798's directory-link cycle guard, compatible with the lstat change), `revision_backfill.py` and `commit.py` (disjoint hunks). - Proof that the tests fail without the fixes: the branch's test files copied onto unmodified master 1beb2e5 and run with the same selection as job 2551: `29 failed, 781 passed`: all 26 new or changed regression cases for the kept findings plus the 3 master failures above. The two control parameters (`padded_native_id=False`, `deferred_indexes=False`) pass on both heads, as intended. Selection: `tests/unit/core/test_synthetic_relations.py tests/unit/devtools/test_schema_commit_command.py tests/unit/devtools/test_schema_lab_commands.py tests/unit/schemas/test_audit_declared_packages.py tests/unit/schemas/test_drift_walk_resolution.py tests/unit/schemas/test_promotion_monotonicity.py tests/unit/sources/parsers/test_otel_genai.py tests/unit/sources/parsers/test_otel_genai_contract.py tests/unit/sources/test_origin_specs.py tests/unit/sources/test_revision_backfill.py tests/unit/sources/test_source_snapshot.py tests/unit/core/test_schema_validation.py tests/unit/core/test_audit.py tests/unit/core/test_schema_laws.py tests/unit/schemas/test_historical_payload_resolution.py tests/unit/schemas/test_source_structure_witnesses.py tests/unit/sources/test_agent_memory_documents.py tests/unit/sources/test_antigravity_source_acquisition.py tests/unit/sources/test_artifact_taxonomy.py tests/unit/sources/test_source_laws.py tests/unit/sources/test_source_root_admission.py tests/unit/daemon/test_antigravity_conversation_acquisition.py tests/unit/pipeline/test_resilience.py tests/unit/pipeline/test_ingest_outcomes.py` ## Self-review - **Sibling sites.** `with_suffix` on a source id occurs once in `source_snapshot.py`; the other export branch already appends. Staging reclamation has one caller. The session-id format in `_required_shard_prepared_rows` was the only hand-built `origin:native_id` on the shard path. Both devtools schema boundaries catch `ValueError`, so rebasing the two refusal types covers `schema commit`, `schema generate` and every other caller; no intermediate `except ValueError` on the sampling or commit path swallows them (the drift check catches `Exception` and reports WARNING, unchanged). `SourceInferenceError` and `SchemaFrontierError` are other `RuntimeError` refusals; they belong to not-reached findings and are left as residuals. - **Cancellation and shutdown in loops.** No new loop waits or sleeps. `reacquire_candidate` holds its ZIP handles in an `ExitStack`, so an exception closes them. - **Unbounded reads.** Member verification streams in 1 MiB chunks rather than `archive.read`. The relation cache serializes the annotation list it already held in memory. - **Fail-open fallbacks and compatibility shims.** None added. `inspection_bytes` is renamed, not aliased; it had no production reader. A crashed staging directory without a marker is kept rather than deleted (fail closed). The overlap guard refuses rather than relocating staging. - **Removed symbols.** `SourceRootCensus.inspection_bytes` is gone; its only reader was a test, updated here. No monkeypatch target was removed. - **Tests prove the production route.** The tests drive `parse_payload`, `backfill_historical_revision_evidence`, `execute_source_cut`/`reacquire_candidate`, `census_source_root`, `_resolve_source_paths`, `audit_provider`, `merge_observed_structure_schemas`/`check_annotation_coverage`, the `schema_commit`/`schema_generate`/`schema_inference` entry points, `_RelationConstraintSolver` and `SchemaValidator.validate`. `census_source_root`, `reacquire_candidate` and `cut_source_inputs` have no production caller yet (unfinished code, not obsolete); the tests exercise them directly. ## Derived-identity closure These changed files are in `docs/plans/schema-closure-baseline.json`, so the derived identity moves and this must land before the fresh rebuild: `polylogue/schemas/generation/dynamic_keys.py`, `polylogue/schemas/sampling_db.py`, `polylogue/schemas/validator.py`, `polylogue/sources/parsers/otel_genai.py`, `polylogue/sources/revision_backfill.py`, `polylogue/sources/source_snapshot.py`, `polylogue/sources/source_walk.py`. The OTel result-block text and evidence payload are hashed parser output, so OTel sessions re-derive. ## Per-finding dispositions Counts: 22 fixed, 0 dropped as not real, 21 fixed-already, 2 stale, 0 refuted, 26 not reached. Per bead: .96 4 fixed / 7 fixed-already / 1 stale / 13 not reached. .97 8 / 0 / 1 / 4. .86 7 / 12 / 0 / 6. .87 3 / 2 / 0 / 3. | key | disposition | evidence | test | |---|---|---|---| | 96.01 #4724 `polylogue/sources/parsers/local_agent.py:236` | fixed-already | polylogue/sources/parsers/local_agent.py:564-565 (displayContent is extracted before the empty-message guard.) | - | | 96.02 #5530 `polylogue/sources/parsers/otel_genai.py:250` | fixed-already | worker fix rejected: `_otel_genai_spec` in polylogue/sources/origin_specs.py now declares `message_parent` as a derived topology capability (span.parentSpanId -> parent span output:0), the finding's second option; the parent mapping and the capability contract agree | - | | 96.03 #5530 `polylogue/sources/parsers/otel_genai.py:297` | fixed | polylogue/sources/parsers/otel_genai.py `_messages_for_span`: a non-string decoded result is serialized as sorted JSON; an absent attribute stays absent | tests/unit/sources/parsers/test_otel_genai.py::test_dispatch_preserves_structured_tool_results | | 96.04 #5530 `polylogue/sources/parsers/otel_genai.py:389` | fixed | polylogue/sources/parsers/otel_genai.py `_span_evidence_event`: every span field outside the projected set is kept under `unprojected_span_fields` | tests/unit/sources/parsers/test_otel_genai.py::test_dispatch_retains_unprojected_span_fields_in_evidence | | 96.05 #5584 `polylogue/sources/prepared_jsonl.py:556` | not reached | polylogue/sources/prepared_jsonl.py:734 (Numeric native IDs remain excluded from metadata capture. The f95 carrier file differs from the upload; no partial metadata edit is supplied.) | - | | 96.06 #5610 `polylogue/sources/prepared_jsonl.py:649` | not reached | polylogue/sources/prepared_jsonl.py:650 (Per-Grok-session scratch rows still allocate pages in the shared sealed preparation database. A real scratch-lifetime/store separation remains, not a VACUUM workaround.) | - | | 96.07 #5610 `polylogue/sources/prepared_message_sink.py:539` | not reached | polylogue/sources/prepared_message_sink.py:1205-1209 (The streaming ChatGPT mapping reader still presents a leading UTF-8 BOM to ijson. No reader/fixture change is supplied.) | - | | 96.08 #4969 `polylogue/sources/retained_assembly.py:236` | not reached | polylogue/sources/retained_assembly.py:230-236 (Windows sidecar coordinates still use host-dependent Path handling. Cross-platform coordinate parsing remains.) | - | | 96.09 #5548 `polylogue/sources/revision_backfill.py:905` | not reached | polylogue/sources/revision_backfill.py:4442-4551 (Retryable preparation/infrastructure exceptions are still converted into semantic census failure text. The complete worker-to-controller failure route is not changed.) | - | | 96.10 #5548 `polylogue/sources/revision_backfill.py:941` | not reached | polylogue/sources/revision_backfill.py:1332-1357 (Prepared authority promotion still needs the coherent membership-outcome update, including previously observed authority. No half-update is supplied.) | - | | 96.11 #4993 `polylogue/sources/revision_backfill.py:1626` | not reached | polylogue/sources/revision_backfill.py:2326-2414;3396-3408 (Frozen evidence still constructs prepared-session shards inline on the controller path. Worker preparation/transport ownership remains.) | - | | 96.12 #4993 `polylogue/sources/revision_backfill.py:1626` | not reached | polylogue/sources/revision_backfill.py:2326-2414;3396-3408 (Duplicate cited coordinate, distinct storage/lifetime obligation: unused historical prepared shards are still materialized. No cleanup/lifetime fix is supplied.) | - | | 96.13 #5585 `polylogue/sources/revision_backfill.py:2352` | fixed-already | polylogue/sources/revision_backfill.py:2427-2465;2819-2880 (Census uses raw-ID pages and resumes/rebinds expiring source frames.) | - | | 96.14 #4993 `polylogue/sources/revision_backfill.py:2402` | fixed | polylogue/sources/revision_backfill.py `_required_shard_prepared_rows`: keys the lookup through `identity_law.session_id`, the helper `prepare_session_shard` uses | tests/unit/sources/test_revision_backfill.py::test_frozen_inactive_generation_replays_through_sealed_session_shards[padded_native_id=True] | | 96.15 #5435 `polylogue/sources/revision_backfill.py:2530` | fixed | polylogue/sources/revision_backfill.py `_owned_generation_is_empty`: the read-only probe opens with `validate_index_layout=False` | tests/unit/sources/test_revision_backfill.py::test_owned_nonempty_generation_refuses_cold_build_deferral[deferred_indexes=True] | | 96.16 #5594 `polylogue/sources/revision_backfill.py:2752` | not reached | polylogue/sources/revision_backfill.py:2490-2542;2828 (The raw-ID page bound does not bound membership-join fanout. Paging the joined result without losing logical-source memberships remains.) | - | | 96.17 #4993 `polylogue/sources/revision_backfill.py:2842` | fixed-already | polylogue/sources/revision_backfill.py:4135-4165;4345-4374 (Required-shard refusal for lineage slicing has an explicit canonical-write degradation; the strict prepared-carrier path remains retryable.) | - | | 96.18 #4982 `polylogue/sources/revision_backfill.py:2921` | not reached | polylogue/sources/revision_backfill.py:4411-4415 (The terminal global FTS corruption condition can still fail a selected replay unit because of unrelated existing corruption. No narrower verification-scope change is supplied.) | - | | 96.19 #4382 `polylogue/sources/revision_backfill.py:3028` | fixed-already | polylogue/sources/revision_backfill.py:6335-6343 (Spill reparse passes the archive source connection to replay-safe enrichment.) | - | | 96.20 #4941 `polylogue/sources/revision_backfill.py:3279` | fixed-already | polylogue/sources/revision_backfill.py:6310-6319;6335-6343 (Both spill routes recover the original source path and pass it into enrichment.) | - | | 96.21 #5432 `polylogue/sources/revision_backfill.py:3710` | fixed-already | polylogue/sources/revision_backfill.py:4927-4955 (Prefetch hits are removed before representative selection and executor dispatch.) | - | | 96.22 #4275 `polylogue/sources/source_acquisition_components.py:370` | not reached | polylogue/sources/source_acquisition_components.py:447 (Plain-file admission evidence is not yet carried across every sibling acquisition route. ZIP/Drive provenance closure remains.) | - | | 96.23 #4174 `polylogue/sources/source_acquisition_components.py:516` | not reached | polylogue/sources/source_acquisition_components.py:623-689 (ZIP split-payload indexing still needs correction for grouped inline documents. No acquisition-file edit is supplied.) | - | | 96.24 #4634 `polylogue/sources/source_parsing.py:49` | not reached | polylogue/sources/source_parsing.py:38-49 (Decoded positive session evidence can still be overridden by the pathname classification. No admission-policy edit is supplied.) | - | | 96.25 #4883 `polylogue/sources/source_parsing.py:303` | stale | polylogue/pipeline/services/archive_ingest.py and `parse_sources_archive` were removed by #5787 (mutations route through the daemon); no API sequential writer assigns a generic raw ID | - | | 97.01 #4452 `polylogue/sources/source_parsing.py:452` | not reached | polylogue/sources/source_parsing.py:469 (Antigravity vendor prepass and saved JSON exports can still yield competing copies. Precedence and retained provenance must be solved together.) | - | | 97.02 #4452 `polylogue/sources/source_parsing.py:455` | not reached | polylogue/sources/parsers/antigravity/census.py;polylogue/sources/source_parsing.py:408 (Antigravity source census still lacks the saved export-document role. The role and its consumers are not changed.) | - | | 97.03 #4452 `polylogue/sources/source_parsing.py:455` | stale | the sequential API writer (`parse_sources_archive`) that skipped the evidence gate was removed by #5787 | - | | 97.04 #4732 `polylogue/sources/source_root_admission.py:58` | not reached | polylogue/sources/source_root_admission.py:48 (Ancestor-only refusal does not exclude a foreign archive nested below a selected directory. Discovery pruning plus explicit refusal accounting remains.) | - | | 97.05 #4441 `polylogue/sources/source_snapshot.py:866` | fixed | polylogue/sources/source_snapshot.py `execute_source_cut`: refuses a destination whose staging parent is inside, or which contains, a bound directory root (resolved, so aliases count) | tests/unit/sources/test_source_snapshot.py::test_cut_refuses_staging_inside_source_before_mutating_it | | 97.06 #4945 `polylogue/sources/source_snapshot.py:917` | fixed | polylogue/sources/source_snapshot.py `execute_source_cut`: appends `.jsonl` to the full source id instead of replacing its suffix | tests/unit/sources/test_source_snapshot.py::test_sqlite_cut_keeps_dotted_source_ids_distinct | | 97.07 #4441 `polylogue/sources/source_snapshot.py:969` | fixed | polylogue/sources/source_snapshot.py: staging carries an owner marker naming the request; `_reclaim_orphaned_staging` deletes only marked, non-symlink directories; the marker is removed before publication | tests/unit/sources/test_source_snapshot.py::test_cut_reclaims_only_staging_it_owns | | 97.08 #4441 `polylogue/sources/source_snapshot.py:992` | fixed | polylogue/sources/source_snapshot.py `reacquire_candidate`: archive-member items are verified against the member bytes read by name from the copied ZIP | tests/unit/sources/test_source_snapshot.py::test_archive_cut_reacquires_member_bytes_and_detects_member_mutation | | 97.09 #4432 `polylogue/sources/source_walk.py:54` | fixed | polylogue/sources/source_walk.py `census_source_root`: a directly configured file is the one candidate, as in `_resolve_source_paths` | tests/unit/sources/test_origin_specs.py::test_root_census_includes_a_directly_selected_file | | 97.10 #4432 `polylogue/sources/source_walk.py:60` | fixed | polylogue/sources/source_walk.py: the metric is renamed `candidate_bytes` and documented as candidate entry size, not read I/O (the finding's second option) | tests/unit/sources/test_origin_specs.py::test_root_census_includes_a_directly_selected_file | | 97.11 #4788 `polylogue/sources/source_walk.py:149` | fixed | polylogue/sources/source_walk.py `census_source_root`: supported-name entries are taken before the regular-file filter; links and FIFOs count as unsupported | tests/unit/sources/test_origin_specs.py::test_root_census_accounts_for_rejected_nonregular_candidates | | 97.12 #4788 `polylogue/sources/source_walk.py:151` | fixed | polylogue/sources/source_walk.py `_walk_source_paths`: an uninspectable supported-name candidate stays in the walk so its per-file read records the failure on the cursor; the census records it as unexplained | tests/unit/sources/test_origin_specs.py::test_source_walk_keeps_uninspectable_candidate_and_census_records_it | | 97.13 #4879 `polylogue/sources/sqlite_snapshot.py:344` | not reached | polylogue/sources/sqlite_snapshot.py:406;polylogue/sources/live/watcher.py:1286 (Physical watcher tokens can remain stale when acquisition itself establishes an idle WAL. Snapshot/watcher cursor rebasing must be changed together.) | - | | 86.01 #5411 `polylogue/schemas/audit/workflow.py:59` | fixed | polylogue/schemas/audit/workflow.py `_package_not_required_reason`: canonicalizes the provider token before the subject lookup | tests/unit/schemas/test_audit_declared_packages.py::test_audit_aliases_preserve_declared_package_exemptions | | 86.02 #4835 `polylogue/schemas/generation/dynamic_keys.py:27` | fixed-already | polylogue/schemas/generation/dynamic_keys.py:35-71 (Required arrays are recursively canonicalized before structure hashing.) | - | | 86.03 #5277 `polylogue/schemas/generation/dynamic_keys.py:194` | fixed | polylogue/schemas/generation/dynamic_keys.py `_merge_observed_structure_pair`: beside an existing map only individually dynamic names fold into it; static names stay | tests/unit/schemas/test_promotion_monotonicity.py::test_observed_merge_rehomes_content_keys_beside_an_existing_dynamic_map | | 86.04 #5277 `polylogue/schemas/generation/dynamic_keys.py:195` | fixed | polylogue/schemas/audit/checks.py `check_annotation_coverage`: named fields retained beside a collapsed map are still counted | tests/unit/schemas/test_promotion_monotonicity.py::test_collapsed_object_keeps_retained_fields_visible_to_annotation_audit | | 86.05 #4828 `polylogue/schemas/generation/workflow.py:119` | fixed-already | polylogue/schemas/generation/workflow.py:99-105 (Provider and input provider tokens are canonicalized before selection.) | - | | 86.06 #4836 `polylogue/schemas/generation/workflow.py:185` | fixed-already | polylogue/schemas/generation/workflow.py:175-193 (Source witness overflow is propagated to the schema extension and manifest lower bound.) | - | | 86.07 #4835 `polylogue/schemas/generation/workflow.py:185` | fixed-already | polylogue/schemas/generation/workflow.py:165-178 (Reused versions retain prior exact structure witnesses.) | - | | 86.08 #5444 `polylogue/schemas/operator/commit.py:62` | fixed | polylogue/schemas/operator/commit.py: `SchemaCommitPrivacyError` derives from `ValueError`, the command boundary's refusal type | tests/unit/devtools/test_schema_commit_command.py::test_schema_commit_renders_typed_refusals_as_json[privacy] | | 86.09 #4828 `polylogue/schemas/package_publication.py:46` | fixed-already | polylogue/schemas/package_publication.py:36-46 (The publication snapshot enumerates all retained files, not JSON alone.) | - | | 86.10 #4837 `polylogue/schemas/packages.py:106` | fixed-already | polylogue/schemas/packages.py:105-111 (The requested historical-key read is already present. No migration or compatibility code is added by this batch.) | - | | 86.11 #4837 `polylogue/schemas/runtime_registry.py:764` | fixed-already | polylogue/schemas/runtime_registry.py:762-790 (Refresh takes maxima across prior manifest, prior schema, and incoming coverage counters.) | - | | 86.12 #4836 `polylogue/schemas/runtime_registry.py:776` | fixed-already | polylogue/schemas/generation/dynamic_keys.py:74-127 (The capped source-witness partition excludes shorter archive structure IDs; archive IDs are retained without this cap.) | - | | 86.13 #4838 `polylogue/schemas/runtime_registry.py:816` | fixed-already | polylogue/schemas/runtime_registry.py:909-919 (Retained historical packages pass through witness/counter synchronization before publication. No migration is added.) | - | | 86.14 #4854 `polylogue/schemas/sampling_db.py:66` | fixed | polylogue/schemas/operator/schema_inference.py `cli_main`: passes `ArchiveLocation.resolve(config.archive_root)` | tests/unit/devtools/test_schema_lab_commands.py::test_schema_module_cli_preserves_configured_archive_location | | 86.15 #4854 `polylogue/schemas/sampling_db.py:318` | fixed | polylogue/schemas/sampling_db.py: `SchemaArchiveEvidenceError` derives from `ValueError` | tests/unit/devtools/test_schema_commit_command.py::test_schema_commit_renders_typed_refusals_as_json[archive_evidence]; tests/unit/devtools/test_schema_lab_commands.py::test_schema_generate_handles_missing_archive_evidence | | 86.16 #4828 `polylogue/schemas/source_inference.py:559` | fixed-already | polylogue/schemas/source_inference.py:569-591 (An explicitly selected file is resolved before non-following file-type inspection.) | - | | 86.17 #4847 `polylogue/schemas/source_inference.py:612` | fixed-already | polylogue/schemas/source_inference.py:643-689 (Unrecognized logical-export filenames are bound using the export header member.) | - | | 86.18 #4899 `polylogue/schemas/source_inference.py:640` | not reached | polylogue/schemas/source_inference.py:679 (A recognized basename can still win over an authoritative logical-export header. Header-first acquisition identity remains.) | - | | 86.19 #4936 `polylogue/schemas/source_inference.py:763` | not reached | polylogue/schemas/source_inference.py:1549 (ZIP sidecars still enter unconditional export-array expansion, unlike equivalent plain structured documents. No ZIP strategy change is supplied.) | - | | 86.20 #4936 `polylogue/schemas/source_inference.py:1267` | not reached | polylogue/schemas/source_inference.py:SourceEvidenceRecipe (The source-evidence recipe still permits reuse of pre-envelope-preservation cache output. Must change with the actual observation semantics, not silently accept the old cache.) | - | | 86.21 #4847 `polylogue/schemas/source_inference.py:1273` | fixed-already | polylogue/schemas/source_inference.py:1384-1406 (Logical-export DDL is reconstructed for declared not-null and primary-key column metadata.) | - | | 86.22 #4923 `polylogue/schemas/source_inference.py:1298` | not reached | polylogue/schemas/source_inference.py:1373 (Live SQLite table/column observations still lack one explicit read transaction covering the complete observation.) | - | | 86.23 #4923 `polylogue/schemas/source_inference.py:1301` | not reached | polylogue/schemas/source_inference.py:1373 (Read-only WAL input without SHM still needs a writable, WAL-preserving temporary snapshot adapter. Immutable main-image fallback would lose evidence and is not added.) | - | | 86.24 #4847 `polylogue/schemas/source_inference.py:1334` | not reached | polylogue/schemas/source_inference.py:_collect_database_schema_candidate (Identical database reacquisitions still retain path-derived logical-source identities and double-count evidence. No guessed native identity or broad deduplication is added.) | - | | 86.25 #4634 `polylogue/schemas/synthetic/relation_solver_runtime.py:80` | fixed | polylogue/schemas/synthetic/relation_solver_runtime.py `_parsed_annotations`: keyed by a SHA-256 of the canonical JSON and parsed from that snapshot | tests/unit/core/test_synthetic_relations.py::test_relation_solver_honors_in_place_annotation_changes_between_generations | | 87.01 #4912 `polylogue/schemas/validator.py:110` | fixed | polylogue/schemas/validator.py `_schema_branch_for_value`: the allOf base selects its own union branch before merging | tests/unit/schemas/test_drift_walk_resolution.py::test_validation_selects_a_sibling_union_before_allof_observation | | 87.02 #4912 `polylogue/schemas/validator.py:114` | fixed | polylogue/schemas/validator.py `_schema_branch_for_value`: an explicit dynamic-keys marker on any conjunct survives the allOf merge | tests/unit/schemas/test_drift_walk_resolution.py::test_validation_preserves_dynamic_annotation_across_unannotated_conjuncts | | 87.03 #4912 `polylogue/schemas/validator.py:116` | not reached | polylogue/schemas/validator.py:309 (The observation-only allOf merge is still reused by empty-array normalization and can lose type constraints. The three drift-walk edits do not claim to solve this.) | - | | 87.04 #5413 `polylogue/schemas/validator.py:125` | fixed | polylogue/schemas/validator.py `_resolve_local_ref`: `$ref` sibling declarations join the resolved observation node | tests/unit/schemas/test_drift_walk_resolution.py::test_validation_keeps_local_ref_sibling_declarations | | 87.05 #4829 `polylogue/schemas/validator.py:307` | fixed-already | polylogue/schemas/validator.py:514-609;polylogue/pipeline/services/validation_runtime.py:57-66 (PayloadValidation retains the chosen probe samples/results and consumers use them without another full validation.) | - | | 87.06 #4830 `polylogue/schemas/validator.py:344` | fixed-already | polylogue/schemas/validator.py:528-565 (Rejected candidates stop on the first invalid record; only the initial fallback candidate is completed if no candidate accepts.) | - | | 87.07 #4830 `polylogue/schemas/validator.py:368` | not reached | polylogue/schemas/validator.py:587-597 (Accepted historical schema selection still preserves package_default as its reason and can cause false unseen_shape classification.) | - | | 87.08 #4830 `polylogue/schemas/validator.py:368` | not reached | polylogue/schemas/validator.py:587-597 (Duplicate cited coordinate, separate review comment: accepted historical resolution still needs distinct truthful classification. No reason-enum/interface change is supplied.) | - | ## Residuals - 26 findings stay not reached and open in their beads (listed above). - 86.10 is fixed-already, but the fix it asked for is a dual read of the old key `omitted_current_structure_witness_count` in `schemas/packages.py`. Whether committed packages still need that read is a separate cleanup. - The source-cut and census functions are exercised only by tests until an acquisition owner calls them. - Three focused tests fail identically on master (see Verification); they are not touched here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity
added a commit
that referenced
this pull request
Sep 29, 2026
## Summary The parser admission proof now certifies only records that a parsing owner accounted for. The observer no longer infers materialization from a record's shape. A record stream is counted to its end whether or not the parser pulled it. A multi-record input whose records carry no parser disposition is refused instead of certified. Tracks polylogue-mg7jx (audit F27; F28's universe check landed on master with #5798). ## Problem At df70214 (`AdmissionObserver`, polylogue/sources/parsers/base_support.py), from the audit's in-memory probes: - A record without a `future_`/`unknown_`/`unsupported_` sentinel was recorded as materialized. `[{"type": "ordinary_new_record"}]` passed through a parser that lowered nothing was certified `[(0, 1)]` with no event. - The iterator denominator was only what the parser pulled. A 3-record stream the parser took 1 of was certified with `expected=1`. - Parsers with their own ledger (Codex) were never checked against the complete input, so a ledger that stopped early balanced. ## Solution - `AdmissionObserver.observe` takes the parsing owner's disposition (`lowered`, `malformed`). A record observed before its parser ran stays pending, stored as compact ordinal runs. - One whole document (the single-record routes: ChatGPT, Claude AI, Drive, Grok, Gemini CLI and Hermes documents, and the prepared routes' stubs) is settled by the parser that returned a session from it, exactly as before. - For a record sequence or stream there are two settlement routes. Either the caller passes each record's disposition, or the session carries the parser's own ledger, whose outer-record denominator must equal the complete count. Anything else raises `ValueError` ("gave no disposition" / "accounted for N of M"). That raise is the same parse-refusal route `assert_conserved` already used. - Streams are drained after the parser returns: in the `parser_admission` wrapper, on the Codex stream route, and on the Hermes stream route. The Hermes route observes records that the parser never pulled with no disposition. - Claude Code: `_fold_code_record` returns its disposition. It is `False` only for a record without a string `type`. Every other path leaves a message, an event, or a counted disposition that the finalized session reports. Both the multiway stream and `parse_code` pass that disposition, so `parse_code` drops its wrapper and admits against its own fold. `parse_code` now also applies admission before sidecars, the order the stream route already used. - Hermes grouped records: `admit_parsed_sessions(..., recognizes=hermes_spans.looks_like_atof_payload)` gives the lowered-spec route the same parser recognition the stream route uses. ## Verification - `agentctl job start polylogue pytest_focused -- tests/unit/sources/test_admission_completeness.py tests/unit/sources/test_admission_payload.py tests/unit/sources/test_parser_admission_packet.py tests/unit/sources/test_parsers_base.py tests/unit/sources/parsers/ tests/unit/sources/test_prepared_jsonl.py tests/unit/sources/test_codex_whale_fixtures.py …` (24 modules): job 2565 at 6ea06b81cd, before the rebase: every test passed except two. `test_admission_conservation_rejects_a_range_that_overcounts` expected the message #5798 then changed; the rebase takes master's verifier. `test_code_mode_item_lookahead_does_not_retain_whole_payload_items` exceeded its 120 s timeout under pool load. After the rebase, job 2617 (codex whale, admission completeness, admission packet, admission payload) passed apart from that same timeout, and a paired single-test run passed on this branch (job 2693) and on master (job 2694). A cProfile of 30k code-mode items gives 6.8 s on this branch against 7.3 s on master; `observing` costs 0.24 s - `agentctl job start polylogue verify_quick`: job 2581 at 6ea06b81cd: `verify: PASSED exit=0` `test_admission_completeness.py` covers the bead's acceptance: 1. Counterexamples that the old code certified: an ordinary-shaped record a parser discarded; a stream left early by a parser with a one-record ledger; a stream left early without a ledger. 2. Mutations the verifier must refuse: a wrong-member range, an out-of-domain range, a same-count substitution, a negative outcome ordinal, and an undeclared unit. 3. The whole-document route still proves its one record, and parser dispositions settle a stream. The ro922 compact-ledger law and the typed-unknown, refusal and ATOF tests in `test_parser_admission_packet.py` and `test_admission_payload.py` still pass. Two of those tests now pass `lowered=True` where they used to rely on the default. ## Derived identity `polylogue/sources/parsers/base_support.py`, `polylogue/sources/parsers/claude/code_parser.py` and `polylogue/sources/dispatch.py` are in the derived-identity closure. This must land before the fresh rebuild starts. ## Self-review - Sibling sites. Every `AdmissionObserver` construction and every `admit_parsed_sessions` call was checked: Claude multiway, `parse_code`, Codex and Hermes stream routes, the lowered-spec route, and the prepared ATIF, OTel, Gemini and Grok stubs, which are single documents. Only the Hermes grouped-records route needed a recognizer. Every sequence-payload decorated parser has its own ledger (Codex) or no longer uses the wrapper (Claude `parse_code`). - Memory. Pending records are held as ordinal runs, so an unsettled stream costs one run. No per-record model is retained. - Fail-closed. An unsettled multi-record input is refused, never certified. A single document keeps its existing proof. - Compatibility. The `recognized=` keyword is replaced by `lowered=` at both callers; nothing keeps the old default. ## Residuals - Inner units (Gemini CLI messages inside one document, Grok responses) are still outside the outer-record proof. Their parsers account for parts, blocks and messages only where they already had ledgers. - The single-document routes still certify their one record by the parser returning a session. That is the parser's own statement that it consumed the document, not a per-field proof. 🤖 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
added a commit
that referenced
this pull request
Sep 29, 2026
…5850) ## Summary Makes master's focused suites green again. The baseline run on master `633ec18ffc` (job 3431, 30 files) had 41 failures and 1 error, and every other PR was running into them. They come from 20-odd separate causes. Where production was wrong, this PR fixes production and uses the failing test as the regression. Where a merged PR had deliberately changed the contract, it updates the test to the new contract and cites that PR. Two failures remain, each with a bead and the evidence below. Beads: polylogue-ouv5f (all eight tests fixed), polylogue-0e6m3, polylogue-h9da0 and polylogue-wple (audited and noted; their open criteria are listed under Residuals). ## Problem Job 3431 (`pytest_focused --on-default-branch`, 30 files, 1539 tests) reported `passed 1497, failed 41, error 1`. Its failed-test rerun also crashed: the rerun passed `…::test_x@web-reader[param-…]` back to pytest, and pytest answered `ERROR: not found`. ## Solution: production defects fixed | Failure | Cause | Fix | |---|---|---| | `test_raw_observation_derivation` ×4, `test_retained_tool_output_convergence` (Gemini) | For providers with no assembly spec, `enrichment_dependency_digest` skipped the evidence digest that every retained seal computes. Every prepared artifact of those providers therefore read as stale, and `publish` returned False forever, so Hermes, Antigravity, ChatGPT and Gemini retained raws never converged. | Every provider digests its evidence, empty or not (`sources/revision_backfill.py`). | | `test_observation_runtime::test_structured_raw_only_sidecar…` | An artifact-scoped identity hashed to the same `{"source": path}` value that `_old_path_fallback` refuses, so new sidecar evidence never reached the cache. | The artifact-scoped identity gets its own namespace (`schemas/source_inference.py`). | | `test_verification_evidence_lane` | `reconcile_and_record_abandoned_verify_runs` compared `cache.parent` (that is, `.cache`) to the checkout, so the test was never true. The checkout's reconciled runs went to cache-local history, and cache-local evidence too (#5720), instead of the durable lane. | Compare the checkout root, `runs_root.parents[2]`. The checkout uses the XDG history and `verification_evidence_path()`; a relocated cache keeps local files. | | `test_web_reader::test_archive_filter_kwargs…` | #5795 gave `iter_search_summaries` an `actions_only` lane parameter. The count route still counted every FTS hit for `retrieval_lane="actions"`. | `count_search_sessions(actions_only=…)` and the count route pass the lane. New regression: `test_actions_lane_count_counts_only_sessions_its_search_returns`. | | `test_command_catalog::test_tool_outcome_help…` | A Click-level required option refused `--help` before argparse could print it (#5720). | argparse owns requiredness, and the metavar is `PATH`. | | idempotence properties (found while fixing the harness) | `refresh_session_repos*` stamped `repos`, `repo_checkouts` and `session_repos` with the wall clock, so no rebuild could reproduce them. | Stamp them with the session's own time, as `_write_repo_edges` does. New test: `test_refresh_stamps_the_session_time_not_the_wall_clock`. | | `test_daemon_http_security` | The daemon client that carries the credential was chained into the receipt call, so the token scan flagged the receipt. | Bind the client first (`browser_capture/server.py`). No allowlist entry was added. | | failed-test rerun | `report_nodeid_to_selector` did not handle `name@group[param-…]`, the shape that shortened ids take under loadgroup, and the long-id map stored uncollectible `@group` ids. | Handle that shape, and record both map sides in selector form (`devtools/pytest_rerun.py`, `tests/conftest.py`). | | `test_session_partition_convergence` (fd leak) | The per-thread connection cache kept every archive a test built until the descriptor check ran. | The autouse fixture clears the cache at teardown. | | `test_session_partition_convergence` (`fields_digest`) | #5799's column was neither projected nor excluded. | Exclude it, with the reason (`derived/session/input_binding.py`). | ## Solution: tests updated to contracts that merged PRs changed - `test_import_preflight`: several unidentified trajectories are refused (#5711); the old test expected ids minted from row position. - `test_artifact_taxonomy`: a brain sidecar is observed as `agent_sidecar_meta` schema evidence (#5781), never as a session. - `test_tool_result_unknown_reason_contract` ×3: a step with no verdict field is `not_reported` (#5798). A new route covers `unsupported_construct` with an unmapped status. - `test_source_laws`: the stand-in parser accounts for its outer records (#5816). - `test_revision_replay`: the direct replay binds Codex enrichment evidence as the retained writer does (#5643). - `test_retained_tool_output_convergence` (Gemini): the fixture sidecar is longer than the 40,000 characters the envelope advertises (the #5643 partial-write guard). - `test_schema_policy_contracts`: FTS triggers are matched by whole table name (`messages_fts_readiness_binding` is not FTS-backing); the restart test clears the bootstrap memo as a restart does (#5428). Deleted `test_every_prior_index_schema_version…`: at fresh v1, `SCHEMA_VERSION - 1` is 0, which is the "interrupted create" state that is re-created by design. No prior version exists. - `test_durable_migrations`: an archive two slots behind gets the typed refusal from #5806, and the tier is untouched. The docstring of `apply_declared_durable_migrations` is corrected. Filed as polylogue-7yq3f. - `test_schema_validation`: the member schema names `id` (#4856 reports unnamed fields), and the keys are plain names, so the marker is what suppresses them. - `test_synthetic_wire_support::test_chatgpt_witness…`: the part text also survives on the tool block, so the test drops it there too. - `test_archive_ingest_shared_raw`: a ZIP member with a malformed record is `terminal_corrupt_input` (#5823 F039); a census runs once per raw. - `test_plain_cli_snapshots`: empty is exit 2 and degraded is exit 1 (`surfaces/outcome.py`). - `test_cross_surface_agreement`, `test_query_composition_laws`: the CLI reads through a real daemon (#5805). The naive-join mutant lifts the read authorizer (#5642) the way `attach_readonly_database` does. - `test_resource_pilot` ×2: parser scratch SQLite (`:memory:` and temp files) is allowed; any database file or tier is not. - `test_codex_debt_w1` and the convergence properties: the harness bound each session's own evidence to message 0 and stamped replayed messages with the child's values. Since #5826 shares only an identical prefix, no lineage prefix was shared at all, and the append-prefix laws were vacuous. A fork now replays its parent's parsed prefix exactly, and its own evidence moves to the first message it authored. The mutation test's `_resolve_session_graph` mutant returns `set()` to match the current signature. - `test_query_exec_laws` ×4: stub the convergence probe in fake-store stats tests (#5700), add the `tool_input` projection field, and expect a second window sized to the remaining limit. - devtools: `test_verify` stubs the executor, `test_pytest_suite_cost_plugin` builds the recorder before patching RSS, `test_verification_terminal_receipts` updates the sizing stub signature, and `test_verification_result` adds the #5720 `flaky` field. `test_http_bounded_mutations` adds the #5723 summary read to its test double. Derived-identity closure (`devtools schema closure`): these files are IN: `archive/query/archive_execution.py`, `schemas/source_inference.py`, `sources/revision_backfill.py`, `storage/derived/session/input_binding.py`, `storage/derived/session/repo_observations.py`, `storage/sqlite/archive_tiers/archive.py`. The rest are out. ## Verification - Baseline, master `633ec18ffc`, job 3431: `passed 1497, failed 41, error 1`. - `agentctl job start --workspace /realm/worktrees/polylogue-master-green polylogue pytest_focused -- <61 files>`, job 3578, head `a7f4465c56`: `passed 2336, failed 2` after the in-slot rerun. The first attempt ran under host I/O contention, with workers in D state. 25 of its 27 first-attempt failures were `Timeout (>120.0s)`, and every one of those passed when rerun alone. - `test_web_reader::…searches_from_archive_tiers`: a socket timeout under the same load. It passed alone in job 3861 (`devtools test: PASSED exit=0`). - `test_supported_routes_validate_selected_schema_and_parser_entry_point`: inherited, see Residuals. - Master baseline for the added files, job 3562: `test_query_exec_laws` ×4, idempotence ×7 and mutations ×2 fail on master the same way. All of them are fixed here. - Harness consumers and count seams at head `1d3b3545c5`, job 3920 (24 files): `passed 589, failed 1` after the in-slot rerun. The one failure, `test_inferred_corpus_loop::test_every_supported_inferred_element_reaches_convergence_and_red_twin`, was a `Timeout (>120.0s)` inside `load_package_catalog` under the same host load. It passed alone in job 3973 (`devtools test: PASSED exit=0`). - `verify_quick` on head `1d3b3545c5`, job 3921: `verify: PASSED exit=0`. The hosted `ci/circleci: quick-gate` passes. - `verify_quick` on head `a7f4465c56`, job 3579: `verify: PASSED exit=0`. ## Self-review I did two passes over the full diff against `master`, using `docs/review/codex-review-guide.md` and the generic worker-contract list. Pass 1 found two defects, both fixed in `1d3b3545c5` and `3ec0a5fa2f`. Pass 2 was clean. 1. ✓ **Siblings and owners.** The actions-lane count was also wrong in two more places: the facade/daemon seam `_archive_count_sessions_for_spec` and the daemon `count` mode (`operations/daemon_reads.py`). Pass 1 found them with `grep -rn count_search_sessions polylogue` (7 call sites); both are fixed and have a regression test. The MCP route already reports `total=None` for actions (`mcp/archive_support.py` `ranked_only`), and `sessions.search` is lexical only. The enrichment digest has a single owner (`enrichment_dependency_digest`) used by both the live and the retained check. Every seal computes the evidence digest unconditionally, the live enricher included. A search of `polylogue/storage/derived` for wall-clock stamps found two others: the marker cursor `applied_at_ms` (operational metadata) and `profiles.now_iso` (materialized-at). Neither is a semantic column. 2. ✓ **The fix itself.** Pass 1 found that `_replayed_parent_prefix` would recurse forever on a declared parent/child cycle (`cycle_candidate=True`). It now tracks the lineage it walks, and picks the parent revision the way `authoritative_sessions` does. `count_search_sessions(actions_only=False)` defaults to today's behaviour for every other caller. 3. ✓ **Memory and limits.** Nothing new grows with the input. The repo stamp is one indexed `SELECT` per refreshed session. No caps or timeouts were added. 4. ✓ **Cost per unit.** One predicate on the count query and one primary-key read per repo refresh. `with_retained_assembly_evidence` returns at once for providers without assembly evidence (`sources/retained_assembly.py:470-479`). 5. N/A **Interruption.** No loops, waits or multi-step state changes were added. 6. ✓ **Ordering and races.** The repo stamp is read inside the materializer's own transaction, on the same connection that writes the rows. 7. ✓ **Failure classification.** The reconciler's history and evidence appends keep their existing `suppress(OSError, ValueError)`. `verification_evidence_path()` now expands `~`, as the old inline override did. 8. ✓ **Silent outcomes.** Actions-lane totals now count what the lane can return. Exit codes follow outcomes (`surfaces/outcome.py`), and the updated CLI tests assert exit 2 for empty and 1 for degraded. 9. N/A **Cleanup on failure.** Nothing new is acquired. 10. ✓ **Identity and keys.** Artifact-scoped source identity now lives in its own `{"artifact": …}` namespace, so it can no longer collide with the retired `{"source": path}` identity. Old cache rows under the path identity are still refused by `_old_path_fallback`. 11. ✓ **Lossless transforms.** The rerun selector keeps the `[param-…]` label, and the long-id map now stores both sides in collectible form. The harness deep-copies the parent messages it replays. 12. ✓ **Degenerate inputs.** A missing session row stamps 0, the writer's own default. A child with no own messages keeps position-0 evidence. A shared prefix of 0 replays nothing. 13. ✓ **Consumers.** `count_search_sessions` gained an optional keyword; every test double takes `**kwargs`, and none asserts the exact kwargs (checked at `test_query_exec_laws.py:1301,1385,2099` and `tests/infra/archive_store_double.py:255`). The unused `now_iso` parameters were removed, and `grep` finds no callers passing them. 14. ✓ **Tests and stubs.** Each production fix has a test that goes red without it. The count tests go 2 → 3 without `actions_only`. The repo test goes red if the rows are stamped with the wall clock. The evidence-lane pair covers the checkout and the relocated cache. `test_rerun_selector_strips_the_xdist_group_suffix` covers the new id shape. The source-inference test goes red without the separate namespace. Stubs follow the current signatures: the `resolve_worker_argument` stub takes `**sizing`, the `_resolve_session_graph` mutant returns `set()`, and the test double implements `get_session_summaries`. 15. ✓ **Trust boundaries.** The capture handler binds the credential-holding client apart from the receipt, and no token-scan allowlist entry was added. The fixtures are synthetic. Generic list: (1) criteria are met on production routes (probes and job 3578). The unmet ones name their blockers (4xyn9, 7yq3f, h9da0, 0e6m3, wple). (2) Siblings: see item 1. (3) No predecessor is kept beside a replacement. (4) No silent fallback was added. (5) Each new test names the change that turns it red. (6) The diff, receipts and text carry no secrets or private data; the paths are worktree scratch paths only. ## Residuals - polylogue-4xyn9: `test_supported_routes_validate_selected_schema_and_parser_entry_point` still fails. The claude-ai v2 coverage witnesses combine mutually exclusive groups, so 529 of 844 keywords are missing. It fails the same way on every commit back to #5485 at least. Honoring the exclusions in coverage mode alone still leaves 319 missing, so this needs a coverage planner. - polylogue-7yq3f: catch-up across more than one numbered slot is refused, and a backup is taken before the refusal. Nothing breaks until the second migration of a tier ships. - polylogue-3p8p7 (owned elsewhere): a loose malformed workflow journal still reads as `workflow_journal` through the lenient retained decode; the ZIP route is strict. - polylogue-h9da0: quick-pool xdist width is sized from the slice's current headroom, not from a per-job share. Two jobs that start together can both admit a full width. Left open. - polylogue-0e6m3: the per-cache retention measurements need a scheduled broad run. Left open. - polylogue-wple: master already enforces the foreign-interpreter and foreign-import checks. Detecting copied testmon or verify state is still open. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lands the verified part of the ChatGPT fleet worker-10 output for the Codex P2 review debt in
polylogue-1tyq5.93,.94and.95(polylogue/sources parts 4-6, 75 findings). The worker could not run anything; every kept fix here was re-read against the landing head, and every kept fix has a regression test that fails on the base.Per finding: 32 fixed, 9 fixed-already, 1 refuted, 1 dropped as not a defect, 32 not reached. Of the worker's 35
fixedclaims, 32 land (two of them reworked and one narrowed); 2 are rejected, and 94-18 was withdrawn when this branch merged master (see below). Of its 10fixed-alreadyclaims, 1 is rejected as still real.Problem
The findings are Codex review comments on merged PRs. Each one names an input and a wrong outcome in parser, admission, discovery or derived-identity code. Examples: an Antigravity step with
occurred_at_mslost its time; a list-valued ChatGPTaggregate_resultfor a failed run was archived as a success; a directory symlink to an ancestor madecensus_source()loop forever; a Codexusagecounter ofnullwas stored as a measured zero; a source edited between signing and parsing could leave a fingerprint memo describing different code. The table below cites each finding and its evidence.Solution
occurred_at_msis read as epoch milliseconds. Tool outcomes read the row'sexit_code, treat a non-empty string, mapping or listerroras a failure, and reportnot_reportedwhen no outcome field is present (the origin spec declares that reason). camelCase edit fields are read. Unwrappingpayloadkeeps the envelope's role and time. A step that fails typed validation becomes a MALFORMED refusal for that step only. Parent references resolve through the trajectory/cascade alias map before the ambiguity check.aggregate_resultdecides the outcome (any failure fails, all success succeeds, otherwise unknown), and each run emits its own event withoutputandexit_code. Citation URLs of the/g/g-p-…/c/<id>form keep the conversation id. A non-stringcontent_typeis typed unknown at the message, media-part and part-accounting sites. A transcription that carries text is not markedunavailable.extracted_contentwins overprovider_meta. Aclaude-file:<uuid>projection reconciles with the native row of that uuid without a byte witness. A cached cross-route match is re-validated before reuse. A conversation-level Claude attachment whose bytes conflict with its descriptor match stays a separate file.local_imagesreferences go through the data-URL sanitizer. Codex state chunk coordinates drop the physical rowid.ParseAccounting.assert_conservedrefuses ordinals outside[0, expected). Atool_usepart with no name, id or input is refused as MALFORMED. Material origin is classified from the same TEXT projection as message type._fingerprint_sources_computerefuses (FingerprintSourceChangedError) when the bytes differ from their signature. Python call operands are no longer SQL-normalized (fingerprint algorithm 4 -> 5).in_derived_identity_closureanddevtools schema closureresolve paths from the caller's directory and refuse missing ones. The Hermes streaming envelope keeps a container-valued marker. Observation contracts are emitted for every provider wire. The synthetic Codex oracle classifies throughclassify_message_type.Rejected worker changes:
AdmissionObserver(fix(sources): resolve Codex P1 parser findings #5711, merged after this branch was cut) deliberately keeps one pending unknown-input event per wire type so memory stays bounded, andtest_admission_payload.py::test_repeated_unknown_records_keep_one_pending_event_per_typeholds that contract. A per-occurrence event list contradicts it, so the merge takes master's observer and drops this branch's version and its test. The finding stays open for a bounded fix.Merge with master (head
6fc0e31bf8)Merge commit
6fc0e31bf8brings in master1beb2e516a(including #5711, #5723, #5787 and #5804). No force-push. Conflicts were resolved by intent:base_support.py: master'sAdmissionObserveris kept as is. The branch's per-occurrence unknown-input events (94-18) are dropped with their test and fixture. See the 94-18 row.browser_capture.py:_claude_attachment_cross_route_matchcompares inline bytes first, then master's content hashes, and only then takes the exactclaude-file:<uuid>identity (94-24) when neither side has a byte witness. Conflicting hashes still refuse the match.antigravity.py: both the alias-claimant map (94-13) and master's summary-key reservation are kept. They touch disjoint names.The other 32 kept fixes were re-read against master: each hunk is still absent there, and every helper they call (
_iter_mapping_items,iso_from_epoch_ms,unknown_reason) exists on master. No kept fix became redundant.Verification
Every check ran as an agentctl job.
After the merge (head
6fc0e31bf8):agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w10 --wait(job 2471):phase: succeeded,result: Success.agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w10 --wait -- <the same 28 modules>(job 2470): 943 passed, 12 failed. Ten of them are the inherited failures listed below. The other two are also inherited: job 2543 ran them on a master checkout, and both failed there too. They aretest_antigravity_conversation_acquisition.py::test_common_live_batch_retries_a_failed_vendor_conversionandtest_artifact_taxonomy.py::test_antigravity_brain_metadata_sidecar_is_rejected_from_live_and_schema_routes.Before the merge:
agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w10 --wait(job 2228, headd768577f0b):verify: PASSED exit=0. All static gates are ok, including mypy, lint, layering, schema-closure and schema-manifest.agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w10 --wait -- <28 test modules>(job 2168, heade8191c523f, the parent of the rename-only follow-up commit): 908 passed, 10 failed. All 10 failures are inherited. Jobs 2166 and 2229 ran them on the base915a1f357d(this branch with every production file reset to the base), and all 10 failed there with the same errors (pre-merge, heade8191c523f):test_schema_closure.py::…::test_the_checked_in_baseline_matches_the_live_closure: the baseline listspolylogue/operations/durable_change_train.py, which the live closure no longer contains.test_discovery_progress.py::test_cold_build_preparation_is_visible_before_the_first_intake_page:preparation_revision_countis 0, expected 2.test_codex_state_bounds_and_excision.py::test_large_goal_export_last_row_is_reachable: pytest-timeout (300s) insideos.fsyncof the blob directory.test_browser_capture.py:IngestDaemonRequiredError, because the API ingest route requires a running daemon.agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w10 --wait -- tests/unit/sources/test_antigravity_trajectory_steps.py tests/unit/sources/test_antigravity_source_acquisition.py(job 2232, headd768577f0b):devtools test: PASSED exit=0, 22 passed.Nonecounters for Claude,unknown_outcome, the ambiguous-parent case, and the equal/absent byte relations.The 28 modules run in job 2168:
tests/unit/sources/: test_antigravity_trajectory_steps, test_counter_and_coordinate_contracts, test_parser_admission_contracts, test_source_walk_and_fingerprint_contracts, test_web_parser_attachments_and_runs, test_admission_payload, test_admission, test_parser_admission_packet, test_antigravity_source_acquisition, test_browser_capture, test_parsers_chatgpt, test_claude_ai_conversation_level_attachments, test_codex_state_bounds_and_excision, test_origin_specs, test_prepared_claude_ai_object, test_prepared_drive_chunked_object, test_parsers_codex, test_nullable_message_usage, test_claude_code_unread_wire_fields, test_live_page_selection, test_source_root_admission, test_artifact_taxonomy, test_parsers_local_agent, test_agent_memory_documents; plustests/unit/devtools/test_schema_closure.py,tests/unit/core/test_synthetic_semantics.py,tests/unit/daemon/test_discovery_progress.pyandtests/unit/daemon/test_antigravity_conversation_acquisition.py.Self-review
I read the full
git diff origin/master...HEADagainst the checklist indocs/review/codex-review-guide.md._tool_outcome, so the reason change has one site. Remaining divergence: the live walk refuses a link that escapes the root and the source walk follows it. That predates this change and is recorded under residuals.FingerprintSourceChangedErroris new and propagates uncaught. It fires only when a source changes between signing and parsing, and a refusal is safer than writing a wrong memo. The antigravityValidationErrorcatch wraps only the typed construction of one step.DirEntrylist to sort it, which is no more than the children list it already builds. The walk's visited set is one entry per directory. No caps were added.staterror keeps the directory in the descent, soos.walkreports it throughonerrorand it is not silently pruned.aggregate_resultcounts as absent; NaN, negative, bool and fractional counters are unknown; a missing closure path is refused; a missing walk base still walks nothing.in_derived_identity_closurehas no production caller; the command and its tests follow it.artifact_observation_contractshas no consumer beyond its export. The existing packet test's expected message was updated for the earlier range check.ordered_scandirhelper returned a generator context manager that production cannot iterate; it now mimicsos.scandir. The worker's large-file Hermes test called an API that no longer exists; it now driveshermes_snapshot_envelopeagainstlooks_like_hermes.parse_codeimport. No other code referenced them.Per-finding dispositions
Key
NN-MMis beadpolylogue-1tyq5.NN, finding MM. Tests are undertests/unit/sources/. "Not reached" rows keep the worker's triage evidence (in the handoff); they were not re-checked here.sources/live/sidecar_resolution.py:141sources/live/watcher.py:76sources/live/watcher.py:220run_daemon_servicesstill runssrc.root.mkdir(parents=True, exist_ok=True)for every configured source (polylogue/daemon/cli.py:2395on master1beb2e516a), anddefault_watch_sourcesincludes the legacy-read-only hook carrier sources fromhook_carrier_watch_sources. The watcher lines the worker cited do not cover daemon startup. Left open.sources/live/watcher.py:255sources/live/watcher.py:1215sources/live/watcher.py:1926sources/live/watcher.py:2143sources/origin_specs.py:194_fingerprint_sources_computehashes the exact bytes it parses and refuses (FingerprintSourceChangedError) when they differ from the signature that keys the memo, so no memo is written for another implementation.sources/origin_specs.py:216sources/origin_specs.py:250_invalidate_source_signatures(polylogue/sources/origin_specs.py_semantic_source_pathsdocstring).sources/origin_specs.py:251_source_signaturekeys every source by its SHA-256 content digest, not stat metadata (polylogue/sources/origin_specs.py_source_signature).sources/origin_specs.py:470sources/origin_specs.py:823sources/origin_specs.py:823hermes_snapshot_envelopekeeps an empty container witness for a container-valued root field, so the streaming recognizer used by prepared intake and provider detection agrees withlooks_like_hermes. The size-gated probe this finding cited is gone (recognize_source_classnow streams at every size), but the envelope still decides admission on those routes.sources/origin_specs.py:823sources/origin_specs.py:877in_derived_identity_closureanddevtools schema closureresolve relative paths from the caller's directory and refuse a missing path instead of reporting it outside.sources/origin_specs.py:1129sources/origin_specs.py:1457sources/origin_specs.py:1518Originenum and the generated table (lines 75-80).sources/origin_specs.py:1764parse_sources_archivehands local sources toingest_sources_archive, the canonical acquisition owner;_admit_non_session_origin_artifactsno longer exists, and #5787 deletedpolylogue/pipeline/services/archive_ingest.py.sources/origin_specs.py:2054sources/origin_specs.py:2055sources/origin_specs.py:2286_tool_outcomereportsnot_reportedwhen no outcome field is present andunsupported_constructonly for a present but unmapped one, and the Antigravity spec declares both.sources/origin_specs.py:3370artifact_observation_contractsemits rows for every declared provider wire.sources/parsers/antigravity.py:182::test_source_walk_follows_a_linked_tree_and_stops_at_a_cycle
sources/parsers/antigravity.py:513occurred_at_msis converted as epoch milliseconds.sources/parsers/antigravity.py:523exit_code/exitCodecolumn is read when the payload has none.sources/parsers/antigravity.py:530erroris a failure.sources/parsers/antigravity.py:563payloadmerges the envelope fields under the nested ones.sources/parsers/antigravity.py:579antigravity_unsupported_stepevent; siblings still parse.sources/parsers/antigravity.py:584sources/parsers/antigravity.py:653sources/parsers/antigravity.py:655parse_trajectory_dbrefuses a step outside_TRAJECTORY_SUPPORTED_STEP_TYPES/_FORMATSas a typed unknown with an event before any text fallback.sources/parsers/antigravity.py:663_trajectory_message(step_type="tool_result")returnsMessageType.TOOL_RESULTon origin/master 915a1f3 (probed), and tool-call steps are TOOL_USE.sources/parsers/antigravity.py:828summary_key = next(...)inparse_trajectory_db).sources/parsers/antigravity.py:844parent_session_provider_idon the parsed session.sources/parsers/antigravity.py:855sources/parsers/antigravity.py:1043sources/parsers/base_models.py:100ParseAccounting.assert_conservedrefuses ranges and outcomes outside[0, expected), so equal counts over the wrong ordinals no longer pass.sources/parsers/base_models.py:320sources/parsers/base_support.py:112tests/unit/sources/test_prepared_claude_ai_object.py::test_claude_ai_object_future_wire_type_keeps_parser_admissionand the Drive chunked-prompt test assert that nestedmetadata.kind/chunktypevalues raise<provider>_unknown_input, and the streaming envelopes compute the same first future type over nested frames. Removing the recursion (the worker's fix) broke that parity.sources/parsers/base_support.py:125sources/parsers/base_support.py:149AdmissionObserver(#5711), which keeps one pending event per unknown wire type by design (bounded memory;test_admission_payload.py::test_repeated_unknown_records_keep_one_pending_event_per_type). Every occurrence has its own UNKNOWN ledger outcome, but the ledger is only asserted, not persisted. This branch's per-occurrence events contradicted the bounded contract and were dropped in the merge. Open for a bounded fix (e.g. an occurrence count on the per-type event).sources/parsers/base_support.py:159sources/parsers/base_support.py:278tool_usepart with no name, id or input is a MALFORMED refusal, not a materialized part that yields no block.sources/parsers/base_support.py:720attachment_identity_hash(polylogue/pipeline/ids.py) keys attachment identity on message, name and MIME type only; size and bytes are excluded.sources/parsers/browser_capture.py:228_merge_envelope_attachmentsselectscandidate.inline_bytes if candidate.inline_bytes is not None else existing.inline_bytes.sources/parsers/browser_capture.py:257extracted_contentis read beforeprovider_meta.extracted_content.sources/parsers/browser_capture.py:318claude-file:<uuid>projection whose uuid equals the native attachment id reconciles without a byte witness.sources/parsers/browser_capture.py:379_claude_attachment_cross_route_match.sources/parsers/browser_capture.py:393sources/parsers/chatgpt.py:315aggregate_resultis normalized before the outcome mapping: any failed run is an error, all successful is success, otherwise unknown.sources/parsers/chatgpt.py:537/g/g-p-<project>/c/<id>form.sources/parsers/chatgpt.py:708outputandexit_code.sources/parsers/chatgpt.py:1066sources/parsers/chatgpt.py:1688sources/parsers/chatgpt.py:1690sources/parsers/chatgpt.py:1758audio_transcriptionconstruct is not marked unavailable.sources/parsers/claude/ai_parser.py:805tests/unit/sources/test_claude_ai_conversation_level_attachments.py).test_web_parser_attachments_and_runs.py::test_conflicting_bytes_keep_a_top_level_file_distinct
sources/parsers/claude/code_parser.py:627sources/parsers/claude/code_parser.py:1314_optional_safe_intaccepts only non-negative integral numbers; null, bool, NaN, negative, fractional and non-numeric values are unknown.::test_claude_numeric_zero_remains_measured
sources/parsers/claude/code_parser.py:1860sources/parsers/claude/code_parser.py:2002sources/parsers/claude/code_parser.py:2598sources/parsers/codex.py:524_optional_int_fieldkeeps null and invalid counters unknown and preserves a real zero.::test_codex_numeric_zero_remains_measured
sources/parsers/codex.py:576local_imagesreferences pass through_sanitize_codex_data_url.sources/parsers/codex.py:690sources/parsers/codex.py:2276classify_message_type, as production does.sources/parsers/codex.py:2828sources/parsers/codex.py:2831sources/parsers/codex.py:2896sources/parsers/codex.py:3558sources/parsers/codex.py:3563sources/parsers/codex_state.py:539sources/parsers/codex_state.py:582item:field:offset, without the physical rowid.Derived-identity closure
The checked-in baseline (
docs/plans/schema-closure-baseline.json) lists these changed files:polylogue/sources/decoder_json.py,polylogue/sources/live/discovery.py,polylogue/sources/origin_specs.py,polylogue/sources/parsers/antigravity.py,polylogue/sources/parsers/base_models.py,polylogue/sources/parsers/base_support.py,polylogue/sources/parsers/claude/ai_parser.py,polylogue/sources/parsers/claude/code_parser.py,polylogue/sources/parsers/codex.pyandpolylogue/sources/source_walk.py._FINGERPRINT_ALGORITHM_VERSIONalso moves (4 -> 5). This PR moves the derived schema identity and must not land during a rebuild. These changed files are outside the baseline:browser_capture.py,chatgpt.py,codex_state.py,schemas/synthetic/wire_formats.pyanddevtools/schema_closure.py. Theschema-closuregate passed in job 2228.Residuals
source_uris change for chunked Codex goals and memories (codex://state/<kind>-text/<thread>/<item:field:offset>). This cannot duplicate sessions or messages. These materials are written only bysources/codex_state_evidence.pyintosource.dbmaterial_observations. Nothing lowers them intoindex.db. Their only readers are thestorage/materials.pyhelpers (list_materials,list_materials_page,get_material), which no API, MCP, CLI or materializer calls, plus excision and blob liveness, which key on referrer and blob. The live archive holds no rows from the old coordinate:SELECT count(*) FROM material_observations WHERE source_uri LIKE 'codex://state/%'returns 0 on/realm/state/polylogue/source.db(fresh v1). No change or cleanup is needed.mkdiron legacy-read-only roots), 94-18 (repeated unknown occurrences, withdrawn at the merge), 95-09's descriptor-only case, and the 28 other findings the worker did not reach.FingerprintSourceChangedErrorrepeats until the signature cache is invalidated or the process restarts. That is deliberate, but a long-lived dev process on an edited checkout will keep refusing.🤖 Generated with Claude Code
https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg