Repository navigation
refactor(maintenance): delete archive repair and bootstrap commands - #5646
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3375619686
ℹ️ 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".
Opening an archive root already creates it, no durable migration is declared, and no current writer produces the states the blob disposition, embedding preservation, audit adoption, or recovery adjudication routes handled. Delete archive-init, archive-plan, migrate-tier, blob-disposition, blob-residue-compare, embedding-preservation and operation-recovery, with the MCP recovery_status/recovery_adjudicate operations and the audit adjudication method. Point missing-tier hints at polylogued run and refuse a lost audit.db by name. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
…ng reuse A pending audit continuity command of a kind this runtime does not declare now raises a typed AuditContinuityUnknownMutationError and stays pending, instead of an untyped RuntimeError. Archive debt classifies a durable tier lost from an established root as blocked with a restore-from-backup remedy; only a fresh root or a missing derived tier points at polylogued run. The maintenance tool's declared minimal call now carries confirm=true. Embedding preservation and reuse verification stay: reusing the preserved vectors after the fresh build is lifecycle work (polylogue-6j5a9 moves it onto a daemon operation). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
The preserved vectors are needed once, after the fresh build, through a private one-off script; the repository keeps no reuse route. Correct the AGENTS.md tier row, and fix a test's Optional type. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
3375619 to
408a886
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 408a886819
ℹ️ 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".
Share one lost_durable_tiers predicate between archive debt and the archive_storage readiness component. A pending bootstrap intent, a fresh root, and an audit tier with an adoption receipt stay actionable through polylogued run; a durable tier lost beside a surviving one points at a verified-backup restore. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
## Summary `polylogued run` now applies pending declared durable migrations when it opens the archive, before it serves anything. A step that changes existing data runs only behind a backup the daemon takes itself and scratch-verifies. ## Problem - Durable tiers (`source`, `user`, `audit`) evolve by numbered migrations with change-train sidecars. #5646 deleted `ops maintenance migrate-tier`, their only application route, so `execute_durable_change_train` had no production caller. - No durable migration is declared today. The first one would therefore have shipped with no way to apply it except a maintenance command, which the operator has ruled out. ## Solution - `operations/durable_change_train.py` gains `pending_durable_migrations`. It lists each durable tier standing below the runtime's declared version that has a complete declared route (every step from the current version to the target) and says whether any step requires a backup. A tier with no declared route is left alone, and schema preflight still reports its skew. - `daemon/durable_migrations.py` adds `apply_declared_durable_migrations`. For each pending tier it runs `execute_durable_change_train` under the daemon's write lease, with the daemon's exclusive archive ownership. The daemon keeps that ownership afterwards, so the train's release is a no-op. - For a step that requires a backup, `pre_migration_backup` first runs `backup_archive(verify=True)` into `.maintenance-state/pre-migration-backups/`: - It uses the `user_overlays` profile for user and audit, and `rebuildable_cache_exclude` for source, which carries its blobs. - The train binds the backup's authenticated receipt to the exact pre-apply bytes. - A failed backup refuses startup. - `backup_archive` accepts `archive_owner`: the caller's existing exclusive ownership. The backup copies under that ownership instead of acquiring its own, which the daemon's own lock would refuse at open. - `daemon/cli.py` calls the route right after durable-change-train reconciliation, inside the same ownership scope, and emits `daemon.durable_migration.applied` for each applied tier. - The durable-schema section of `docs/maintenance.md` describes the route. ## Verification - `tests/unit/daemon/test_durable_migrations.py` ships synthetic numbered migration packages: - An archive already at the runtime version is left alone and gets no backup directory. - An additive `source` step applies without a backup, and a second open is a no-op. - A data-changing `user` step applies only after a verified backup; the manifest and verification receipt are present. - `devtools test` over `test_durable_migrations.py`, `test_daemon_cli.py` and `test_backup.py`: `185 passed, 3 failed`. - `test_run_daemon_services_parks_operation_recovery_on_audit_schema_mismatch` failed because the first version tried to migrate a tier with no declared route. That is fixed, and it passes on rerun with the migration tests. - `test_run_daemon_services_waits_for_fts_startup_before_watcher` (2 parametrizations) fails the same way on current master: its fake converger lacks the `derivation_barrier` argument #5664 added. - `devtools gate mypy`: `Success`. - `devtools gate schema-closure`: `ok`, no change (567). ## Residuals - The source-tier backup copies referenced blobs, so a data-changing source migration pays that copy at open. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4 --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
## Summary An interrupted mutation now always ends in a definite, terminal state that no later request is refused by. Every executor-routed mutation family declares a recovery route, and daemon startup resolves each dead operation with it. The operator-adjudication route is gone (#5646), and this PR removes the `unknown` outcome it existed to clear. ## Problem - An operation whose owner died between its durable intent and its terminal record was classified by `inspect_recovery`. Every actuator except session delete inherited `_FailClosedRecovery`, which always answered `unknown`/`operator-blocking`. Family or version drift did the same. - The run then became a `recovery_unknown` barrier: every later mutation overlapping its targets was refused. With #5646 there is no adjudication route left, so a daemon crash in the middle of a tag write could wedge that session's user-state writes permanently. - `recovered_applied` also installed a duplicate-effect barrier that refused later identical requests. ## Solution - `ConvergentReplay` (in `operations/mutation_transaction.py`) replaces `_FailClosedRecovery`. An actuator's `apply` must reach the plan's effect from any state an interrupted apply of the same plan can leave. `replay_args` rebuilds its arguments from the recorded plan context plus writable handles. - Every plan context now carries every input `apply` reads. This PR adds author to tag add, actor and `now_ms` to lifecycle request, session id and actor to excision, and `sample_size` to the blob-ref actuators. - Four actuators needed changes to become convergent: - Session delete and identity reset skip ids that are already gone. - Excision reports a session it no longer finds as already satisfied. - Blocker resolve treats an already-resolved blocker as satisfied. - Two families are not re-applied: - The annotation batch import cannot be re-applied, because its rows are not in the plan. It commits in one transaction, so `recover` reports `complete` or `absent` from the batch row. - An interrupted ingest is left to the next intake pass, which re-admits it idempotently. - The sealed insight page re-derives its frozen targets. - `operations/mutation_replay.py` holds the registry of recovery routes, keyed by operation name, and `recover_interrupted_operations`, which moves here from `mutation_transaction`. - Each orphan resolves to one of `recovered_complete`, `recovered_absent`, `recovery_not_replayable` (family or version retired) or `recovery_replay_failed`, recorded by `AuditRepository.record_recovery_resolution` (a new audit-continuity command). - None of these outcomes is a barrier. - Binding validation now requires a `recover` route. - The executor's overlap check waits on live owners and resolves dead ones through the same route before it proceeds. `mutation_transaction` cannot import the registry, because the registry would pull every actuator into the derived schema-identity closure. The registry therefore installs itself as a resolver on import. - Deleted, with no remaining callers: `RecoveryDisposition` and `RecoveryTargetDisposition`, every `inspect_recovery`, `has_recovered_effect` and the `recovered_applied` barrier, `find_interrupted_operation`, and `recovery_operation`. - `docs/maintenance.md` and the durable-write census are updated. ## Verification - `tests/unit/operations/test_mutation_crash_recovery.py` covers 31 actuator families. For each, a kill before apply and a kill after apply each go through restart, and every run must end `recovered_complete` with the effect present and no nonterminal run left. The same file checks that every executor-routed spec has a registered route. - Crash tests beside their owners cover the sealed insight page (`test_insight_acceptance.py`) and the annotation batch import (`test_importer.py`, `complete` versus `absent`). - `devtools test` over the 11 affected operations, annotations and daemon test files: `288 passed, 1 failed`. The failure is `test_importer.py::test_import_uses_concrete_delegation_schema_and_exact_retry_is_idempotent`, which fails the same way on the base (`FacadeDaemonRequiredError` in its judge step). - The daemon startup tests that patch the moved recovery route pass. - `devtools gate mypy`: `Success`. - `devtools gate schema-closure`: `ok`, 566 → 562 entries. The closure shrinks because `mutation_actuators`, `excision` and `lifecycle` leave it. ## Residuals - A family or version this runtime no longer declares ends `recovery_not_replayable`: failed and terminal, never re-applied. - In-process `unknown` finalizations from ingest and insight cancellation remain. They are resolved at the next startup or by an overlapping request, as above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4 Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Summary
Deletes seven
ops maintenancecommands that initialize an archive, migrate a durable tier, or repair or salvage archive state. No current code path produces the state any of them handled, or the state has a named invariant task. The MCP recovery operations go with the CLI route. The fresh v1 archive is created when the daemon first opens its root, so none of these commands has work to do there.archive-init,archive-plan_initialize_active_archive_rootcreates every tier under one pending intent and publishes the format marker.archive-init --replace-existingcould not replace a durable tier (its own planner blocked that), so it only recreated derived tiers, which bootstrap also creates.archive-planonly plannedarchive-init.migrate-tierstorage/sqlite/migrations/{source,user,audit}contain only__init__.py. Its audit-adoption, restore, rebind and--initialize-missingroutes existed for archives that predate the audit tier. Bootstrap now createsaudit.dbwith the other durable tiers, and a lost durable tier is refused by name.blob-disposition,blob-residue-compareembedding-preservationembeddings.db: reset keeps it, and vectors are keyed by content and reused after an index rebuild. Reusing the old root's vectors once after the fresh build is a private one-off, not a product route.operation-recovery(+ MCPrecovery_status/recovery_adjudicate)Problem
migrate-tier,archive-initandoperation-recoverywere offline writers. They refused to run beside a live daemon, so an operator had to stop the daemon to use them.ops status, capability readiness and archive debt told operators to runarchive-init --yesfor a missing tier. Durable schema skew and a lostaudit.dbpointed atmigrate-tier.Solution
archive_init.py, the planner half ofarchive_plan.py,blob_disposition*.py,blob_residue_comparison.py,embedding_preservation.py), declarations, output schema and tests.rebind_audit_adoption_archive_identity. The rest of the adoption engine is still wired into bootstrap, so retiring it is a separate task.AuditRepository.adjudicate_recovery, its continuity replay kind, andlist_recovery_operations/list_targetsare gone. The MCPmaintenancetool now declares onlyrebuild_insights.polylogued run.audit.dbis refused as a lost durable tier and is never recreated.lost_durable_tierspredicate (fresh root, pending bootstrap intent and an audit tier with an adoption receipt are not lost) drives both archive debt and thearchive_storagereadiness hint: a lost durable tier isblockedwith a verified-backup restore remedy, and everything else keepspolylogued run.AuditContinuityUnknownMutationErrorand stays pending.maintenancedeclaration's minimal call carriesconfirm=true.Verification
devtools testover 29 affected CLI, MCP, agent-integration, daemon-status, readiness, operations and storage files: 823 selected,768 passed, 55 failed. The same 33 test functions (55 parametrized cases) fail identically on the base2da021c54(55 failed): staletest_offline_writersrows for backup and scan-secrets, which now route through the daemon; MCP write-tool routing;test_read_path_no_writer_lease;test_connection_profileskew cases; and durable-train fixtures that assume a numbered source slot. None come from this change.devtools verify --quick:verify: PASSED.devtools gate mypy:Success: no issues found in 3113 source files.devtools render all --check: exit 0, noout of sync.devtools gate layering: 0 violations; the baseline drops from 198 to 193 entries.devtools schema closure: IN foroperations/audit.py,operations/durable_change_train.py,operations/mutation_transaction.py,readiness/capability.py,storage/sqlite/archive_tiers/{archive_plan,bootstrap}.py,storage/sqlite/connection_profile.pyandstorage/sqlite/durable_change_train.py.Residuals
unknownafter an interrupted apply. Adjudication was the only way out, so until that task lands, a daemon crash mid-mutation keeps refusing later mutations that overlap the interrupted operation's targets.tests/unit/daemon/test_daemon_status.py::test_caller_payload_refresh_uses_invocation_framefails identically on the base; the rest of the review-fix selection passed (173 passed).🤖 Generated with Claude Code
https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4