Repository navigation
feat(fabric-provider): read agent readiness through the fabric_agent ref - #13184
Merged
Merged
Conversation
…refs Provider types identify each other through separately passed strings, such as a sandbox's workspace name, so OpenTofu cannot check that the pieces belong to one object or say which resource type they came from. The provider redesign in #13131 replaces these with a computed `ref` object on the producing type and an object input on the consumer. Definitions gain `exports` and `references`. The structured adapter derives `ref` from the row, so backends never see it, and parts the row does not know yet stay unknown. A reference input is one object attribute whose declared attributes travel to the backend as row fields; its `type` must match the exporting type, because OpenTofu drops object attributes a consumer does not declare and would otherwise accept a ref of another type with matching fields. A changed ref replaces its consumer when the carried fields are immutable, and plans report the reference attribute as the replacement path. The fixture provider gains a ref-exporting workspace and a ref-taking sandbox. Unit tests cover the schema, planning with known and unknown refs, type checks, and refresh. A contract test through OpenTofu 1.12.6 covers create, an unchanged plan, replacement propagating to the consumer, and rejecting a ref of another type.
OpenShell profiles, registrations, and sandboxes named their workspace, scoped profile, and provider registrations with separate strings, so OpenTofu could not check that each name meant an object of the right type. Each OpenShell resource now exports a computed `ref`. Profiles, registrations, and sandboxes take `workspace` as a workspace ref, registrations take an optional `profile` ref in place of `profile_name`, and sandboxes take `providers`, a list of registration refs, in place of `provider_names`. The framework gains list references and a schema version; these schemas move to version 1, so OpenTofu rejects state from the earlier schema rather than upgrading it, and the SDK record version moves to 8 with a message pointing to the original release for recovery or teardown. The SDK compiler emits ref expressions, and `nemoclaw_openshell::flatten` turns refs in state, plans, and planned values back into the row fields the SDK compares. Sandbox readiness reads the workspace from the sandbox ref. Regenerated the OpenShell contract fixtures and schema snapshot, and updated the hand-written contract HCL and provider docs. Closes #13141. Part of #13131.
The openshell and fabric providers took one gateway connection in provider configuration, so a fresh deployment had to defer configuring the provider until the gateway existed, and every object in a graph had to share that one connection. `data.openshell_gateway` now takes the endpoint and the names of the credential and mutual-TLS variables, and exports them as a `ref`. Every OpenShell object, `fabric_agent_configuration`, and `fabric_sandbox_readiness` takes `gateway` as that ref; provider configuration keeps only `destroy`. Clients are cached per connection. The framework gains carried fields: inputs a backend uses without observing, which refresh and apply keep from the recorded or desired row. Objects carry their gateway connection that way, so refresh and removal reach the same gateway without provider configuration, and backends see rows without it. Credential and TLS references rotate in place; another endpoint is another gateway, so retained and stateful objects refuse it. The Fabric configuration schema moves to version 1. The SDK emits the gateway connection on the data source and `gateway = data.openshell_gateway.current.ref` on objects, carries the connection in target rows so state comparisons hold, and gives teardown graphs, which read no data sources, the same ref as a literal object. Closes #13142. Part of #13131.
The OpenShell provider parsed Fabric's runtime binding to start each sandbox: it required `agent_runtime` to be `fabric`, built the command and environment from the binding, and merged the image runtime's policy and executables into the sandbox policy. OpenShell depended on Fabric. Sandboxes now take `launch_json`: a command, environment, the policy used when none is authored, the executables managed grants allow, and opaque metadata. OpenShell merges that policy with the authored policy and managed grants, records the launch in an annotation, and compares it on refresh. `agent_name`, `agent_runtime`, and `runtime_json` are gone, and so are the checks that the runtime is Fabric. `fabric_capabilities` returns `launch_json` for its configured agent; Fabric records the agent name and runtime binding in the launch metadata and reads them back for configuration, readiness, and the bridge. The bridge refuses a binding that differs from the launch the sandbox records, which the gateway checks against the live sandbox. OpenShell schemas move to version 2 and the SDK record to version 9. Part of #13143. Part of #13131.
Fabric images were read only through `fabric_capabilities`, which takes a whole agent configuration and returns a catalog assessment. Nothing named one harness, so a sandbox could not take what it launches from a typed source. `fabric_capabilities` becomes `fabric_harnesses`, the catalog listing. The new `fabric_harness` data source selects one harness by `image` and `adapter_id`, returns the `launch_json` that starts it for `agent_name`, and exports a `ref` (`type`, `adapter_id`, `image`). It fails when the image installs no runtime for the adapter. The SDK keeps reading `fabric_harnesses`, now under its new name. Closes #13143. Part of #13131.
# Conflicts: # crates/fabric-provider/src/sandbox_readiness.rs # crates/fabric-provider/tests/contract/fixtures/main.tf # crates/nemoclaw-sdk/src/state/mod.rs # crates/openshell-provider/src/lib.rs # crates/openshell-provider/tests/contract/fixtures/explicit-policy.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-claude.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-codex.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-hermes.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-mini-swe-agent.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-nooa-bench.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-nooa.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-openclaw.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-pi.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric-remote-agent.tf.json # crates/openshell-provider/tests/contract/fixtures/fabric.tf.json # crates/openshell-provider/tests/contract/fixtures/hermes-auth.tf.json # crates/openshell-provider/tests/contract/fixtures/hermes-interfaces.tf.json # crates/openshell-provider/tests/contract/fixtures/inference-tuning.tf.json # crates/openshell-provider/tests/contract/fixtures/inline-inference.tf.json # crates/openshell-provider/tests/contract/fixtures/local.tf.json # crates/openshell-provider/tests/contract/fixtures/multiple-models.tf.json # crates/openshell-provider/tests/contract/fixtures/multiple-providers.tf.json # crates/openshell-provider/tests/contract/fixtures/multiple-sandboxes.tf.json # crates/openshell-provider/tests/contract/fixtures/openclaw-dashboard.tf.json # crates/openshell-provider/tests/contract/fixtures/openclaw-web-search.tf.json # crates/openshell-provider/tests/contract/fixtures/tavily-web-search.tf.json # crates/openshell-provider/tests/contract/standalone/main.tf # crates/openshell-provider/tests/schema.txt # docs/provider.md
Fabric's agent configuration schema writes optional fields as nullable type arrays, enums as alternatives of one scalar type, and adapter-owned settings as objects without declared properties. None of these mapped to OpenTofu types, so its sections could not become typed inputs. Nullable types map to their optional type, alternatives of one scalar type map to that type, and open objects become JSON text attributes, as jsonencode writes them. Structured inputs now convert every shape, not only objects, so a JSON text input's row field holds its object.
…puts fabric_agent_configuration took the whole Fabric document as opaque config_json, so OpenTofu could not type-check it, plans showed one JSON string, and the sandbox and harness it targeted were loose strings. fabric_agent takes the sandbox and harness by ref, its own name and description, harness settings, and every section of Fabric's agent configuration as typed blocks derived from Fabric's schema. It composes the document the bridge applies and splits observed configuration back into its inputs. Plans reject a document Fabric cannot parse, one the harness catalog in the fabric_harness ref does not accept, and a name or harness the sandbox does not launch.
Convert the sandbox state row through fabric_binding before calling the Fabric bridge, matching the generic launch contract.
…rces The SDK compiled each sandbox's Fabric document into one config_json string, and read it back from state for readiness, export, and recovery. Each sandbox now compiles a fabric_agent whose inputs are that document's sections, with the sandbox and the harness it launches passed by ref from a data.fabric_harness read named after the sandbox. Readiness compares the document those inputs compose, and state, plans, and export read the agent's typed values back through the same shared rows. Typed inputs must carry a document without loss: objects whose schema also allows undeclared properties, such as Fabric's flattened model extensions like api, keep them as JSON text in an extensions attribute. Diagnostics name the sandbox an agent belongs to, not the agent.
…rces # Conflicts: # crates/fabric-provider/src/lib.rs # crates/nemoclaw-e2e/tests/openshell_contract_fixtures.rs # crates/nemoclaw-sdk/tests/compile.rs # docs/provider.md
…o feat/fabric-harness-sources
fabric_sandbox_readiness took the sandbox's identity and launch and the agent's whole document as nine separate inputs, so the SDK rebuilt the document a second time and ordered readiness with depends_on. fabric_agent_readiness takes the fabric_agent ref instead. fabric_agent exports its sandbox identity, name, and config_sha256, a key-order- independent digest of the document its inputs compose, as a new derived attribute: computed from inputs while planning and recomputed from every observation. Readiness reads the sandbox's launch itself and compares the applied document's digest with the ref's.
It reaches its fake engine through crate::fixture, which listens on a Unix socket and is compiled only on Unix, so the Windows clippy build failed.
refused_server bound an ephemeral port and dropped the listener, so a fake server in a concurrent test could take the port. The SDK then read that server's objects and failed with BindingMismatch instead of the refused connection's Transport error, failing linux_amd64 CI. Keep a socket bound to the port without listening: connections are still refused, and no other test can bind it while the test runs.
Deployment state recorded at version 10 binds fabric_agent_configuration resources, which no provider serves now that agents are fabric_agent. Bump the record version so such state is rejected with the recovery message instead of failing inside OpenTofu.
# Conflicts: # crates/fabric-provider/src/agent.rs # crates/fabric-provider/src/lib.rs # crates/fabric-provider/src/provider.rs # crates/fabric-provider/tests/contract/fixtures/readiness.tf # crates/fabric-provider/tests/contract/main.rs # crates/fabric-provider/tests/schema.txt # crates/nemoclaw-fabric/src/agent.rs # crates/nemoclaw-sdk/src/compile.rs # crates/nemoclaw-sdk/tests/compile.rs # crates/nemoclaw-tofu/src/lib.rs # crates/nemoclaw-tofu/src/resource.rs # docs/contributing/integration-tests.md # docs/provider.md
cv
enabled auto-merge (squash)
October 14, 2026 19:19
Contributor
Closed
8 tasks
gaveezy
added a commit
that referenced
this pull request
Oct 19, 2026
PR-6 merged v1 up to #13411. Three v1 changes move code this branch builds on: - #13224 removed the `nemoclaw` provider, which served this branch's cluster model types. They become `openshell_kubernetes_service` and `openshell_kubernetes_service_storage`, served by the openshell provider beside the Kubernetes gateway installation types: two more `INSTALLATION_TYPES` entries, and `cluster_services::definitions()` in `all_definitions()`. Their contract tests move to `openshell-provider::contract` with the Kubernetes gateway tests, their schema to the openshell snapshot, and the docs name the new types. - #13286 plans and applies each deployment as one OpenTofu root. The cluster image preflight moves from the removed runtime stage into `Deployment::run`, before compilation. #13286 also removed the "unfinished Kubernetes platform apply" rule, so this branch's exception to it (`revises_only_model_workloads`), its test, and its usage.md paragraph go too. The compile test now checks that the apply-time gateway read, which every object waits on, waits on the cluster service, instead of checking that agents compile into a separate graph. - #13184 added `Definition::derived`: a computed attribute kept out of backend rows. This branch's `derived` is an optional input checked against the spec and kept in the row, so ownership checks still see `owner` and `generation`. It is renamed `derived_input`. Smaller follow-ups: - #13093 added `ServiceDefinition::Container`; the cluster matches cover it. The cluster service is no longer a `runtime_process` kind: that flag now also selects Docker readiness and compute, which decode a Docker spec. Its only other readers handle the cluster kind first. - #13223 dropped the `org.nemoclaw.runtime.spec` label everywhere; the cluster image check no longer requires it. - #13369 removed `model_metadata` from OpenClaw routes, since Fabric v0.5.0's adapter rejects it; the cluster fixtures and docs drop it. The remaining conflicts keep both sides. `openshell-provider::contract`'s summed budget rises from 105 to 130 s, keeping v1's margin: the 8 moved cluster model tests add 23.2 s in a local linux_arm64 run (slowest 3.9 s, within the 6 s limit), about 17 s at CI speed. `nemoclaw-provider::contract` keeps its v1 budget; this branch's earlier raise to 150 s went with the tests. Validation on linux_arm64: the `cargo ci` fmt, clippy, test, schema, bundle and lifecycle steps pass (161 lifecycle tests, among them the 8 cluster model contract tests), as does `nemoclaw-build docs --check`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13145. Part of #13131.
#13167 has merged; this targets
v1.Failure
fabric_sandbox_readinesstook nine separate inputs: the sandbox's workspace, name, ID, owner, generation and launch, plus the agent's wholeconfig_json. The SDK had to rebuild that document a second time just to pass it to readiness, and readiness depended on the agent only through an explicitdepends_on.Decision
fabric_agent_readinessreplaces it and takesagent = fabric_agent.<name>.ref, plusgatewayandread_trigger.fabric_agentnow exports arefwith its sandbox's identity, its ownname, andconfig_sha256:sha256:<hex>over its composed document's JSON with object keys sorted.config_sha256uses a newnemoclaw-tofufeature: derived attributes, computed from a resource's inputs. They are known while planning once their inputs are, and recomputed from every observation. A computed attribute can only carry its prior value forward, which would be wrong as soon as the inputs change.depends_on.The name and semantics may change again once Fabric's own readiness work lands; see the issue.
Validation
cargo ci --fullpasses locally (unit tests, plus 138 contract and system tests).fabric_agentupdate test's no-op re-plan shows the derived digest and the ref plan cleanly.