Repository navigation
feat(fabric-provider): configure agents through typed fabric_agent resources - #13167
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
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.
cv
enabled auto-merge (squash)
October 14, 2026 18:48
Contributor
cv
added a commit
that referenced
this pull request
Oct 14, 2026
cv
added a commit
that referenced
this pull request
Oct 14, 2026
…ref (#13184) Closes #13145. Part of #13131. #13167 has merged; this targets `v1`. ## Failure `fabric_sandbox_readiness` took nine separate inputs: the sandbox's workspace, name, ID, owner, generation and launch, plus the agent's whole `config_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 explicit `depends_on`. ## Decision `fabric_agent_readiness` replaces it and takes `agent = fabric_agent.<name>.ref`, plus `gateway` and `read_trigger`. - `fabric_agent` now exports a `ref` with its sandbox's identity, its own `name`, and `config_sha256`: `sha256:<hex>` over its composed document's JSON with object keys sorted. - Readiness reads the sandbox's launch metadata itself and checks that the sandbox launches that agent. It then compares the digest of the applied document with the ref's digest before asking for health. The check is the same as before; only its inputs changed. - `config_sha256` uses a new `nemoclaw-tofu` feature: 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. - The SDK's readiness block is now three attributes, and the ref replaces the explicit `depends_on`. The name and semantics may change again once Fabric's own readiness work lands; see the issue. ## Validation - `cargo ci --full` passes locally (unit tests, plus 138 contract and system tests). - New unit tests cover derived attributes (plan, update, refresh), key-order-independent digests, the digest waiting for its inputs, and the readiness ref's validation (unknown attributes defer, a ref of another type is rejected, rejected values are not echoed). - The Fabric contract tests run readiness through pinned OpenTofu against the fake gateway with the new ref. The `fabric_agent` update test's no-op re-plan shows the derived digest and the ref plan cleanly.
Closed
8 tasks
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 #13144. Part of #13131.
#13160 has merged; this targets
v1.Failure
fabric_agent_configurationtook the whole Fabric agent document as one opaqueconfig_jsonstring. OpenTofu could not type-check it, plans showed one JSON blob, and the sandbox it configured was a set of loose identity strings. Nothing checked the document against the harness until the bridge applied it.Decision
fabric_agentreplaces it:sandbox = openshell_sandbox.<name>.ref,harness = data.fabric_harness.<name>.ref, andgateway.nameanddescriptionare Fabric'smetadata, andsettingsisharness.settings. Every section of Fabric's agent configuration (instructions,models,runtime,tools,skills,mcp,workflow,environment,discovery,relay,telemetry) is a typed input derived from Fabric's published schema (SchemaName::Agent). A unit test fails if Fabric adds a section that isn't an input.mode = "append"with Pi, using the adapter's catalog records now carried in thefabric_harnessref. Once the sandbox is known, plans refuse an agent name or harness the sandbox does not launch.fabric_agent_configuration) is rejected with the recovery message; the record version is now 11.To map Fabric's schema,
nemoclaw-tofunow:jsonencode), because tf-provider cannot decode OpenTofu's dynamic values;api, in anextensionsJSON-text attribute, so a document crosses OpenTofu without loss;models "default" {}), and adds avalidate_inputshook that checks related inputs while others are still unknown.The SDK compiles each sandbox's document into these inputs, with a
data.fabric_harnessread named after the sandbox, so adding a sandbox changes no existing agent. Readiness, state recovery, plan reporting, and export use the same shared compose and split functions (nemoclaw_fabric::agent). Diagnostics still name the sandbox, not the agent.Not in this change:
settings;fabric_harnessesfor compatibility,fabric_harnessfor the ref).Validation
v1(with refactor(openshell-provider): serve the gateway installation types #13187 and feat(fabric-provider): select harnesses with fabric_harness #13160),cargo ci --fullpasses locally (138 contract and system tests).cargo cipasses locally (1495 unit, 138 contract and system tests).apiextensions), the reference and flatten rules, and plan-time harness rejection.fabric_agentthrough pinned OpenTofu against the fake gateway: plan-time rejection without echoing values, a harness-unsupported field rejected at plan, apply, unchanged re-plan, update without sandbox replacement, drift repair, a lost reply, and teardown.