Skip to content

feat(agent): expose recoverable history checkpoints - #6581

Merged
M4n5ter merged 3 commits into
apache:rust-previewfrom
MicroGery:codex/rust-checkpoint-host-api
Nov 3, 2026
Merged

M4n5ter merged 3 commits into
apache:rust-previewfrom
MicroGery:codex/rust-checkpoint-host-api

Conversation

@MicroGery

Copy link
Copy Markdown
Contributor

Summary

The native checkpoint publisher added in #6498 was internal to the Agent. This PR connects it to the admitted public Agent service so trusted clients can explicitly publish a verified history checkpoint, recover the original publication result, and download the exact retained bundle.

Refs #2370. Follow-up to #6498; this does not close the broader checkpoint work.

  • Add previewHistoryCheckpoint, publishHistoryCheckpoint, historyCheckpointReceipt, historyCheckpointHead, and readHistoryCheckpoint, with generated SDK contracts and English/Chinese documentation.
  • Derive scope from the admitted Agent assembly, retain Host authorization and resource custody, and reject model-origin and foreign-scope requests. Busy sources fail instead of queuing; CAS conflicts are terminal for the original operation.
  • Query using the original RecoveryRef and input without redispatch or recapture. A committed domain publication can coexist with an unresolved Host outcome and unconfirmed cleanup; the query reports both facts rather than fabricating Host completion.
  • Stream the exact retained revision with backpressure, at most 32 KiB per decoded chunk, and a final byte count/SHA-256. Moved heads fail instead of falling back to latest; clients must validate the complete stream and successful completion.
  • Cover the real Host and public product endpoint, including domain commit followed by Host settlement failure, later live-state changes, and reopening the same Root.

A separate commit fixes eight existing Clippy warnings in composition/settings code without changing behavior. The native test fixture also supplies the upstream-added Input.base field.

Scope and operating cost

This is native history-only, including the native bundle's historical closure and referenced artifacts. The payload is MAKA-SESSION v2, not the TypeScript checkpoint format. Workspace snapshots, complete Memory/Goal state, restore/activation, UI and automatic triggers are outside this PR. Publication uses the existing Unix implementation; local verification was on macOS.

Immutable objects are conservatively retained, with no automatic retention/GC. The performance baseline records nine runs, streaming RSS, disk/WAL growth and same-partition message admission. Development-build median publication times were 391 ms for a small history, 4.59 s with a 32 MiB artifact, and 1.30 s for 64 turns. Concurrent message admission slowed in these samples; these are measurements, not a production SLA.

Verification

Passed locally:

  • cargo test -p maka-agent-api --locked: 7 tests.
  • cargo test -p maka-agent-native --locked checkpoint -- --nocapture: 8 tests; the ignored manual benchmark was run separately nine times.
  • Public-product checkpoint endpoint acceptance: 1 test, including native decoding of the downloaded bytes.
  • Lint-fix regressions: plugin-core 38 tests, Host composition 1 test, public-product workspace configuration 1 test.
  • Dependency-inclusive cargo clippy -p maka-agent-api -p maka-agent-native --all-targets --locked -- -D warnings.
  • SDK generation check and typecheck, generated-file Biome, changed-crate Rust formatting, ASF source-header audit, commit hooks, and git diff --check.

Product tests used the existing nsh-platform-gpui/runtime-shaders feature because this machine lacks the Apple MetalToolchain. cargo test was used because cargo-nextest is not installed. Full repository checks, the complete native test suite, and Linux/Windows runs were not performed locally; CI remains to be evaluated.

AI use

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

Tool(s) and scope: Codex contributed implementation, tests, documentation, validation and this PR description. Both commits carry Generated-by: Codex; preserve the trailer when squashing. The submitting human contributor remains responsible for the contribution.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

The focused checks above pass; the full repository and complete native suite were not run locally.

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Use let chains for nested composition conditions and borrow single-element paths instead of cloning them.

Generated-by: Codex
Expose admitted preview, publish, receipt, head, and bounded exact-read methods through the Agent service. Preserve original Host recovery observations alongside durable publication receipts, and verify the real Host and product endpoint behavior with recovery, integrity, and authorization tests.

Regenerate the SDK contracts, document the history-only scope, and record a manual performance baseline.

Generated-by: Codex

@M4n5ter M4n5ter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

English

Reviewed 4d7b37c. The scope and implementation look good to me. The public methods reuse the existing history checkpoint publisher, Host admission/recovery, and resource custody without introducing another persistence path or compatibility layer.

The distinction between a committed checkpoint and an unresolved Host outcome is correct. Original-operation lookup, exact-revision streaming, cancellation, and backpressure are handled coherently, with meaningful real-Host and public-endpoint tests.

The history-only scope is clear; restore/activation, workspace snapshots, automatic retention/GC, and broader platform support remain follow-up work. This approval is based on code and test inspection; I have not rerun the Rust suite locally.

Approved. Ready to merge once the remaining CI checks pass.

简体中文

看过 4d7b37c 了,范围和实现都比较清楚。这次直接复用了现有的历史 checkpoint 发布、Host 准入与恢复、资源清理机制,没有另起一套持久化路径或兼容层。

checkpoint 已经提交、Host 结果仍未确认,这两个事实分开表达是对的。查原操作回执、精确版本下载、取消和背压的处理也比较完整,测试走了真实 Host 和公开端点,保护的是实际行为。

当前定位是历史存档管理;恢复激活、Workspace 快照、自动保留与清理,以及更广的平台支持继续留给后续工作。这次我审查了代码和测试,没有在本地重新运行 Rust 测试套件。

我这边 approve,剩余 CI 没问题就可以合入。

@M4n5ter
M4n5ter merged commit fa1b927 into apache:rust-preview Nov 3, 2026
8 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.

2 participants