Repository navigation
fix(daemon): a fresh daemon converges its backlog on a live host - #4683
Conversation
The browser-capture spool probe constructed a cursor store every tick, and initializing the ops tier rewrote its schema-state row on every open. Under the writer lease that write raised 'database is locked' and killed the fresh daemon mid catch-up (rehearsal 2026-09-05, 207 sessions in). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
A hot file whose accepted prefix and captured tail are both recorded is a typed safe state, not an authority gap. Counting it as a gap made the fail-closed gate refuse the entire catch-up whenever any session file was being appended, which on a live host is always: the fresh-start rehearsal ingested 207 of 45,490 files in 2.6 hours. Deferred cursors are now counted separately and reported, and only genuinely incomparable rows block. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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. |
…he backlog The frontier proof attributes every violation and authority gap to a source path. A live batch now drops exactly those paths and ingests the rest; a refusal no path explains still blocks everything. Rehearsal-6 showed one gemini-cli file with no accepted head refusing all 45,490 files of the catch-up. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 163a59bfbd
ℹ️ 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".
Rehearsal-8 died at 11:41Z when a live catch-up chunk's source write lost a lock race with the Drive acquisition that held source.db for 112 s. Lock contention is a retryable chunk failure; a malformed database still propagates. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57c6f4f2d6
ℹ️ 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".
The flush and the catch-up planner gate their own path set, dropping the refused paths before cursor reconciliation touches them; a batch whose every path is refused, or a refusal no path explains, still raises. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: feb577a7ce
ℹ️ 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".
…d refusal The frontier projection reports available=False whenever one check is unknown; the refused paths are still named. Only rows no path explains block everything. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
…rsor probe (#4695) ## Summary Four tests encoded behaviour changed by merged PRs: the queue runner's name in the slot refusal (#4684), the descriptor's `verify` exec without a width override (#4682), and the cursor-store stub's signature after the read-only spool probe (#4683). The descriptor's `verify_all` entry still pinned `POLYLOGUE_PYTEST_WORKERS=2`; it now follows the same constant as the affected tier. ## Verification `devtools test tests/unit/devtools/test_verify.py tests/unit/devtools/test_dev_loop_service.py tests/unit/devtools/test_pytest_slot.py tests/unit/daemon/test_daemon_cli.py::test_spool_pending_check_ignores_terminal_cursor_states` green (result line in the pre-push run). From the 2026-09-05 corpus on 754553b (85 failed / 20,522 passed). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid Co-authored-by: Claude Fable 5.1 <[email protected]>
Batch `polylogue-20260906-125721-2b6010a6` on base `c2ff26667df1`. **polylogue-bp12n.1** Rewrite convergence around the smallest domain-owned derivation kernel - [x] 1. A typed kernel exposes only frame binding, required-key enumeration, authoritative inspection, lease-free computation, and revalidated atomic publication. No generic artifact store, durable work qu - [ ] 2. FTS membership, one partitioned aggregate, embeddings, and normalized raw-to-logical membership each implement the same laws while retaining domain-owned storage and SQL. Their keys, input bindings - [x] 3. For every migrated domain, required minus valid inspection is the complete pending set. Deleting disposable scheduling state and restarting reconstructs the same pending set. Injecting stale cursor - [ ] 4. Clean construction, incremental append, replacement, deletion, lineage-affecting change, recipe-version change, and interrupted/resumed execution converge to equal typed semantic projections. A sec - [x] 5. Valid zero-output, missing output, stale binding, excess output, duplicate membership, and poison input are distinct. One poison key blocks only its dependent key closure; unrelated siblings conver - [ ] 6. Compute occurs outside the sole-writer lease. Publish revalidates frame and upstream identities and transactionally replaces one partition. Crash before publish leaves no partial output; crash afte - [ ] 7. Budget exhaustion and quiet-source policy produce typed pending-by-policy operation outcomes. Computation and publication failures produce attributable failed outcomes. Public readiness is derived - [ ] 8. Bulk rebuild work cannot mutate or certify a generation other than the one it builds. Active incremental frames cannot publish after their bound source revision changes. Valid embedding reuse requi - [ ] 9. FTS startup repair, stage/debt/freshness state, aggregate refresh guards, and manual rebuild execution are removed once the common laws cover their surviving behavior. Tests that only memorialize d - [ ] 10. No new generic durable schema object is added. The generic kernel/runner demonstrates major net maintained reduction, fewer concepts and owners, and sufficient module depth for its retained behavi - [x] 11. The bounded architecture experiment falsifies the selected contract against a minimal-consolidation control using one common vertical-slice suite. Any discovered simpler design satisfying every la - [ ] 12. Verification runs focused daemon/storage/insight/embedding/parser selectors through devtools; common derivation properties and crash/restart integration; schema roundtrip/versioning; managed write **polylogue-ylh7v** Converge aggregate insights by canonical partition with value-complete staleness - [ ] 1. Every retained aggregate family declares a typed partition key, semantic recipe version, upstream dependency projection, inspect query, and atomic replacement. - [ ] 2. The output relation is correctness authority. Binding rows exist only for valid-empty output or identity the rows cannot carry, and they commit to every input value used, not merely to IDs. There i - [x] 3. Red law for the measured defect: materialize, then mutate an output-affecting value (role, model, token count, tag) with identical IDs, timestamps, partition, and count; inspection must become non- - [ ] 4. Incremental append, replacement, deletion, reparenting, provider/day move, tag and profile mutation, and clean rebuild all converge to equal semantic relations, including zero-output partitions and - [x] 5. Deleting the disposable scheduling hints and restarting reconstructs the same pending set. Bounded work is deterministic and starvation-resistant; poison in one partition does not suppress siblings - [x] 6. Sync and async execution share one planner and SQL implementation. - [ ] 7. Refresh guards, timestamps, durable resume state, duplicate planners, and repair wrappers are deleted with no compatibility owner left; report line, schema, and test reductions. - [ ] 8. Property tests permute event order and batch boundaries; fault tests cover stale frame, crash before and after publish, valid empty output, excess rows, and deleted hints. Mutating one dependency p - [ ] 9. Verification: `devtools test tests/unit/insights tests/unit/daemon -k 'aggregate or partition or convergence'`; restart fault scenario; `devtools verify --quick`; `devtools verify`. **polylogue-8qm4k** Enforce archive-bound writer ownership through cancellation and backup - [ ] One in-process write lease covers every source.db writer (live batches, Drive catch-up, hook-spool drain, raw materialization, health censuses); a write outside it is a bug the tests catch (anti-vacui - [x] A locked write in one chunk is a retryable chunk failure, never daemon death (landed in #4683 as the immediate guard). - [ ] Reproduce: the rehearsal driver with the Drive cache present; watch for `database is locked` within the first Drive catch-up. **polylogue-avmq** Supervise every daemon background service through one lifecycle contract - [x] One DaemonServiceSpec registry accounts for every service/task spawned by run_daemon_services, including owner, prerequisites, dependencies, trigger/cadence, readiness, failure/retry policy, shutdown - [x] A supervisor is the sole task owner: dependency order is deterministic, duplicate starts are impossible, one service failure follows its declared isolate/degrade/fail-daemon policy, and shutdown cance - [x] Missing optional tiers and disabled capabilities produce explicit unavailable/skipped service states rather than background open/retry loops; required-prerequisite failure is fast and attributable. - [x] Focused daemon tests select minimal named services/capabilities through the production registry. The loopback/API-disabled fixtures complete under ten seconds without starting raw-materialization work - [ ] Empty and drained embedding backlogs publish exactly one terminal service transition and cannot spin on repeated queued=0 events; the existing timeout regression passes ten consecutive bounded runs. - [x] EventBus wiring, slow reconciliation heartbeats, budgeted StatusSnapshot reporting, and daemon process heartbeat consume the service contract without becoming parallel lifecycle owners. - [ ] Startup, partial-start rollback, cancellation, deadline expiry, injected child failure, missing tier, and normal stop are covered on the production composition route; a before/after graph accounts for - [x] Acceptance addition 2026-09-05: halted work is visible and unscheduled — one halt state per unit that is (1) excluded where work is selected and (2) published as that unit's status observation, surviv **polylogue-gmw2** Replace global spool preemption with fair, resumable intake - [ ] One fair dispatcher services browser spool, hook spool, configured source acquisition, and admitted raw-to-index work through domain adapters. A permanently failing first item and a very large class b - [ ] Files/source evidence remains queue authority. Scheduling order, deficits, discovery cursors, and ready/in-flight sets are disposable hints. Deleting them and restarting preserves correctness and resu - [ ] Stable domain identities and atomic acknowledgement make duplicate delivery idempotent. Crash before admission, after admission before acknowledgement, and after acknowledgement cannot lose material o - [ ] Malformed current input reaches a typed retryable or terminal acquisition failure after bounded attempts while siblings continue. Historical source quarantine, membership verdict, repair state, and ge - [ ] Clean-generation acquisition uses the same dispatcher/adapters and binds every admission to the fresh source generation. Frozen source/spool denominators reconcile exactly without a private campaign d - [ ] Repeated receiver-invalid payloads are identity/content deduplicated with bounded backoff and observable domain counters. This admission behavior does not create a second scheduler. - [x] Delete global spool preemption, replaced periodic loops, priority booleans, duplicate status adapters, and repair-only tests. Report production/test LOC, loop count, and state authorities before/after - [ ] Provider/spool-shaped tests cover fairness, poison isolation, crash matrix, duplicate delivery, deleted hints, huge paged backlog, mutable-source growth, and clean-generation destination. Mutating fai - [ ] Run focused daemon/browser/hook/source/materialization tests through devtools; managed archive-scale spool rehearsal with throughput, memory, writer-hold and restart measurements; oracle-integrity; qu **polylogue-20d.17** Serve every status surface from budgeted component snapshots - [ ] Archive status has one compact projection assembled from domain-owned observations and cheap authoritative inspections. No independent scheduler, whole-payload cache, universal collector registry, or - [x] The daemon service registry names the publisher of every runtime observation. A missing or failed optional service is reported unavailable or skipped and cannot delay a healthy component. Anti-vacuity - [x] Every component distinguishes measured zero or empty from unavailable, unreadable, timed out, stale, degraded and failed. A tier, table, or probe failure can never produce a numeric zero or an OK resu - [ ] Query and read status stay available when the daemon is absent or frozen. Direct mode inspects active authority cheaply, labels unavailable detail, and never treats stale last-good evidence as current - [ ] Derivation readiness comes from complete required inspect summaries. Operation health is a separate projection, and queue, debt, or freshness rows cannot certify convergence. - [ ] Expensive exact replay, denominators, embedding and forensic detail are explicit bounded cancellable operations. Compact status performs no hidden archive walk. - [ ] Archive status excludes Beads, Git, handoff and agent-coordination facts unless a public archive contract requires a bounded reference. - [ ] CLI, MCP, HTTP and Python adapt one typed projection. Stalled, unreadable source table, unavailable maintenance failure, stale frame, daemon absent, partial capability and exact zero cases carry ident - [ ] Health severity cannot be OK while its source component is unavailable. The maintenance-failure read-error route and the source-table count route are the named red cases. - [ ] Interactive budgets are established from randomized cold and warm measurements carrying per-domain timing and source identity. A stalled detail collector cannot violate the compact latency budget. - [ ] Synchronous rich collectors, TTL-only caches, duplicate normalizers and SQL, exception-to-zero helpers, debt/freshness inference and coordination cross-imports are deleted, with deleted/moved/retained - [ ] Production-route property tests inject missing file, missing table, permission error, sqlite error, timeout, true zero, positive count and stale frame for each numeric and health component. A mutant t - [ ] Verification: focused daemon, CLI, MCP and API status/readiness tests; stall, stale and unavailable scenarios; the latency workload; layering; generated render; oracle integrity; devtools verify --qui **polylogue-bp12n.2** Move the HTTP/web-shell surface out of the daemon ring into a surface process - [ ] The daemon process/package owns no browser HTTP registration, web shell, static assets, or browser auth. It retains only the UDS machine protocol and writer/convergence lifecycle. - [ ] One surface-host entrypoint serves every browser route from canonical declarations. Paths, methods, auth, request parsing, status codes, payload schemas, streaming, and OpenAPI remain behaviorally equ - [ ] With the daemon absent, read/query/compact-status routes continue through permitted direct active-generation execution and identify `served_by=direct`. Write/control routes refuse with the canonical t - [ ] Killing/restarting the surface host does not interrupt acquisition or convergence. Killing/restarting the daemon leaves active-generation reads available and cannot cause the surface to mutate directl - [ ] Surface-to-substrate access routes through operations/API contracts. Layering passes with no new exemption; any old exemption made obsolete by the move is removed. - [ ] Old daemon HTTP/web composition, duplicate route/adapter maps, lifecycle flags, compatibility imports, and package-location tests are deleted. Report daemon and surface LOC/import/failure-domain delta - [ ] Real managed two-process tests cover independent startup, kill/restart, daemon absence, direct read fallback, forbidden mutation fallback, streaming cancellation, and active/candidate isolation. Param - [ ] Run focused daemon/surface/API/MCP tests through devtools; process-failure integration; layering; generated render check; oracle-integrity; quick; and plain devtools verify. **polylogue-hwwtq** Delete the manual rebuild engine; ordinary convergence is the only build path - [x] `polylogue ops maintenance rebuild-index`, `rebuild-index-status`, `maintenance/rebuild_index.py`, `maintenance/sharded_rebuild.py`, `daemon/bulk_rebuild.py`, and every parallel planner, replay, statu - [x] Each capability the manual route carried either has a named owner in ordinary convergence with a focused production-route test, or is deleted with its route. - [x] The daemon's convergence path is unchanged and no new operation is added. - [ ] CLI, docs, CLAUDE.md, and the daemon docs describe only ordinary convergence, corrected in the same change. - [x] Generated references and layering are green, proving no dangling reference. - [ ] Anti-vacuity: restoring the CLI verb or invoking the old route fails discovery and tests. - [ ] The deletion ledger reports removed commands, routes, modules, planners, cursors, status models, tests, and docs, plus gross deleted, relocated, added, and net LOC. - [ ] Run focused maintenance, daemon, CLI, and convergence tests, generated references, layering, oracle-integrity, quick, and plain verification. No live mutation. --------- Co-authored-by: Claude Opus 5 <[email protected]>
## Summary
Archive-bound writer ownership becomes total (polylogue-8qm4k): a
writable open of any archive tier without the in-process write lease is
refused at `sqlite3.connect` itself, and one write coordinator exists
per event loop.
## Problem
Lease enforcement was per connection factory. Every declared factory
asserted the lease, but ~70 direct `sqlite3.connect` sites could
reintroduce an unserialized writer invisibly (the 2026-09-05 rehearsal
death: a concurrent writer held source.db past DB_TIMEOUT during the
Drive catch-up). The standalone HTTP write runtime also built a
`DaemonWriteCoordinator` outside the per-loop registry, so a second
serialization queue could be minted on the same loop.
## Solution
- `polylogue/storage/sqlite/write_guard.py`:
`install_archive_write_guard` wraps `sqlite3.connect`; a writable open
of one of the six tier files asserts `require_write_lease`, with
`declared_unguarded_write(reason)` as the single thread-local seam for
bootstrap/test authorities. Armed inside `run_daemon_services`'
writer-boundary block.
- `register_write_coordinator`: one coordinator per loop; the standalone
runtime registers the one it builds.
- The guard's first integration run caught a real census miss: startup
durable-change-train reconciliation opened every durable tier read-write
inside `run_daemon_services` outside the lease (`daemon/cli.py` →
`durable_change_train._open_existing_tier`, 14 call sites); it now runs
under `write_lease("daemon.durable_change_train.startup")`. Three
test-side writable opens became read-only and one genuine test authority
declares itself.
- Census of every writable tier open at 89618f9 (table in the worker
report, condensed in the commit): every production daemon route already
reached the lease (via `require_write_lease`, `admit_stage_write`,
bridged stages or the HTTP write gate); CLI maintenance, MCP telemetry
and the offline generation builder are cross-process authorities outside
any in-process lease by construction.
- The #4683 locked-chunk guard still holds after #5228; a new test
reproduces the lock race with two synthetic writers on a scratch
archive.
- `docs/sqlite-connection-policy.md` gains the writable-open boundary
section.
## Closure
`daemon/write_coordinator.py` is IN the derived-schema closure; the
identity moves. Lands before the rebuild.
## Verification
- `agentctl ... verify_quick` → job 2605 **succeeded** (2591 failed on
layering/consumer-reachability/closure for the new module; fixed in
afbd03f)
- `agentctl ... pytest_focused -- <write lease/guard, convergence,
coordinator, watcher, http, daemon cli, ingest batch>` → job 2606: 511
passed, 2 failed (both the master-red test_daemon_cli tests fixed
forward in #5229)
- Worker: 240 + 137 passed over the affected files; ruff/mypy clean.
## Residuals
- The guard is armed only in the daemon writer boundary; the standalone
HTTP write runtime and MCP server do not arm it.
- `storage/index_generation.py`'s three writable generation opens are
not explicitly leased; if a daemon-side generation build reaches them
they will now be refused. Smoke this at the start of the fresh build
(polylogue-i3i5k owns the full-scale proof; 8qm4k stays open as that
gate).
- `daemon/http.py`: two lines (PR #5220 overlap).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added connection-level protection for archive SQLite databases,
requiring an active write lease before writable connections are opened.
- Added safe handling for declared administrative or maintenance writes.
- Extended daemon startup recovery so durable changes occur within the
single-writer boundary.
- Registered standalone HTTP writers with their write coordinator to
improve coordination.
- **Bug Fixes**
- Prevented uncoordinated archive writes while leaving read-only,
in-memory, and non-archive connections unaffected.
- **Documentation**
- Documented writable SQLite connection boundaries, lease requirements,
and approved bypass behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Fable 5.1 <[email protected]>
|
Codex review threads on this PR whose cited code is gone (checked against master at 23f91a5):
Resolving these threads. |
) ## 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]>
## Summary Lands 24 verified storage fixes from the worker-6 Codex-debt batch (beads polylogue-1tyq5.101, .102, .103). Each fix was rechecked against current master and has a regression test on its production route. One worker fix was dropped because it contradicts documented policy (103-09). The other 50 findings are recorded below as fixed-already, stale, refuted or not reached. ## Problem The worker could not run tests. Its draft (ca8dbff) was based on e1a2f75, and master has moved on since then. Each "fixed" claim therefore had to be checked again on current master. The defects that remain on master: - **Material admission** (`storage/materials.py`) - A valid JSON document larger than 2 MB was marked `malformed`. - Multi-record NDJSON was marked `malformed` too, because it is not a single JSON value. - ZIP entry names were copied without a bound into durable manifest metadata. - Readmitting a material returned the caller's arguments rather than the stored row. - An idempotent retry matched its own row and was rewritten as `duplicate`. - A malformed URL raised out of the API before any durable claim was recorded. - A material linked twice to one evidence ref was listed twice. - A chunked response carrying a stale `Content-Length` was stored as `partial`. - A redirected HTTP failure did not record which hop failed. - A relative file path raised in `Path.as_uri`. - **Raw frontier** (`storage/raw_retention.py`) - The integrity projection and the selected-frontier admission helpers opened `source.db` with `validate_schema=False`. A source tier at an unadmitted schema version could then report healthy frontier evidence. - A pinned operation read with no ops handle fell back to opening the live `ops.db` path. - **Index tier and reads** - Trigger-maintained action pairs copied the stale outcome cached on the tool_use block. Pair outcomes now come from the paired result block. - A work-event payload could override the validated `event_id`/`summary`. - Reviving or re-deleting a displaced saved view cleared another view's watch. - A NaN or infinite metadata value was accepted on first write, after which the key could not be changed. - An empty aggregate page reported `total_groups=0`. - Session timestamps dropped their milliseconds. - The observed-tool rollup and the observed-event relation, including its status pushdown, reinterpreted a retained exit code 0 as success even when the canonical outcome was a deliberate `unknown`. - Changing an attachment ref's target or position did not invalidate the profile binding. - `list_embedding_catchup_runs` rejected the `completed_with_failures` status that its writer accepts. - **Bootstrap** (`archive_tiers/bootstrap.py`) - The OPS same-digest shortcut returned without enabling foreign keys. - A failure after `.bootstrap` was published, but before the format marker, left an archive that could not be recovered. ## Solution Most fixes are the worker's patch, with these changes: - **101-02:** JSON documents are validated as a stream with `ijson.basic_parse`, so a large material is never loaded as Python objects. NDJSON is parsed line by line. - **101-04:** readmission returns the persisted row and does not overwrite stored filename, media type, privacy or supersession metadata. The worker's version replaced them with the new call's arguments, including `None`. - **101-05:** the extra "never mark malformed as duplicate" condition is dropped. Only the self-match is fixed. - **101-21:** the siblings are fixed too: `raw_frontier_blocked_raw_ids`, `_raw_frontier_blocked_selected_paths` and `raw_frontier_blocked_source_paths` open `source.db` with schema admission and report `SchemaSkew` as unavailable. - **101-23:** the ops-unavailable branch is typed and explicit. - **103-15:** the finding's cited route (evidence summary) already reads `result_state` on master. The same defect is fixed in the two remaining readers: the rollup and `run_projection_relations` (projection and pushdown). - **103-09 dropped:** see the table. ## Verification - `agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w6 -- <28 files>` (job 2539): 631 passed, 12 failed, 1 error. The same 9 failures and 1 error occur on base (job 2601: `test_user_state_contracts` FacadeDaemonRequiredError x7, `test_session_partition_convergence` x2, `test_frontier_admission::test_changed_keys_beyond_one_batch_are_all_checked` timeout). The other 3 were test defects in the new file (DSL `AND`, source-tier raw lookup), fixed and rerun in job 2603: 43 passed, 1 failed (the same base timeout). - Revert proof: the production files restored from origin/master, with the new tests kept (job 2540): 35 failed. Every new test fails, each on the defect it names (for example `ValueError: relative paths can't be expressed as file URIs`, `DID NOT RAISE`, `KeyError: 'uncompressed_bytes'`, and assertion failures). - `agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w6` (job 2639): `verify: PASSED exit=0` at 2fcacb6 (the first run, job 2559, failed on a moved sqlite-degradation anchor; the anchor was updated in the baseline). ## Self-review **Sibling sites.** Each defect class was searched across the codebase. - Unchecked durable-tier opens: three sibling source opens in `raw_retention.py` were fixed. The two `ops.db` opens keep `validate_schema=False`, because OPS is a disposable tier whose identity converges in place. - Exit-code success reinterpretation: the rollup and both observed-event sites were fixed. `archive.py` still has error-count columns that count error signals; they make no success claim, so they were left unchanged. `archive/actions/parsing.py` and `rendering/semantic_cards.py` are presentation-layer and out of scope. - The watch-clearing fix covers both `save_view` and `delete_view`. **Cancellation and shutdown.** No loops or long-running work were added. **Unbounded reads.** JSON validation now streams rather than materializing a whole document. The ZIP manifest no longer copies names. `admit_material_file` still reads the whole file (103-13, not reached). **Fail-open fallbacks.** Removed rather than added: the pinned read no longer falls back to the live ops path. Schema skew now blocks admission instead of passing silently. **Compatibility shims.** None added. **Removed symbols.** The unused `require_operation_lifecycle_status` import is gone. No monkeypatch targets or fakes reference anything removed. **Tests prove the production route.** Every test goes through `admit_material`/`acquire_material`, `ArchiveStore`, `initialize_active_archive_root`, the trigger DDL, or the query route (`query_unit_counts`). The revert run shows they fail on master's code. ## Per-finding table | key | disposition | evidence | test | |---|---|---|---| | 101-01 #5249 `polylogue/storage/index_generation.py:1599` | fixed-already | `polylogue/daemon/cli.py:3376`: Shutdown discard is submitted through write_coordinator.run_sync before coordinator drain. | — | | 101-02 #4241 `polylogue/storage/materials.py:73` | fixed | Validates the whole document as a stream (ijson) and NDJSON record by record; trailing garbage stays malformed. | test_material_json_admission_validates_the_complete_document, test_material_ndjson_admission_parses_each_record. | | 101-03 #4241 `polylogue/storage/materials.py:80` | fixed | Manifest keeps entry_count and uncompressed_bytes only; names stay in the retained CAS bytes. | test_material_zip_manifest_does_not_copy_entry_names. | | 101-04 #4241 `polylogue/storage/materials.py:139` | fixed | admit_material returns the persisted row (get_material) instead of its arguments; stored filename/media/privacy/creation time are not overwritten on readmission. | test_material_readmission_returns_the_persisted_row. | | 101-05 #4320 `polylogue/storage/materials.py:150` | fixed | Duplicate detection excludes the admitted material_id. | test_material_readmission_does_not_duplicate_itself (a distinct observation of the same bytes is still 'duplicate'). | | 101-06 #4320 `polylogue/storage/materials.py:236` | fixed-already | `polylogue/storage/materials.py:662-674; polylogue/storage/materials.py:715-720`: List extracts IDs from tuple rows or sqlite3.Row; get_material maps cursor.description for tuples. | — | | 101-07 #4623 `polylogue/storage/materials.py:240` | fixed | URL parsing and InvalidURL/ValueError from connection construction become a durable non-retryable 'malformed' claim. | test_material_invalid_url_is_a_durable_malformed_claim, test_material_invalid_http_target_is_a_durable_claim. | | 101-08 #4241 `polylogue/storage/materials.py:240` | fixed | Evidence filter uses EXISTS, one row per material. | test_material_evidence_listing_returns_one_observation_per_identity. | | 101-09 #5408 `polylogue/storage/materials.py:262` | fixed | Content-Length is ignored when Transfer-Encoding frames the response. | test_material_chunked_response_ignores_stale_content_length. | | 101-10 #4623 `polylogue/storage/materials.py:315` | fixed | HTTP failure diagnostic carries the failing hop URL when it differs from source_uri. | test_material_http_error_retains_redirect_destination. | | 101-11 #4623 `polylogue/storage/materials.py:345` | fixed | admit_material_file uses Path.absolute() before as_uri(). | test_material_relative_file_admission_retains_success_or_absence. | | 101-12 #4623 `polylogue/storage/materials.py:345` | fixed | Same fix as the sibling comment on this line (Path.absolute()). | test_material_relative_file_admission_retains_success_or_absence. | | 101-13 #4623 `polylogue/storage/materials.py:347` | not reached | `polylogue/storage/materials.py:591-594`: Local material admission reads the entire file into memory. | — | | 101-14 #5626 `polylogue/storage/materials.py:741` | not reached | `polylogue/storage/materials.py:739-752`: Timestamp/hash keyset cursor can miss subsequent inserts sorting before the cursor at the same timestamp. | — | | 101-15 #4039 `polylogue/storage/raw_authority_verdict_projection.py:103` | not reached | `polylogue/storage/raw_authority_verdict_projection.py:86-148`: Projection promotes every byte-proven append leaf independently of accepted-chain ambiguity. | — | | 101-16 #4556 `polylogue/storage/raw_failure_lifecycle.py:111` | fixed-already | `polylogue/storage/raw_failure_lifecycle.py:124-139`: Ordinary source open performs admission and reports SchemaSkewError as unavailable. | — | | 101-17 #5301 `polylogue/storage/raw_reconciler.py:213` | not reached | `polylogue/storage/raw_reconciler.py:108-127`: Renamed pass_id payload still advertises the previous census.v1 schema. | — | | 101-18 #5350 `polylogue/storage/raw_reconciler.py:324` | refuted | `polylogue/storage/raw_reconciler.py:314-381`: Explicitly requires an archive predating the raw-ID change; current assignment is fresh v1 with no carry-forward of that state. | — | | 101-19 #5350 `polylogue/storage/raw_reconciler.py:549` | refuted | `polylogue/storage/raw_reconciler.py:564-615`: Requests migration of durable candidate assertions from a deleted framework; outside the fresh-v1/no-carry-forward contract. | — | | 101-20 #5301 `polylogue/storage/raw_reconciler.py:1049` | not reached | `polylogue/storage/raw_reconciler.py:394-473`: Blocker ID selection only searches its proposed ID; a unique open plan conflict can suppress the insert while returning a nonexistent ID. | — | | 101-21 #4556 `polylogue/storage/raw_retention.py:1231` | fixed | Frontier projection opens source.db with schema admission and reports SchemaSkew as unavailable; the selected-frontier admission helpers (raw_frontier_blocked_raw_ids, _raw_frontier_blocked_selected_paths, raw_frontier_blocked_source_paths) do the same. | test_frontier_projection_refuses_a_source_from_a_newer_schema. | | 101-22 #4683 `polylogue/storage/raw_retention.py:1302` | not reached | `polylogue/storage/raw_retention.py:1387-1420`: Admission attributes a sampled million-row projection without refusing truncated populations. | — | | 101-23 #5020 `polylogue/storage/raw_retention.py:1688` | fixed | With ops_conn=None the pinned snapshot reports cursor status 'unknown' and never opens ops_db_path. | test_pinned_frontier_does_not_substitute_a_live_ops_file_for_missing_reader. | | 101-24 #5371 `polylogue/storage/raw_retention.py:2350` | not reached | `polylogue/storage/raw_retention.py:2478-2491`: Residual test uses post-filter candidate count, which cannot prove the SQL selection was exhausted. | — | | 101-25 #4538 `polylogue/storage/search_providers/sqlite_vec_runtime.py:98` | fixed-already | `polylogue/storage/search_providers/sqlite_vec_runtime.py:239-249`: Managed provider rejects missing active index before attempting attachment; pinned snapshot uses read-only attachment at 120-133. | — | | 102-01 #4538 `polylogue/storage/search_providers/sqlite_vec_runtime.py:115` | not reached | `polylogue/storage/search_providers/sqlite_vec_runtime.py:34-108;251-256`: Managed connections rebuild and hash the complete eligible-message TEMP projection on each acquisition. | — | | 102-02 #5274 `polylogue/storage/source_generation_receipts.py:252` | not reached | `polylogue/operations/daemon_ingest.py:881-999`: Historical receipt serializes raw identities/completeness but not source-item blockers and member dispositions. | — | | 102-03 #4719 `polylogue/storage/sqlite/action_pairs.py:44` | fixed | Action pairs take the outcome from the paired result block, 'no_result' when absent, matching _reconcile_tool_use_outcomes. | test_action_pairs_follow_paired_result_updates_and_deletes. | | 102-04 #5275 `polylogue/storage/sqlite/archive_tiers/__init__.py:43` | fixed-already | `polylogue/storage/sqlite/archive_tiers/__init__.py:21-26;42-49`: Exported durable tier constants and ARCHIVE_VERSION_BY_TIER all use version one. | — | | 102-05 #4201 `polylogue/storage/sqlite/archive_tiers/archive.py:416` | fixed-already | `polylogue/mcp/archive_support.py:165-179; polylogue/surfaces/payloads.py:1311-1315`: MCP delegates to canonical hydration and the shared summary envelope explicitly supplies terminal_state, total_cost_usd, cost_provenance and relative_time. | — | | 102-06 #4353 `polylogue/storage/sqlite/archive_tiers/archive.py:1085` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:1622-1629`: Work-event append reverses public Origin into guessed Provider. | — | | 102-07 #4353 `polylogue/storage/sqlite/archive_tiers/archive.py:1086` | fixed | Validated event_id and summary are merged after the caller payload. | test_work_event_payload_cannot_override_validated_identity. | | 102-08 #4816 `polylogue/storage/sqlite/archive_tiers/archive.py:2459` | stale | `polylogue/storage/sqlite/archive_tiers/archive.py:4492-4513`: Named list_session_work_event_insights LIKE implementation is gone; current insight dispatch is elsewhere. No claim of testing successor search. | — | | 102-09 #4225 `polylogue/storage/sqlite/archive_tiers/archive.py:2542` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:3168; polylogue/storage/sqlite/archive_tiers/archive.py:3952`: Full catalog coverage sets cost_is_estimated=0, confusing completeness with monetary authority. | — | | 102-10 #4293 `polylogue/storage/sqlite/archive_tiers/archive.py:2681` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:3351-3360;3400-3419`: Outer cohort dedup count is reused for raw-model breakdown and status classification. | — | | 102-11 #4395 `polylogue/storage/sqlite/archive_tiers/archive.py:2957` | fixed-already | `polylogue/storage/sqlite/archive_tiers/archive.py:3280;3311;3351`: Session populations use json_group_array and lossless _decode_session_id_set instead of comma splitting. | — | | 102-12 #4692 `polylogue/storage/sqlite/archive_tiers/archive.py:3380` | fixed-already | `polylogue/storage/sqlite/archive_tiers/archive.py:3971;8398`: Profile SELECT and domain mapper both carry input_content_hash. | — | | 102-13 #5408 `polylogue/storage/sqlite/archive_tiers/archive.py:5215` | fixed | save_view clears the previous name's watch only when this view still owns that name. | test_resurrected_view_rename_does_not_clear_another_views_watch. | | 102-14 #5408 `polylogue/storage/sqlite/archive_tiers/archive.py:5284` | fixed | delete_view clears the watch only on a successful delete of the name's active owner. | test_redeleting_view_does_not_clear_reassigned_name_watch. | | 102-15 #5307 `polylogue/storage/sqlite/archive_tiers/archive.py:6193` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:6222-6229`: Provider usage readiness takes archive-global status counters, not the requested origin/time scope. | — | | 102-16 #5307 `polylogue/storage/sqlite/archive_tiers/archive.py:6195` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:6222-6229`: Provider usage readiness hardcodes stale count zero and only compares row coverage. | — | | 102-17 #4238 `polylogue/storage/sqlite/archive_tiers/archive.py:6730` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:7688-7699`: Display duration subtracts normalized session endpoints, including synthesized endpoints. | — | | 102-18 #4649 `polylogue/storage/sqlite/archive_tiers/archive.py:7271` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:8140-8146`: Missing persisted provenance is labeled with current materializer version. | — | | 102-19 #5362 `polylogue/storage/sqlite/archive_tiers/archive.py:7408` | not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:7672-7679`: All heuristic titles are suppressed, not only prompt echoes. | — | | 102-20 #4221 `polylogue/storage/sqlite/archive_tiers/archive.py:7539` | stale | `polylogue/storage/sqlite/archive_tiers/archive.py:8454-8504`: Former profile-cost fallback was removed; current cost insight uses canonical usage authority and reports no_tokens explicitly rather than labeling fallback as catalog-priced. | — | | 102-21 #4804 `polylogue/storage/sqlite/archive_tiers/archive.py:7839` | fixed | set_user_metadata canonicalizes every value before the first write, so NaN/inf are refused inside the transaction. | test_metadata_first_write_refuses_nonfinite_json_atomically. | | 102-22 #5275 `polylogue/storage/sqlite/archive_tiers/archive_plan.py:189` | fixed-already | `polylogue/storage/sqlite/archive_tiers/archive_plan.py:181-213`: Schema fingerprint and version readers now use canonical open_readonly_connection URI construction. | — | | 102-23 #5275 `polylogue/storage/sqlite/archive_tiers/archive_plan.py:261` | stale | `polylogue/storage/sqlite/archive_tiers/archive_plan.py:181-223;bootstrap.py:877-924`: initialize_archive_tier_files_from_plan is deleted; ordinary fresh root bootstrap now records and admits pending intent. | — | | 102-24 #5356 `polylogue/storage/sqlite/archive_tiers/archive_query_reads.py:3424` | fixed | The aggregate page selects a count row over all groups joined to the requested page, so an empty page keeps total_groups. | test_empty_aggregate_page_preserves_total_group_count. | | 102-25 #5514 `polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:48` | fixed-already | `polylogue/storage/sqlite/archive_tiers/vocabulary_inventory.py:138-153`: core_types is scanned before consumer re-exports, retaining declaration ownership. | — | | 103-01 #5521 `polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:49` | not reached | `docs/atlas/00-core.md:59-67;docs/atlas/storage.md:35-40`: Identity anchors no longer point at their generated-key declarations. | — | | 103-02 #4678 `polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:729` | fixed | Session created_at/updated_at project strftime('%Y-%m-%dT%H:%M:%fZ', ms/1000.0). | test_session_record_reads_preserve_milliseconds. | | 103-03 #4177 `polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:885` | not reached | `polylogue/maintenance/archive_verification.py:1443-1467`: Lineage sanity checks message existence but not branch-point content address agreement. | — | | 103-04 #5476 `polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:1217` | not reached | `docs/atlas/storage.md:79-87`: Session-link/branch-point explanation anchors shifted away from their declarations. | — | | 103-05 #4302 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:249` | not reached | `polylogue/storage/sqlite/archive_tiers/bootstrap.py:435-451;501-561`: OPS sentinel fast path neither recreates nor refuses missing canonical objects. | — | | 103-06 #4302 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:249` | fixed | _materialize_archive_tier enables foreign keys before the OPS same-digest shortcut. | test_cached_ops_initialization_enables_connection_foreign_keys. | | 103-07 #4560 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:254` | fixed-already | `polylogue/storage/sqlite/archive_tiers/bootstrap.py:407-417`: Derived identity stamp is followed by conn.commit(). | — | | 103-08 #4560 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:845` | fixed-already | `polylogue/storage/sqlite/archive_tiers/bootstrap.py:1159-1178`: Stored user_version is admitted before materialization; skew raises SchemaSkew. | — | | 103-09 #4560 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:846` | dropped (not a defect) | ops.db identity converges in place by documented policy (`initialize_archive_database`); worker's refusal reverted | — | | 103-10 #5275 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:848` | fixed-already | `polylogue/storage/sqlite/archive_tiers/bootstrap.py:877-905`: Pending fresh bootstrap intent is validated and exempts incomplete first creation from completed-marker admission. | — | | 103-11 #5275 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:883` | fixed-already | `polylogue/storage/sqlite/archive_tiers/bootstrap.py:888-920`: Marker admission and fresh-bootstrap classification are keyed to durable tier files, not replaceable-only tiers. | — | | 103-12 #5275 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:959` | fixed | Fresh bootstrap publishes (or validates an already published) format marker before the completed bootstrap marker, so the pending intent survives until both exist. | test_fresh_bootstrap_format_publication_failure_is_resumable. | | 103-13 #4323 `polylogue/storage/sqlite/archive_tiers/embeddings.py:20` | refuted | `polylogue/storage/sqlite/archive_tiers/embeddings.py:7;26-31`: Finding requires opening the pre-v1 version-five vector table; this assignment starts fresh with embeddings version one and canonical model column, no prior archives. | — | | 103-14 #4719 `polylogue/storage/sqlite/archive_tiers/index.py:868` | not reached | `polylogue/storage/sqlite/archive_tiers/archive_query_reads.py:121-143;1066-1088`: Public action row and selected column list omit canonical unknown-outcome reason. | — | | 103-15 #4719 `polylogue/storage/sqlite/archive_tiers/index.py:877` | fixed | The cited evidence-summary route already reads result_state on master (operations/http_read_models.py read_session_evidence). The same exit-code reinterpretation remained in list_tool_observed_event_count_rows and the observed-event relation and its status pushdown (run_projection_relations.py); all three now map only the canonical tool_outcome. | test_observed_tool_rollup_respects_canonical_outcome_over_exit_code. | | 103-16 #4630 `polylogue/storage/sqlite/archive_tiers/index.py:1090` | not reached | `polylogue/storage/sqlite/archive_tiers/index.py:1319-1320`: Thread search projection only includes thread ID, repo and session IDs; evidence-kind/support terms are absent. | — | | 103-17 #5312 `polylogue/storage/sqlite/archive_tiers/index.py:1257` | fixed-already | `tests/infra/reindex_differential.py:95-98`: session_usage_rollup_bindings now has an explicit exact deterministic census classification. | — | | 103-18 #5410 `polylogue/storage/sqlite/archive_tiers/index.py:1499` | fixed | session_profile_binding_refs_au now fires on attachment_id and position updates. | test_attachment_reference_identity_and_order_invalidate_profile_binding. | | 103-19 #4630 `polylogue/storage/sqlite/archive_tiers/index.py:1786` | not reached | `polylogue/storage/sqlite/archive_tiers/index.py:2150-2158`: Child monetary amount may use provider evidence while its estimated flag is derived from catalog coverage. | — | | 103-20 #4630 `polylogue/storage/sqlite/archive_tiers/index.py:1919` | not reached | `polylogue/storage/sqlite/archive_tiers/index.py:2289`: Tag-rollup materialized_at is literal query-time rather than an ISO timestamp or missing value. | — | | 103-21 #5373 `polylogue/storage/sqlite/archive_tiers/ops.py:209` | refuted | `polylogue/storage/sqlite/archive_tiers/ops.py:1-220;bootstrap.py:888-909`: Finding asks to carry and drop objects in archives from the prior OPS schema. Fresh-v1/no-prior-state assignment excludes that upgrade. | — | | 103-22 #5521 `polylogue/storage/sqlite/archive_tiers/ops_write.py:1237` | fixed | list_embedding_catchup_runs validates the filter with OperationRunStatus, the writer's vocabulary. | test_embedding_catchup_filter_accepts_completed_with_failures. | | 103-23 #4324 `polylogue/storage/sqlite/archive_tiers/read_insights.py:28` | fixed-already | `polylogue/storage/sqlite/archive_tiers/read_insights.py:27-36`: Date-window parser delegates to shared parse_query_date. | — | | 103-24 #4354 `polylogue/storage/sqlite/archive_tiers/read_insights.py:82` | not reached | `polylogue/storage/sqlite/archive_tiers/read_insights.py:123-145`: Episode context scans only physical session messages and misses composed inherited prefix. | — | | 103-25 #4354 `polylogue/storage/sqlite/archive_tiers/read_insights.py:83` | fixed-already | `polylogue/storage/sqlite/archive_tiers/read_insights.py:115-136`: LIMIT 3 is inside the row-producing subqueries consumed by GROUP_CONCAT. | — | ## Derived-identity closure All ten changed production files are members of the checked-in `docs/plans/schema-closure-baseline.json`: `storage/materials.py`, `storage/raw_retention.py`, `storage/sqlite/action_pairs.py`, `storage/sqlite/run_projection_relations.py`, and in `storage/sqlite/archive_tiers/`: `archive.py`, `archive_query_reads.py`, `archive_tiers_specs.py`, `bootstrap.py`, `index.py`, `ops_write.py`. The index trigger DDL, the session timestamp projection and the action-pair lowering all change, so the derived identity moves. This must land before the fresh rebuild. `devtools schema closure` could not run in this checkout because its environment is not provisioned, so membership was read from the committed baseline. ## Residuals - 26 findings are not reached, and they stay open in their beads. Among them are 101-13 (local file admission reads the whole file into memory) and 101-14 (keyset cursor). - Session `created_at`/`updated_at` strings change format from `YYYY-MM-DD HH:MM:SS` to ISO-8601 `...T...sssZ`. No reader in this repository parses the old format; `annotations/join.py` slices the first 10 characters, which is unaffected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
|
Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at bf68918):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at 5ebcfe5):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at 5ebcfe5):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Two defects that stopped the fresh-start rehearsal (2026-09-05, task 1547) at 207 of 45,490 files:
deferredcursor was counted as a cursor-authority gap, so the fail-closed source-selection gate refused the entire catch-up whenever any session file was being appended. On a live host that is always. Deferred cursors are now a separate, reported count; only genuinely incomparable rows block.database is lockedand killed the daemon.Problem
Rehearsal evidence:
/realm/tmp/work/rehearsal-4/prev-rehearsal-5/daemon.log(61refused by cursor authoritylines; the integrity snapshot's single gap sample isstate=deferredfor a transcript being appended), and the terminal traceback in_record_ops_schema_statefrom_browser_capture_spool_has_pending_files.Solution
raw_retention: deferred cursors leave the gap count, addcursor_authority_deferred_countto the snapshot, projection, status model and readiness breakdown; the reason string names them.ops_write._record_ops_schema_state: read first, write only on change.cli._browser_capture_spool_has_pending_files:initialize=False.Verification
devtools verify --quick: all gates ok.test_deferred_cursor_never_blocks_source_selection(red if deferred counts as a gap again),test_reopening_a_current_ops_db_writes_nothing(red if the unconditional write returns; observesPRAGMA data_version). Existing deferred-classification test updated to the new law.Residual risk
Hand-built status payloads that omit the new count validate (it defaults to 0). A deferred cursor that never resolves is now invisible to the gate; it remains visible in status and in the readiness breakdown.
Beads: polylogue-6q16u, polylogue-74kj3
🤖 Generated with Claude Code
https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid