Skip to content

feat(blaze): add build-time data-plane providers - #3074

Closed
WeissonHan wants to merge 11 commits into
agentic-os-org:mainfrom
WeissonHan:feature/blaze/data-plane-provider-framework
Closed

WeissonHan wants to merge 11 commits into
agentic-os-org:mainfrom
WeissonHan:feature/blaze/data-plane-provider-framework

Conversation

@WeissonHan

@WeissonHan WeissonHan commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Blaze needs an implementation-neutral way for downstream developers to
assemble a different data plane without copying daemon lifecycle logic or
changing the standard file-backed binary. Ownership, recovery, checkpoints,
hibernation, and capacity must follow a coherent contract so interrupted
operations do not leave conflicting resource ownership records.

What changed

  • Added the public blaze-provider-api source contract and the
    blaze-provider-conformance validation library with a runnable minimal example.
  • Added BlazeDaemonBuilder for selecting exactly one provider when a daemon
    binary is built; standard blazed still selects the built-in file provider.
  • Routed provider-backed create, delete, checkpoint, restore, hibernate,
    resume, capacity, and drain operations through capability-gated contracts.
  • Added durable request and ownership records, bounded inventory, startup
    reconciliation, and write-ahead recovery for interrupted or ambiguous
    provider transitions.
  • Added typed opened-resource handoff to compatible backends while retaining
    the existing path-backed file-provider behavior.
  • Added contract and regression coverage for startup rejection, opened-resource
    ownership, guest lifecycle evidence, checkpoint and suspension receipts,
    capacity validation, and exact HTTP error responses.
  • Retained unsafe preparation outcomes across restart and repeated deletion.
    An absent lookup under a requested identity cannot erase recovery records
    after the provider has returned an unrelated or invalid lease binding.
    Matching bindings with invalid resource content still use normal compensation.
  • Added symmetric startup checks when switching between the standard binary
    and an assembled provider. Active or uncertain foreign state rejects startup
    before listeners open; proven-clean records are neither imported nor deleted.
  • Updated only the English and Chinese user guides among Markdown documents,
    including runnable examples, extension limitations, recovery guidance, and
    website-compatible source links. Rust API documentation remains included.

Related issue

Closes #3073.

Contributor architecture guidance is tracked separately in #3093. Existing
design documents, component READMEs, and contributor instructions are unchanged
relative to the base branch.

User / Agent impact

Downstream developers can implement a source-level data-plane provider, run
the shared conformance checks, and assemble it with Blaze at build time. The
standard blazed binary keeps its existing file-backed provider and does not
gain runtime provider selection or new configuration.

Risk and compatibility

  • Public CLI, API, configuration, or documented behavior changed
  • Privileged or security-sensitive behavior changed
  • Cross-component contract changed
  • Migration or rollback guidance is needed

The public Rust API is additive. Provider selection is fixed in the assembled
binary, startup fails if the selected provider cannot satisfy its contract,
and provider-backed lifecycle state uses an identity-specific namespace.
Both standard and provider-specific startup inspect foreign namespaces before
serving. The standard daemon still recovers its own outer-root records normally.
Responses, opened resources, inventory pages, and durable identities are
validated before use. The standard file-provider path remains the default and
does not accept provider selection from configuration or tenant requests.

This does not add runtime plugin discovery or reusable sandbox pooling. The
example file provider demonstrates the base contract; it is not a production
storage provider and does not implement the optional lifecycle extensions.

Validation

Validated the six rewritten commits on Linux x86_64 with Rust/Cargo 1.88.0,
using separately exported source trees and initially empty target directories:

Commit Workspace tests
3450fdbc78aa53c7c7e0c97bf5389d5f6c63e450 613 default tests passed; 1 hardware test ignored.
18791586505be23bffbbc115ad45b88a8275a2bb 615 default tests passed; 1 hardware test ignored.
c4186dee41c5e96b1816128ad4f01fad91ad9f9b 616 default tests passed; 1 hardware test ignored.
c535b86fd9d6f43f7e2a6c82731e87e04e19fd1f 616 default tests passed; 1 hardware test ignored.
fb95af634923fc73824172b5139cdfd1db3d65ca 616 default tests passed; 1 hardware test ignored.
8acb6a191d23a30bc859f0deccdeb3a90a269f97 638 default tests and 719 fault-injection tests passed; each suite ignored the same hardware test.

Each commit also passed the default build, format check, strict all-target
Clippy, both guide example commands, and strict workspace Rustdoc. The head
additionally passed fault-injection Clippy and the documentation-test command.
The preceding five commits are unchanged.

Commands were run from src/blaze with the lockfile unchanged:

cargo fmt --all -- --check
cargo build --workspace --locked --offline
cargo clippy --workspace --all-targets --locked --offline -- -D warnings
cargo clippy --workspace --all-targets --locked --offline --features blazed/test-failpoints -- -D warnings
cargo test --workspace --locked --offline --no-run --message-format=json
cargo test --workspace --locked --offline --features blazed/test-failpoints --no-run --message-format=json
cargo run --locked --offline -p blaze-provider-conformance --example minimal_provider
cargo run --locked --offline -p blazed --example custom_provider_daemon -- --help
cargo test --workspace --doc --locked --offline
RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps --locked --offline

Cargo compiled test executables as an ordinary user. All emitted workspace test
executables were then run with --test-threads=1, administrator privileges for
filesystem ownership checks, isolated temporary roots, and cleared
BLAZE_TEST_FAILPOINTS and BLAZE_TEST_FAILPOINT_FILE. Compilation could run
concurrently, but a host-side lock serialized test execution across revisions.
The default and fault-injection suites overlap and their counts must not be
added. There are currently no executable documentation tests.

The unsafe-preparation regression was checked against the previous production
code with the same test fixture: all three retention tests fail, while the
valid-binding compensation control passes. All four pass with the correction.

The standard-startup regression was also checked against the previous production
code with the same fixture: seven rejection tests fail and two normal-startup
controls pass. All nine pass with the correction. Two additional tests cover
namespace replacement or addition and records added during inspection. The
production daemon tests verify rejection before touching an existing Unix
listener, with a valid-config control that reaches listener setup.

Separately ran the opt-in
spawner::firecracker::tests::opened_resource_restore_reaches_guest on the
same head with KVM, Firecracker v1.16.0, and ordinary-file copies of compatible
restore inputs: 1 passed, 0 failed, 0 ignored. The guest returned
provider-restore-ok; no runtime process remained, the network namespace
inventory matched its initial state, and the preprovisioned root-drive target
was unchanged. This verifies one concrete opened-file restore path, not every
provider implementation or hardware failure scenario.

The paired user guides passed documentation lint and relative-link checks.
The website built in both locales at / and /base-url-check/, and static
link validation passed for 190 HTML files in each build. Local website checks
used Node 25.9.0 and npm 11.12.1; hosted CI uses its configured Node version.
Also passed git diff --check and the CI-version commitlint for all 11 commits
from df8f93e61628d1f008e8cb23a55605ceae3886fc through the head above.

Documentation and rollback

The English and Chinese user guides describe provider composition, lifecycle
operations, capability boundaries, and the runnable public examples. No design
document changes are included in the aggregate PR diff.

Existing standard deployments need no configuration migration and can revert
this PR. For a custom assembled daemon, first complete resource cleanup with
the original provider before reverting or switching to another binary. The
standard daemon does not adopt provider-specific records and refuses startup
while they remain active or uncertain. Keep the provider identity and its
compatible records together; do not rename or remove unresolved state to force
a downgrade or bypass recovery checks.

Capability: select a source-level data-plane provider when assembling the
daemon while preserving the file-backed provider in the standard binary.

Add the provider contract, conformance helpers, daemon builder, strict lease
identity, and typed opened resources. Route create and delete through the
selected provider and fail startup instead of silently changing providers.

This commit establishes direct lifecycle coordination. Recovery of ambiguous
provider transitions across daemon crashes is completed by a later commit in
this series.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Capability: compare persisted sandbox records with provider inventory during
startup and adopt a running sandbox only when all recorded identities agree.

Persist lease and backend process identities, classify missing, duplicated,
stale, or mismatched ownership as recovery-required, and retain unresolved
resources instead of reporting successful cleanup.

This commit establishes inventory and adoption. Durable write-ahead recovery
for transitions that crash around provider calls is completed later in this
series.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Capability: coordinate provider-owned root and memory content with Blaze-owned
backend artifacts under one management checkpoint identifier.

Add capture, rollback, pruning, deletion, and retirement flows. Keep provider
references outside management responses and require all-or-nothing root and
memory ownership for provider checkpoints.

This commit establishes the checkpoint workflow. Cross-operation write-ahead
recovery and strict retirement identity are completed later in this series.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Capability: preserve provider-owned data-plane content while hibernated and
resume it through a fresh lease without changing the management sandbox ID.

Coordinate guest capability checks, lifecycle hooks, backend stop and restore,
compensation, and retirement. Keep provider references outside management
responses and leave the standard file-backed hibernation path unchanged.

This commit establishes suspend and resume coordination. Crash-safe transition
recovery and strict retirement identity are completed later in this series.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Capability: query provider-owned capacity and drain selected resource classes
through optional management routes.

Define stable resource-class identities, mutually exclusive accounting states,
monotonic revisions, and idempotent drains. Validate results before publication
and return not implemented when the selected provider lacks this extension.

Capacity covers provider-owned data-plane resources only. It does not implement
a reusable sandbox pool or runtime provider discovery.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
@github-actions github-actions Bot added component:blaze src/blaze scope:documentation ./docs/|./*.md|./NOTICE labels Sep 6, 2026
@WeissonHan

Copy link
Copy Markdown
Collaborator Author

@codex review This PR adds a build-time data-plane provider framework with lifecycle reconciliation, checkpoints, suspension, capacity controls, and crash-safe ownership transitions.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9c1263aa4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/blaze/crates/blazed/src/sandbox/manager.rs Outdated
@WeissonHan

Copy link
Copy Markdown
Collaborator Author

@codex review This update preserves exact provider leases awaiting explicit cleanup, quarantines identity mismatches, and restores legacy file-backed cleanup without bypassing request-scoped ownership.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9cf926f2b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/blaze/crates/blazed/src/api.rs Outdated
@WeissonHan

Copy link
Copy Markdown
Collaborator Author

@codex review This update preserves the existing sandbox management schema by separating durable recovery journals from API response DTOs and adds exact serialization coverage.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb2a04db2f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/blaze/crates/blaze-provider-api/src/lib.rs
@WeissonHan

Copy link
Copy Markdown
Collaborator Author

@codex review This update documents every public inventory and reconciliation field and method and makes missing Rustdoc a compile-time error for the provider API.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 4c3e902ee2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@WeissonHan

Copy link
Copy Markdown
Collaborator Author

@codex review This PR adds build-time data-plane providers with lifecycle recovery, checkpoint and suspension integration, capacity controls, and contract validation tests.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f596463669

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/blaze/crates/blazed/src/sandbox/restore.rs
Comment thread src/blaze/Cargo.toml
@WeissonHan

Copy link
Copy Markdown
Collaborator Author

@codex review This PR adds build-time data-plane providers with durable lifecycle recovery, checkpoint and suspension integration, opened-resource handoff, and capability-gated capacity controls.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3bf37afe9c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/blaze/crates/blazed/src/daemon.rs
Capability: recover provider-backed lifecycle operations across daemon crashes
and ambiguous external outcomes.

Persist exact request, lease, backend, storage, checkpoint, and suspension
identities before side effects. Reconcile creation, deletion, adoption, restore,
checkpoint, suspension, and retirement without guessing ownership.

Bind state and file-storage operations to opened directory objects, reject
stale or colliding identities, bound inventory traversal, and fail closed when
durable evidence cannot prove a safe action.

The contract coordinates control-path ownership only. Provider implementations
remain responsible for data-path behavior and declared capability guarantees.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Capability: keep exact provider leases owned by lifecycle records that wait
for explicit cleanup.

Remove only exact owned leases from orphan inventory while leaving identity
mismatches eligible for quarantine. A retained lifecycle record remains an
owner until an explicit cleanup request resolves it.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Capability: preserve the existing sandbox management schema while lifecycle
state records provider write-ahead identities for crash recovery.

Serialize operations through a dedicated management response type and test
that persisted provider records remain absent from API responses.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Capability: give extension authors field-level snapshot, pagination, and
reconciliation invariants.

Deny missing documentation in the public provider API so later public items
cannot silently ship without Rustdoc.

Assisted-by: Codex:GPT-5
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Keep provider composition and operational guidance in the English and
Chinese user guides, with runnable examples and explicit limitations.
Restore design notes, component summaries, and contributor instructions
to the base revision so the documentation changes have one entry point.

This documentation-only change leaves runtime behavior and source-level
API documentation unchanged.

Assisted-by: Codex:0.149.0
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
Exercise startup rejection, opened-resource ownership, lifecycle evidence,
checkpoint and suspension receipts, and capacity error handling through
the public contract validators and daemon management paths.

Use deterministic providers, ordinary opened files, and guest responses
so the assertions run without a particular storage or runtime extension.
This is test-only coverage; production behavior and APIs are unchanged.

Assisted-by: Codex:0.149.0
Signed-off-by: Weisson <Weisson@linux.alibaba.com>
@WeissonHan
WeissonHan force-pushed the feature/blaze/data-plane-provider-framework branch from 3bf37af to 8acb6a1 Compare September 7, 2026 09:22
@WeissonHan

Copy link
Copy Markdown
Collaborator Author

@codex review This PR adds build-time data-plane providers with durable lifecycle recovery, checkpoint and suspension integration, opened-resource handoff, and capability-gated capacity controls.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8acb6a191d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +882 to +885
if let Err(error) = instance
.advance_restore_phase(OperationPhase::RestoreBackendStarted)
.map_err(BlazeDaemonError::from)
.and_then(|_| self.persist_and_retain(instance.clone()))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Run guest recovery hooks before committing checkpoint restores

When a provider-managed checkpoint restores a guest with a guest transport, this path proceeds from a readiness ping directly to committing the replacement lease without negotiating or invoking the newly added reseed_rng and post_restore hooks. Restoring the same captured memory more than once can therefore repeat guest RNG state and leave the real-time clock stale, risking duplicate secrets and incorrect timestamps; require the lifecycle hooks before publishing the replacement, as the provider-suspension resume path does.

Useful? React with 👍 / 👎.

Comment on lines +837 to +840
.drain_provider_capacity(DrainRequest {
scope,
operation_id: request.operation_id.unwrap_or_else(Uuid::new_v4),
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require a caller-stable drain operation ID

When the request omits operation_id, the server generates an ID that is returned only on success. If both internal attempts return OutcomeUnknown, the client receives an error containing no generated ID, so it cannot retry the potentially accepted drain with the contract's stable idempotency identity; another empty-body retry generates a different operation and can accumulate duplicate provider-side request records. Require the ID from the caller or persist/expose the generated ID on ambiguous outcomes.

Useful? React with 👍 / 👎.

@WeissonHan WeissonHan closed this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:blaze src/blaze scope:documentation ./docs/|./*.md|./NOTICE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[blaze] feat: support build-time data-plane providers

1 participant