Repository navigation
fix: close 14 daemon/operations Codex findings; stage tier resets - #5824
Merged
Merged
Conversation
- maintenance.reset refuses any target that is, or holds, an archive tier database or sidecar the serving daemon has open (typed reset_live_archive_tier), before any audit row or deletion (07.F012). - The unbound FTS status fallback and sync search admission read every COUNT and the admitted rows from one snapshot (03.F036). - An embedding backfill pass with failed keys finalizes as failed with error embedding_keys_failed in the durable receipt and the returned envelope; the CLI exits 1 on that outcome (03.F031). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lob bytes Backup copies a missing source-owned blob into the package only as the exact bytes its acquisition source still holds; verification and the migration backup gate derive the required blob set from the package's own tiers and never replay an acquisition file, so a signed package missing a required blob is refused (03.F003). ZIP reacquisition runs acquisition's ZipEntryValidator over the whole central directory before decompressing a member (07.F050). Raw derivation stages an absent retained blob from the exact window of its direct source and publishes it through the writer's reservation protocol instead of retrying forever; an unrecoverable raw fails with a typed reason (03.F018). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve polylogue-9kemf 07.F049 with snapshot-bound field-byte continuations shared by daemon, Python API, CLI and MCP. Preserve exact completed-row counts and normal small-row projections; never materialize a whole oversized file edit before paging it. Validated: 115 focused regression/parity tests passed; all 12 devtools verify --quick gates passed. Index-only schema change: epoch triggers for file_edits and web_content_constructs.
…erations # Conflicts: # docs/plans/schema-closure-baseline.json
…le tiers The daemon holds index.db and ops.db open, so maintenance.reset naming them now records the authorized plan and a running attempt and deletes nothing. The next polylogued start resolves the plan at a new seam, apply_staged_archive_resets, under exclusive ownership and before any tier opens: identity-matched databases go with every sidecar beside them, and bootstrap recreates the tiers. Ordinary recovery leaves such a plan pending. An established archive missing source.db or user.db refuses to open, so --include-source-db and --include-user-db are removed with their request fields and the source-risk helper. A target that is or holds a durable tier, embeddings.db or a directory of tiers is a typed refusal before any audit row. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…losure cache - Raw discovery keeps the first sweep prompt, but a sweep after a completed one pages at the idle cadence until nine sweep durations have passed, so prompt paging holds a bounded share of wall time on any archive size (the 07.F032 fix otherwise re-swept continuously). - FtsDerivationAdapter.inspect_partition reads its COUNTs in one snapshot outside a caller transaction, which covers the status component and archive readiness callers the 03.F036 fix missed. - The migration gate's blob-closure cache keeps one package instead of every backup root the process ever gated. - Point stale daemon/backup.py references at operations/archive_backup.py. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…erations # Conflicts: # polylogue/sources/live/watcher.py
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
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 15:53
|
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. |
This was referenced Sep 29, 2026
This was referenced Sep 29, 2026
Sinity
added a commit
that referenced
this pull request
Sep 29, 2026
## Summary A full-prefix fallback proof in a `full_evidence` backup now records the window it proved, so verification rebuilds that window. | Bead | Finding | Thread | | --- | --- | --- | | polylogue-wbv7k | 18.F001 Preserve the full-prefix shape in recovery proofs | PRRT_kwDOR7_N4c6eyazk | ## Problem `_source_recoverability_proofs` (`operations/archive_backup.py`) handles an append row whose retained blob is the whole observed prefix `[0, end)`, which `admit_raw_observation` writes while recording only the tail's offsets. It proves the row from that prefix, then emits the proof with the row's own `append_start_offset`. Verification rebuilt `[start, end)` from the proof. That hash can never match the prefix blob, so a correctly proved backup failed its reference evidence. ## Solution When the fallback proves the blob from `[0, end)`, the proof records `append_start_offset=0` and `append_end_offset=end`. The historical legacy-replay window uses the same variables (`proof_append_start` and `proof_append_end`). A proof is emitted only for a matched payload, so the window is always the one that was hashed. Derived-identity closure: none of the changed files is in the closure. ## Verification - `agentctl job start --workspace <wt> polylogue pytest_focused -- tests/unit/daemon/test_backup.py tests/unit/cli/test_backup_command.py` (job 3454, head f85601c): `devtools test: PASSED exit=0 diagnosis=pytest_passed`, 77 passed. - `agentctl job start --workspace <wt> polylogue verify_quick` (job 3440, at 4da20dd, before the test-only follow-up): succeeded. The pre-push hook's `devtools verify --quick` passed on f85601c. - The rebase onto master (the backup module moved to `operations/archive_backup.py` in #5824) renamed the verification key to `recovered_source_blob_count`. The new test now reads that key. ## Self-review The final pass against `docs/review/codex-review-guide.md`, over the whole diff against master: 1. Siblings and owners: ✓. The window is decided in one place, the proof dict. The windowed, legacy-replay and full-prefix branches all feed it through `proof_append_start` and `proof_append_end`. 2. The fix itself: ✓. The emitted offsets are strings, as before. With no proof window, the row's own offsets are emitted unchanged. 3. Memory and limits: ✓ N/A. There are no new reads. 4. Cost per unit: ✓ N/A. 5. Interruption: ✓ N/A. This only builds the manifest. 6. Ordering and races: ✓ N/A. 7. Failure classification: ✓. An unmatched payload still records its error and emits no proof. 8. Silent outcomes: ✓. Verification now accepts proofs that it previously rejected by mistake. Nothing is skipped. 9. Cleanup on failure: ✓ N/A. 10. Identity and keys: ✓. The proof names exactly the bytes that were hashed. 11. Lossless transforms: ✓. The other proof fields are unchanged. 12. Degenerate inputs: ✓. `end` comes from the row's own parsed `append_end_offset`, and a `ValueError` still records `append_segment:`. 13. Consumers: ✓. The verifier reads `append_start_offset` and `append_end_offset` and needs no change. 14. Tests and stubs: ✓. `test_full_evidence_backup_verifies_a_full_prefix_append_proof` drives `backup_archive(..., verify=True)`. It fails when the proof carries the row's start offset (3). 15. Trust boundaries: ✓ N/A. ## Residuals - `_legacy_append_replay` is a pre-envelope path, and it picks its predecessor by `acquired_at_ms` (wall clock). Both belong to the 9kemf backup rework. They are not changed 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]>
This was referenced Oct 1, 2026
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
Fixes the 14 confirmed Codex P1 findings on bead polylogue-9kemf (daemon and operations). 13 were implemented by the previous owner in lanes that are now integrated; this head adds the missing half of 07.F012 (a working, quiescent reset of the derived tiers), fixes three defects the self-review found in the earlier fixes, and merges master through c950478.
Problem
Each finding names a concrete input and wrong outcome at master 64a9bd0; the per-finding table below gives the fix and the regression test. Evidence for the one design choice beyond the findings: a probe that initializes an archive root, deletes one tier and re-initializes shows
index.dbandops.dbre-bootstrap, while a missingsource.dboruser.dbis refused ("archive format marker names a missing durable tier"). Soreset --database --include-source-db/--include-user-dbproduced an archive that no longer opens.Solution
07.F012: the daemon never unlinks a tier it holds open.
maintenance.resetnamingindex.db/ops.dbnow prepares, authorizes and begins the audited plan and returnsresult.state = "staged"with nothing deleted. The attempt belongs to the daemon process; after it exits, the next start resolves the plan at a new seam,apply_staged_archive_resets, which runs under exclusive archive ownership right after durable migrations and before the schema preflight or anything else opens a tier. There each identity-matched database is deleted with every sidecar beside it (a stale-walwould otherwise replay into the file bootstrap creates next), the plan's other targets go with it, bootstrap recreates the tiers, and the empty index cold-builds. Ordinary recovery and live APPLY keep refusing tier files (RecoveryDeferredError,reset_live_archive_tier). A reset now deletes onlyindex.dbandops.db:--include-source-db,--include-user-db, their request fields and the source-risk helper are removed, and a target that is or holds a durable tier,embeddings.dbor a directory of tiers is refused withreset_unresettable_archive_tierbefore any audit row. Operator guidance that saidops reset --index && polylogued runnow says to restart the daemon.Self-review fixes to earlier commits on this branch:
FtsDerivationAdapter.inspect_partition, which the status component (operations/daemon_status.py) and the archive search check also call in autocommit. The owner now reads one snapshot outside a caller's transaction.Lane reconciliation
Every lane commit has the same
git patch-id --stableas a commit already in this branch; no lane had uncommitted work.Per-finding table
DriveAccessDeniedErroronly when its body names no quota or rate reason;_permanent_failuretrusts only the typed errors (sources/drive/gateway.py,operations/attachment_convergence.py)attachment_refs.supplying_raw_idcarried through projection carry-forward; blob refs keyed on it and rechecked under the writerstorage/backup_blob_closure.py)inspect_partition, fallback readiness and search admissionfailed(embedding_keys_failed); CLI exits 1import-staging/, keyed on the caller's pathDerived-identity closure
These closure members change, so this PR must land before any rebuild starts:
archive/artifact_taxonomy/runtime.py,archive/query/transaction.py,core/errors.py,operations/specs.py,sources/drive/{gateway,source_client,types}.py,sources/live/watcher.py,storage/backup_blob_closure.py,storage/blob_integrity.py,storage/blob_publication.py,storage/derived/session/input_binding.py,storage/fts/derivation.py,storage/sqlite/archive_tiers/{archive_tiers_specs,bootstrap,embeddings,index,query_unit_frame,write}.py,storage/sqlite/migration_runner.py. The closure baseline grows by two members,storage/backup_blob_closure.pyandstorage/blob_integrity.py, both imported by the migration gate that now decides package completeness. The index DDL gainsattachment_refs.supplying_raw_idand thefile_edits/web_content_constructsframe triggers (index-only); no durable-tier or embeddings DDL changes.Verification
agentctl job start --workspace /realm/worktrees/astra-9kemf polylogue verify_quick: job 3373 succeeded on 7d5c109 (all static gates, including mypy, layering, schema-closure and generated-surfaces)agentctl job start --workspace /realm/worktrees/astra-9kemf polylogue pytest_focused -- <58 affected files>: job 3374 on 7d5c109:9 failed, 1904 passed, 1 xfailed; the 9 are the inherited failures below. The selection is in the job argv.pytest_focused -- --on-default-branch <ids>in a detached master worktree at c950478 (job 3368,9 failed, 1 passed): the fourtest_raw_observation_derivation.pyworker cases, threetest_schema_policy_contracts.pycases,test_durable_migrations.py::test_one_open_applies_every_numbered_step_to_the_declared_versionandtest_daemon_http_security.py::TestNoTokenLogging::test_no_token_in_log_or_print_callsfail identically on master.test_daemon_operation_route.py::test_cancelled_long_delete_retains_writer_until_blocked_apply_releasesfailed once on 2adba04 (job 3358) under four-worker load, passes alone on master (job 3368) and passed in job 3374.Self-review
Codex review is off for this PR, so this pass is the review. Checklist from
docs/review/codex-review-guide.mdand the orchestrate worker contract, final pass over the whole diff against master:inspect_partition, the one owner for all four callers. The reset CLI preview and the daemon's_reset_targetsboth resolve targets (pre-existing split); both now name only index and ops. Two sibling gaps are filed rather than fixed: ZIP-member blob restoration in raw derivation (polylogue-0y17g) and a single owner for which source window proves a retained blob, shared by backup proofs and raw restoration (polylogue-ihq32).runningrun until restart; overlapping resets are refused as concurrent work, other mutations are unaffected because the owner is live. The raw sweep fix introduced continuous resweeping; paced. The newnext_actiontext failed the runnable-command contract; now a command chain.replay-failedresolution; outside the seam a tier reset stays pending (RecoveryDeferredError).state: staged,deleted: 0; the CLI prints "Nothing has been deleted yet" and the restart step.(st_dev, st_ino)from PREPARE.supplying_raw_id.grepforinclude_source_db|include_user_db|unresolvable_raw_source_countis empty); CLI reference regenerated; staledaemon/backup.pypaths updated.Residuals
test_cancelled_long_delete_retains_writer_until_blocked_apply_releasesasserts a timeout within a fixed window and failed once under four-worker load and passed on the final head; see Verification.🤖 Generated with Claude Code
https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg