Skip to content

feat(fabric-provider): select harnesses with fabric_harness - #13160

Merged
cv merged 15 commits into
v1from
feat/fabric-harness-sources
Oct 14, 2026
Merged

cv merged 15 commits into
v1from
feat/fabric-harness-sources

Conversation

@cv

@cv cv commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Closes #13143 (with #13157). Part of #13131. Stacked on #13157.

Failure

Fabric images were read only through fabric_capabilities, which takes a whole agent configuration and returns a catalog assessment. No data source named a single harness, so there was no typed source a sandbox could take its launch from, and the type's name didn't match what it lists.

Decision

  • fabric_capabilities is renamed fabric_harnesses: the catalog listing and compatibility assessment, unchanged in behavior. Rust module paths keep their names.
  • 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 with type = "fabric_harness", adapter_id, and image. It reuses the catalog read and fails when the image installs no runtime for the adapter.
  • The SDK keeps compiling sandboxes from fabric_harnesses (now under that name). Switching the compiled graphs to fabric_harness, and adding the Fabric revision and contract version to its ref, can follow with the typed fabric_agent work (Typed fabric_agent #13144).

Validation

  • New unit test: a harness selects the Pi adapter from a fixture image, launches the named agent with the adapter's executables, exports its ref, and rejects an adapter the image doesn't install.
  • Regenerated the OpenShell contract fixtures and Fabric schema snapshot; updated docs.
  • cargo ci passed locally on linux_arm64, including all 138 contract and system tests.

cv added 9 commits October 13, 2026 23:04
…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
Convert the sandbox state row through fabric_binding before calling the Fabric bridge, matching the generic launch contract.
Base automatically changed from feat/fabric-harness to v1 October 14, 2026 09:40
cv added 2 commits October 14, 2026 03:00
…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
@cv
cv enabled auto-merge (squash) October 14, 2026 10:08
@github-actions

Copy link
Copy Markdown
Contributor

cv added 4 commits October 14, 2026 10:05
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.
@cv
cv merged commit 454843f into v1 Oct 14, 2026
@cv
cv deleted the feat/fabric-harness-sources branch October 14, 2026 18:42
cv added a commit that referenced this pull request Oct 14, 2026
v1's tree equals #13160's final tree (9ee2697), which this branch
already contains, so the merge keeps this branch's tree.
cv added a commit that referenced this pull request Oct 14, 2026
…sources (#13167)

Closes #13144. Part of #13131.

#13160 has merged; this targets `v1`.

## Failure

`fabric_agent_configuration` took the whole Fabric agent document as one
opaque `config_json` string. 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_agent` replaces it:

- **References:** it takes `sandbox = openshell_sandbox.<name>.ref`,
`harness = data.fabric_harness.<name>.ref`, and `gateway`.
- **Inputs:** `name` and `description` are Fabric's `metadata`, and
`settings` is `harness.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.
- **Planning:** plans reject a document Fabric cannot parse, naming the
field but not its value. They also reject one the harness catalog does
not accept, such as `mode = "append"` with Pi, using the adapter's
catalog records now carried in the `fabric_harness` ref. Once the
sandbox is known, plans refuse an agent name or harness the sandbox does
not launch.
- **Changes:** changing the sandbox, harness, or name replaces the
agent; any other change reconfigures it without replacing the sandbox.
Removal still releases the binding without stopping the agent; stopping
it needs a bridge operation (follow-up).
- **Old state:** state recorded before typed Fabric agents (record
version 10, which still binds `fabric_agent_configuration`) is rejected
with the recovery message; the record version is now 11.

To map Fabric's schema, `nemoclaw-tofu` now:

- maps nullable types to their optional type, and unions of one scalar
type, such as string enums, to that type;
- writes objects and values the schema leaves open as JSON text
(`jsonencode`), because tf-provider cannot decode OpenTofu's dynamic
values;
- keeps undeclared properties of objects that allow them, such as a
model's `api`, in an `extensions` JSON-text attribute, so a document
crosses OpenTofu without loss;
- accepts maps and lists of objects as top-level typed inputs (labeled
blocks such as `models "default" {}`), and adds a `validate_inputs` hook
that checks related inputs while others are still unknown.

The SDK compiles each sandbox's document into these inputs, with a
`data.fabric_harness` read 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:

- skills and MCP servers by ref (#13150, #13151);
- harness fields other than `settings`;
- merging the two image reads per sandbox (`fabric_harnesses` for
compatibility, `fabric_harness` for the ref).

## Validation

- After merging `v1` (with #13187 and #13160), `cargo ci --full` passes
locally (138 contract and system tests).
- `cargo ci` passes locally (1495 unit, 138 contract and system tests).
- New unit tests cover the schema mapping rules, lossless round trips of
a full document (including `api` extensions), the reference and flatten
rules, and plan-time harness rejection.
- The Fabric contract test runs `fabric_agent` through 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.
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images v1 NemoClaw v1 branch labels Oct 22, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants