Repository navigation
fix(recovery): resolve interrupted mutations from durable state - #5688
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff7409b887
ℹ️ 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".
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: 3af5e74926
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82399d49dd
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb5b8eed1b
ℹ️ 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".
c646539 to
3be1b8e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3be1b8e228
ℹ️ 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".
3be1b8e to
c646a2b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c646a2b921
ℹ️ 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".
c646a2b to
ee8cb1f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee8cb1fbbc
ℹ️ 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".
ee8cb1f to
7f65ba2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f65ba25af
ℹ️ 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".
An operation whose owner died between its durable intent and its terminal record used to end as an operator-blocking "unknown" for every family except session delete, and operator adjudication was the only way out. Every executor-routed actuator now registers a recovery route: most re-apply the recorded plan convergently, without restamping rows already stored and only within the authorized plan; the annotation batch import reports whether its one transaction committed; insight pages and ingests are terminalized for their owners to reconverge. Daemon startup, and a later request overlapping a dead run, record a terminal resolution that never blocks the targets. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
7f65ba2 to
15d38e4
Compare
Both fail on origin/master 5312edb as well. The relayed 401 keeps its code as the rejection outcome while the message is the ingress detail (#5705), and startup recovery now re-applies a dead operation's plan convergently (#5688), so the no-replay check counts only the client's resend. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…5729) ## Summary Fixes six tests that fail on master and one intake bug. Five tests encoded contracts that earlier PRs changed on purpose, and are realigned. The intake bug: a SQLite database that could not be read at probe time was excluded for good. ## Problem A focused run on `7e5b96e15d` failed six tests: | Test | Broken by | Cause | | --- | --- | --- | | `test_live_full_ingest_offloads_sync_work_to_keep_loop_responsive` | #5557 | `_ingest_full_paths` now passes `prepared_json_paths`; the test stub rejected the keyword. | | `test_source_only_full_ingest_streams_admitted_zip_members_without_decoding` | #5557 | #5557 removed `_detect_provider_from_raw_bytes` from `live.batch`, and `monkeypatch.setattr` failed on the missing name. | | `test_every_planned_path_is_accounted_for`, `test_offered_bytes_split_puts_a_refused_file_in_the_refused_bucket` | #5557 | #5557 retains a JSON document of any shape and lets the parser record unsupported-shape evidence. The `notes.json` fixture meant to be refused therefore succeeds. | | `test_authentication_refusal_is_not_an_indeterminate_mutation` | #5705 | The exception text is now the daemon's detail (`machine authentication required`), not the code. | | `test_restart_recovers_indeterminate_mutation_without_replaying_it` | #5688 | Startup recovery now resolves an `unknown` run by convergent replay, so the restarted daemon applies once more. | Intake bug: the Codex, Hermes and Antigravity recognizers catch `sqlite3.Error`/`OSError` and answer "not ours". `classify_pre_acquisition` turns that answer into an exclusion, and `_mark_excluded_cursor` records `excluded=True`. A database that is locked or unreadable during the probe (EACCES, SQLITE_BUSY/CANTOPEN) was never retried while its observation stayed unchanged. #5724 had guarded only the cold-build baseline against this. ## Solution - Tests: accept `prepared_json_paths` in the stub. Point the ZIP no-decode guard at `detect_provider_from_path_sample_evidence`. Refuse a JSONL record stream that no origin claims instead of a JSON document. Assert `rejected.value.outcome == "unauthorized"`. In the restart test, count the one startup replay and check that the retried request id does not dispatch again. - Intake: `classify_pre_acquisition` probes a SQLite path before excluding it and raises a retryable read fault. The batch records that fault as an ordinary retryable failure. Bytes that are not a database stay excluded. The baseline's own probe and `_retryable_read_fault` move into `batch_support`, so intake and the baseline apply the same rule. The baseline branch those helpers made dead is removed. `batch.py`, `batch_support.py` and `production_baseline.py` are in the derived schema-identity closure (`devtools schema closure`), so this must land before a rebuild starts. ## Verification - `devtools test tests/unit/sources/test_live_watcher.py tests/unit/sources/test_raw_admission_settlement.py tests/unit/sources/test_live_batch_support.py tests/unit/sources/test_production_baseline.py tests/unit/sources/test_cold_build_generation.py tests/unit/daemon/test_daemon_operation_route.py`: `418 passed`, 1 flaky. The flaky test was `test_cancelled_long_delete_retains_writer_until_blocked_apply_releases`: a 25 ms deadline returned `completed` under load, and the test passed when rerun alone. - After the final baseline cleanup: `devtools test tests/unit/sources/test_production_baseline.py tests/unit/sources/test_cold_build_generation.py`: `64 passed`. - `devtools verify --quick`: `PASSED` (includes mypy, patterns, schema-closure). - The new `test_unreadable_state_database_stays_retryable_instead_of_excluded` drives a mode-0 `state_5.sqlite` through `_ingest_full_paths_sync`. Without the probe, the file is not failed and gets an excluded cursor. ## Residuals - If a lock clears between the recognizer's failed read and the probe, the file is still excluded. That window was already accepted for the baseline in #5724. Closing it needs the recognizers to propagate read faults. - The unbounded JSONL session scan is filed separately and is 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]>
## Summary `raw_existence_changes` is now declared once in `SESSION_CARRIERS`, as EXCISED. A table declared twice is now an import-time error, so one declaration can no longer silently replace another. ## Problem `test_raw_existence_journal_is_declared_as_content_free_bookkeeping` fails on master: `TOMBSTONE is RETIRED`. Two PRs each declared the table: - #5688 (aa7a3e0) declared it TOMBSTONE: content-free evidence, deliberately kept after excision. - #5727 (ee567d0) added a second declaration, EXCISED. In the same PR it made `apply_session_excision` delete the journal rows by name (`excision.py:1252`). `test_excision` asserts that no rows survive. `_carriers` built a dict, so the later TOMBSTONE entry silently replaced the EXCISED one. The actual behavior is EXCISED. The #5727 test asserted RETIRED, but that reach applies only to tables that fresh tiers omit, and this table is present in a fresh source tier. ## Solution - Remove the TOMBSTONE declaration. - `_carriers` raises `ValueError` on a duplicate table. - The test (renamed `test_raw_existence_journal_is_declared_as_excised`) asserts EXCISED. ## Verification - `devtools test` over `tests/unit/security/test_excision_carrier_reach.py`, `tests/unit/security/test_excision.py` and the other master-health files: `PASSED exit=0` 🤖 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
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
unknownoutcome it existed to clear.Problem
inspect_recovery. Every actuator except session delete inherited_FailClosedRecovery, which always answeredunknown/operator-blocking. Family or version drift did the same.recovery_unknownbarrier: every later mutation overlapping its targets was refused. With refactor(maintenance): delete archive repair and bootstrap commands #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_appliedalso installed a duplicate-effect barrier that refused later identical requests.Solution
ConvergentReplay(inoperations/mutation_transaction.py) replaces_FailClosedRecovery. An actuator'sapplymust reach the plan's effect from any state an interrupted apply of the same plan can leave.replay_argsrebuilds its arguments from the recorded plan context plus writable handles.applyreads. This PR adds author to tag add, actor andnow_msto lifecycle request, session id and actor to excision, andsample_sizeto the blob-ref actuators.recoverreportscompleteorabsentfrom the batch row.operations/mutation_replay.pyholds the registry of recovery routes, keyed by operation name, andrecover_interrupted_operations, which moves here frommutation_transaction.recovered_complete,recovered_absent,recovery_not_replayable(family or version retired) orrecovery_replay_failed, recorded byAuditRepository.record_recovery_resolution(a new audit-continuity command).recoverroute.mutation_transactioncannot 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.RecoveryDispositionandRecoveryTargetDisposition, everyinspect_recovery,has_recovered_effectand therecovered_appliedbarrier,find_interrupted_operation, andrecovery_operation.docs/maintenance.mdand the durable-write census are updated.Verification
tests/unit/operations/test_mutation_crash_recovery.pycovers 31 actuator families. For each, a kill before apply and a kill after apply each go through restart, and every run must endrecovered_completewith the effect present and no nonterminal run left. The same file checks that every executor-routed spec has a registered route.test_insight_acceptance.py) and the annotation batch import (test_importer.py,completeversusabsent).devtools testover the 11 affected operations, annotations and daemon test files:288 passed, 1 failed. The failure istest_importer.py::test_import_uses_concrete_delegation_schema_and_exact_retry_is_idempotent, which fails the same way on the base (FacadeDaemonRequiredErrorin its judge step).devtools gate mypy:Success.devtools gate schema-closure:ok, 566 → 562 entries. The closure shrinks becausemutation_actuators,excisionandlifecycleleave it.Residuals
recovery_not_replayable: failed and terminal, never re-applied.unknownfinalizations 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.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4