Skip to content

feat(agent): publish and recover verified history checkpoints - #6498

Merged
M4n5ter merged 1 commit into
apache:rust-previewfrom
MicroGery:codex/rust-history-checkpoints
Oct 31, 2026
Merged

M4n5ter merged 1 commit into
apache:rust-previewfrom
MicroGery:codex/rust-history-checkpoints

Conversation

@MicroGery

Copy link
Copy Markdown
Contributor

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.

  • Keep checkpoint revisions separate from live Session revisions. Expose read_head, exact retained-revision checkout and original publication receipts.
  • Bind requests to their scope and original inputs. Recovery resumes prepared bytes without recapturing newer history; incomplete captures become interrupted, and unverifiable prepared material becomes unavailable.
  • Retain physical work custody through observer cancellation and Root shutdown. Recover owned staging before service readiness, and keep cleanup failures separate from acknowledged publication. Rejected prepare transactions do not leave an abandoned capture running; nonregular objects are rejected without blocking their reader.
  • Add a trusted internal native publisher that checks Session namespace ownership and the original 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-SESSION v2), 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.
  • Checkpoint coverage includes six actual child-process kill boundaries, Head/receipt atomicity, concurrent CAS and identical requests, scope/fingerprint conflicts, frozen replay after live changes, corruption, observer cancellation, cleanup failures and source retirement.
  • The new rejected-prepare and nonregular-object regressions both failed against the pre-fix implementation and passed after the fixes.
  • cargo clippy -p maka-event-log -p maka-agent-native --all-targets --locked -- -D warnings: passed.
  • Rust formatting, staged Biome check using the pinned 2.6.3 binary, ASF source-header checks and git diff --cached --check passed.

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_activation reads retired history and fails with MaterialCollected at approval_park.rs:688. The same failure was reproduced on unchanged base 0dd0032c6, and its isolated rerun still fails after updating to 80bf23281. 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

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

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

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally — the existing native-suite failure is documented above; full workspace checks were not run.

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

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 Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@M4n5ter
M4n5ter merged commit 6faf656 into apache:rust-preview Oct 31, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants