Repository navigation
feat(agent): publish and recover verified history checkpoints - #6498
Conversation
Persist native history manifests, independent checkpoint heads and publication receipts. Capture and validate immutable objects before head CAS, preserve original prepared inputs across retries, and recover owned staging at startup. Expose a trusted internal native publisher without adding wire or UI entrypoints. Cover crash boundaries, identity/CAS conflicts, cancellation custody and cleanup. Settle rejected preparation without a restart and reject nonregular objects without blocking a physical worker. Generated-by: Codex
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
I reviewed all 15 changed files at ba40b75afc2cd1ad22fdefdca47d088f6fb77f13, including migration 0012, the checkpoint journal/object store, startup recovery, trusted native publisher and the added test sources. I found no confirmed P0–P2 defect within that scope.
The existing native Bundle export provides history material but does not create this independent checkpoint Head and publication receipt. The implementation keeps that distinction: immutable verified history is prepared before the Head/receipt transaction; requests retain their original scope and inputs; checkpoint revisions are independent of live Session revisions. Source inspection covered duplicate requests, prepared replay without recapture, compare-and-swap conflicts, interrupted captures, corruption, cleanup failures and work ownership after observer cancellation. checkout_exact deliberately serves only the currently retained Head; a superseded successful receipt does not authorize an older checkout.
I independently ran 15 SQL checks using the unchanged migration files and SQL extracted from the journal on SQLite 3.45.1. Both a fresh schema and an upgrade containing existing Session/event rows succeeded; old rows remained intact. The checks also exercised foreign keys, JSON constraints, the recovery selection query, rollback of a Head write when the receipt update aborts, joint commit, and checkpoint retention after source-session removal. The six existing migrations are byte-identical to the parent. These are SQL-level checks, not execution of Rust, SQLx migration bookkeeping, concurrent publication, filesystem durability or crash recovery. git diff --check passed.
The added Rust test sources cover six child-process kill boundaries and other failure cases, but I did not run them locally: this machine has no Rust toolchain. The author's macOS test/Clippy results and reported existing MaterialCollected native-test failure remain author-supplied evidence, not my independent reproduction. I did not perform real Host, Linux/Windows, UI, restore/activation or performance acceptance. This internal, history-only API adds no public wire endpoint or protocol change; unsupported platforms reject publication, immutable storage remains unbounded, and Host integration is explicitly deferred.
The actual merge into rust-preview@89704385a6fa3b8d7d225c7de756d99d4c4465a2 succeeds without conflicts. PR CI 41189019348 failed during lint at platform/computer-use/src/browser.rs:789 (clippy::collapsible_if, warnings denied). The current target's CI 41189203562 fails at the same location, and that file is byte-identical between this PR and the target. This is an inherited check failure, not an established checkpoint regression; the full check is still red and the later integration job was skipped. This comment does not establish runtime or merge acceptance.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Summary
Native Session Bundle export produces verified history, but does not register a durable checkpoint revision or preserve the original publication result across retries and process death. This PR adds the internal history-only publication pipeline: capture a consistent native Bundle, validate and persist its payload and manifest, then create or CAS the checkpoint Head together with its publication receipt in the Session partition.
read_head, exact retained-revision checkout and original publication receipts.RecoveryRef.Refs #2370 and #5605. This is the first of two Rust history-checkpoint PRs and does not close #2370.
Scope
The manifest explicitly describes native history (
MAKA-SESSIONv2), not the legacy TS compatibility bundle or a complete Agent snapshot. This PR includes no Workspace files, Memory/Goal snapshot, restore/activation, public wire endpoint, UI, automatic trigger or Cloud backend. The next PR will add authorized Host management methods, real Host end-to-end acceptance and performance measurements; these are outside this internal repository/publisher change.Publication currently requires Unix file/directory durability and rejects unsupported platforms before claiming an operation. Immutable objects are conservatively retained; only owned temporary files are cleaned, so storage is not automatically bounded. Migration 0012 adds checkpoint bindings, heads and publication receipts without changing ordinary Session writes.
Verification
On macOS arm64 with Rust 1.99.1, based on
rust-preview@80bf23281:cargo test -p maka-event-log -p maka-agent-native --lib checkpoints::tests --locked: 16 passed (15 storage tests, including the child-process helper, and 1 native publisher test).cargo test -p maka-event-log --locked: 216 unit tests, 139 integration tests and the Root lease test passed.cargo clippy -p maka-event-log -p maka-agent-native --all-targets --locked -- -D warnings: passed.git diff --cached --checkpassed.Known existing failure: the earlier complete native suite reported 220 passed / 1 failed / 1 ignored.
owner::tests::service_tools::approval_park::exclusive_session_retirement_settles_parked_work_without_a_new_activationreads retired history and fails withMaterialCollectedatapproval_park.rs:688. The same failure was reproduced on unchanged base0dd0032c6, and its isolated rerun still fails after updating to80bf23281. This PR does not modify or skip that test. The complete native suite was not repeated after the update; the publisher test and this known failure were rerun.Full workspace
just check, Linux/Windows execution and performance measurements were not run locally.AI use
Tool(s) and scope: OpenAI Codex authored the implementation, tests and documentation, performed adversarial self-review and ran local verification. The commit includes
Generated-by: Codex. This is not an independent human review.Checklist
Does this PR entail a change in behavior?