Repository navigation
feat(openshell-provider): reach gateways through typed refs - #13153
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.
Keep the gateway references and carried-field implementation from this PR across the parent squash merge. Incorporate current v1 CI guidance and the live-test sandbox binding repair.
Contributor
cv
enabled auto-merge (squash)
October 14, 2026 08:27
cv
added a commit
that referenced
this pull request
Oct 14, 2026
) Part of #13143 (the `fabric_harness` data sources follow in the next PR). Part of #13131. Stacked on #13153. ## Failure The OpenShell provider parsed Fabric's runtime binding to start each sandbox. It required `agent_runtime` to be `fabric`, built the start command and environment from the binding, and merged the image runtime's policy and executables into the sandbox policy (`network.rs`). OpenShell depended on Fabric's types, and could not launch anything else. ## Decision As decided on #13143 (option 1), the launch carries the runtime's policy contribution and OpenShell merges it: - `openshell_sandbox` takes `launch_json`: `command`, `environment`, `policy` (used when no explicit policy is authored), `binaries` (executables managed grants allow), and opaque `metadata`. `agent_name`, `agent_runtime`, and `runtime_json` are removed, along with the checks that the runtime is Fabric. - OpenShell merges the launch policy with the authored policy and managed grants (`Launch::policy`/`granted_policy`, moved from the runtime binding), records the launch in an annotation, and compares it on refresh. - `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 (`fabric_binding`) for configuration, readiness, and the bridge. - The bridge refuses a binding whose agent or runtime binding differs from the launch the sandbox records; the gateway already checks that launch against the live sandbox. This keeps the protection the old `runtime_json` comparison gave. - `launch_json` is a JSON string rather than a typed object: the framework maps nested objects to blocks, which can't be assigned from a data source. A typed object input can follow once the framework supports object attributes. - OpenShell schemas move to version 2 and the SDK record to version 9, rejecting earlier state. The SDK still compares the agent name in its compiled rows, so renaming an agent of a bound sandbox stays refused. ## Validation - The existing runtime-binding policy tests now run through `Launch`, since the binding's policy delegates to it. - Updated the fake-gateway, health, and SDK compile tests; regenerated the OpenShell contract fixtures and schema snapshots; converted the hand-written contract variables to `launch_json`. - `cargo ci` passed locally on linux_arm64, including all 138 contract and system tests.
gaveezy
added a commit
that referenced
this pull request
Oct 14, 2026
PR-7 now carries v1 up to #13153 and PR-6's `get pods/exec` access check. Three conflicts: - `crates/nemoclaw-sdk/src/compile.rs`: v1 (#13152) dropped the `workspace` name interpolation because profiles, registrations, and sandboxes now take the workspace `ref`. The resolution keeps v1's structure and reapplies PR-8's change, which escapes `cluster_source` like `credential_source`. - `crates/nemoclaw-sdk/tests/kubernetes_service_exec.rs`: PR-6 and PR-8 each appended a test; both are kept, PR-8's last. - `docs/provider.md`: v1 (#13153) rewrote the `openshell` provider paragraph for gateway refs. The resolution keeps v1's text and replaces its managed-credential sentence with PR-8's three sentences on bundled checks and cluster vLLM keys. v1's typed refs also break three PR-8 tests that configure the providers with a gateway `endpoint` or write version 0 OpenShell and Fabric state. `nemoclaw-e2e`'s integration tests do not compile at this commit; the next commit adapts the three tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gaveezy
added a commit
that referenced
this pull request
Oct 14, 2026
## Why Merging PR-7 brought in v1's #13152 and #13153. OpenShell objects and Fabric configurations now take `gateway` and `workspace` as typed refs, the `openshell` and `fabric` providers take only `destroy`, and those resource schemas are version 1. Three PR-8 tests still used the earlier shapes: - `crates/nemoclaw-e2e/tests/cluster_credentials.rs` did not compile: `GatewayConfig` has no `endpoint` field (E0560). - Its two `bundled_` tests configured the providers with `endpoint` and wrote version 0 state that carried the gateway and workspace as row fields. - `plan_and_apply_refuse_cluster_port_changes_with_separate_state_files` wrote version 0 `openshell_sandbox` state. `tofu show` rejected it: "schema version 0 for openshell_sandbox.assistant in state does not match version 1 from the provider". ## Change - `cluster_credentials`: the backend now picks a gateway client from each row's gateway fields, so `at_fixture` points compiled rows at the fixture instead of configuring the client with its endpoint. The `bundled_` tests write empty provider blocks, literal `gateway`, `workspace`, and `profile` refs in configuration and state, the registration's exported `ref`, and schema version 1. - The SDK test's native state for OpenShell objects records the refs in place of the row fields they carry, plus the exported `ref`, at schema version 1. Production code is unchanged. ## Validation - `cargo test -p nemoclaw-e2e --test integration cluster_credentials` passes. With `NEMOCLAW_TEST_BUNDLE` from `cargo ci bundle`, both `bundled_` tests and the SDK test pass; the SDK test failed with the error above before this commit. - A bundle whose `openshell` and `fabric` provider binaries use the default Docker-only services fails both `bundled_` tests, so they still check NemoClaw's cluster callbacks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #13142. Part of #13131. Stacked on #13152.
Failure
The
openshellandfabricproviders took one gateway connection in provider configuration. A fresh deployment had to defer configuring the provider until the gateway existed, every object in a graph had to share that connection, and refresh of a bound object depended on the provider configuration still describing its gateway.Decision
data.openshell_gatewaytakesendpoint,credential_env,tls_ca_env,tls_certificate_env, andtls_key_env, and exports them as aref(type = "openshell_gateway"). The ref carries variable names, never their values.fabric_agent_configuration, andfabric_sandbox_readinesstakesgatewayas that ref. Provider configuration keeps onlydestroy. Gateway clients are cached per connection.nemoclaw-tofugains carried fields: inputs a backend uses but never observes. Refresh and apply keep them from the recorded or desired row, so objects keep their gateway connection in state and reach the same gateway for refresh and removal without provider configuration. Backends receive rows without the connection.gateway = data.openshell_gateway.current.ref, carries the connection in its target rows so binding and export comparisons hold, and gives teardown graphs (which read no data sources) the same ref as a literal object.Validation
nemoclaw-tofuunit test: carried fields survive refresh and apply without being observed. New client tests: one client per connection, and rows without a usable gateway ref have no client.cargo cipassed locally on linux_arm64, including all 138 contract and system tests.