Repository navigation
feat(openshell-provider): name OpenShell objects by typed ref - #13152
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.
This was referenced Oct 14, 2026
cv
added a commit
that referenced
this pull request
Oct 14, 2026
## Failure Stacked v1 PRs such as #13152 target another feature branch. The bundle, image, dependency, and documentation workflows filtered pull requests to the `v1` base branch, so these PRs received none of those checks. ## Decision Remove the pull-request base-branch filters from all four workflows. Stacked PRs receive the existing four-platform bundle checks, image and dependency checks, and documentation validation. Image and live-suite change analysis still selects the applicable work. Keep documentation previews restricted to PRs targeting `v1`; push, release, and Brev triggers are unchanged. Document that existing stacks must incorporate the updated workflows before the checks can run. ## Validation - `cargo ci` passed on linux_arm64: 1,463 selected tests and all 136 contract/system lifecycle tests passed, along with formatting, Clippy, schema validation, and the bundle build. - `actionlint -shellcheck='' -pyflakes='' .github/workflows/*.yml` passed. - `cargo run --locked -p nemoclaw-build -- fern check` passed; Fern reported one warning in each validation pass. - `git diff --check` passed.
Retain the list-reference and schema-version extensions from this PR. The parent typed-reference implementation is identical before and after its squash merge; merge current v1 workflow and contributor guidance updates.
cv
enabled auto-merge (squash)
October 14, 2026 07:36
The dummy live test discarded the workspace object when reading raw OpenTofu state, so its direct gateway query failed. Flatten typed refs before collecting the client row. The focused regression failed without workspace and passes after the change.
Contributor
cv
added a commit
that referenced
this pull request
Oct 14, 2026
Closes #13142. Part of #13131. Stacked on #13152. ## Failure The `openshell` and `fabric` providers 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_gateway` takes `endpoint`, `credential_env`, `tls_ca_env`, `tls_certificate_env`, and `tls_key_env`, and exports them as a `ref` (`type = "openshell_gateway"`). The ref carries variable names, never their values. - Every OpenShell object, `fabric_agent_configuration`, and `fabric_sandbox_readiness` takes `gateway` as that ref. Provider configuration keeps only `destroy`. Gateway clients are cached per connection. - `nemoclaw-tofu` gains *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. - Credential and TLS references update in place. A different endpoint is a different gateway: reconstructible objects are replaced, and retained or stateful objects refuse it, as an unavailable bootstrap gateway did before. - The Fabric configuration schema moves to version 1, rejecting earlier state. - The SDK puts the connection on the gateway data source, emits `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 - New `nemoclaw-tofu` unit 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. - SDK compile tests check that providers take no connection, that both gateway reads take it, and that every object and readiness read takes the ref without leaking carried fields. - Regenerated the OpenShell contract fixtures and both schema snapshots; updated the hand-written contract HCL, which uses a literal gateway object, and the gateway-readiness and sandbox-readiness tests. - `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 #13141. Part of #13131. Stacked on #13138.
Failure
OpenShell provider profiles, registrations, and sandboxes named their workspace, scoped profile, and provider registrations with separate strings. OpenTofu could not check that each name meant an object of the right type, and graphs had to pass names in a fixed order through
depends_on.Decision
ref:type,name,owner,generation,id, plusworkspacefor objects inside a workspace.workspace = openshell_workspace.<label>.ref. Registrations take an optionalprofileref in place ofprofile_name. Sandboxes takeproviders, a list of registration refs, in place ofprovider_names.nemoclaw-tofugains list references (references_list) and a schema version. The four OpenShell schemas move to version 1, so OpenTofu rejects state from the earlier schema instead of upgrading it. The SDK record version moves from 7 to 8 with a message pointing to the original release for recovery or teardown.nemoclaw_openshell::flattenrewrites refs in state, plans, and planned values back into the row fields the SDK compares, so plan gates, export, and binding checks are unchanged. Sandbox readiness reads the workspace from the sandbox's ref.Validation
nemoclaw-tofuunit tests for list references: schema shape and version, backend rows, unknown elements deferring planning, rejecting an element of another type, and refresh.NEMOCLAW_REGENERATE_FIXTURES=1) and schema snapshot; updated the hand-written OpenShell and Fabric contract HCL; the SDK compile test now checks workspace and provider refs.cargo cipassed locally on linux_arm64, including all 138 contract and system tests.