Repository navigation
refactor(openshell-provider): inject credential services into the OpenShell and Fabric providers - #13127
Merged
Conversation
…nShell and Fabric providers Provider credentials were parsed and resolved only through nemoclaw_docker::credentials, so a caller could not supply another source. A Services trait now carries credential validation and resolution, with DockerServices as the default; GatewayClient, OpenShell, OpenShellProvider and FabricProvider gain with_services constructors. The bundled providers keep the defaults, so behaviour is unchanged. A regular test checks that FabricProvider::with_services keeps the injected services when it observes a registration. Split from #13060. Co-authored-by: Hai Nguyen <haingu@nvidia.com>
Contributor
|
v1 documentation preview: https://nvidia-preview-nemoclaw-v1-pr-13127.docs.buildwithfern.com/nemoclaw |
cv
added a commit
that referenced
this pull request
Oct 14, 2026
…ofile metadata (#13125) Unsupported OpenShell provider profile metadata and an unparsable static search rule now return observation errors instead of aborting the provider process. ## Why `annotations()` looked up each profile metadata field with `expect("profile metadata field")`, and the search profile definition parsed its static rule with `expect("static search policy")`. A violation of either invariant panicked the `openshell` provider. ## What changes - `annotations()` returns `Result` and reports an unknown field as `Incomplete`. - `definition_with_rule` takes the search rule as an argument, so a test can pass an invalid one; an unparsable rule returns `Query`. No schema, state, or behavior change for valid profiles. ## Validation - New tests `unsupported_profile_metadata_returns_an_error_instead_of_panicking` and `unsupported_search_rules_return_an_observation_error` fail to compile on `v1` (E0308, E0425) and pass with this change. - `cargo ci` passed on `v1` with the three split PRs combined (#13125, #13126, #13127): 1452 tests, 136 lifecycle tests. Split from #13060 (Hai Nguyen's work; co-authored). Co-authored-by: Hai Nguyen <haingu@nvidia.com>
cv
added a commit
that referenced
this pull request
Oct 14, 2026
…dresses (#13128) "An OpenShell provider profile can now carry a verified cluster source, and a sandbox policy can grant that cluster Service's verified addresses. The bundled providers use `DockerServices`, which rejects every cluster source, so Docker and Podman deployments are unchanged until a cluster `Services` implementation is injected (#13063).\n\n## Why\n\n#12736 routes sandboxes to vLLM and Ollama Pods that the deployment runs in its cluster. A cluster model is reached by a `<name>.svc.cluster.local` host, so an inference profile, which grants only the literal IP in its endpoint URL, could not grant the Service's ClusterIP, and nothing checked which Service owned the address.\n\n## What changes\n\n- **`Services` hook:** adds `validate_cluster_source` and `cluster_addresses` to the trait from #13127. `DockerServices` returns `BindingMismatch` from both.\n- **Cluster profiles:** `openshell_provider_profile` gains an optional, computed `cluster_source`.\n - It is a bound field (#13126) and resets to empty when omitted on update, so any change replaces the profile.\n - `nemoclaw_openshell::profile::cluster_definition` accepts only an `http://<host>.svc.cluster.local:<port>/v1` endpoint without credentials, query, or fragment, and grants only the addresses `Services::cluster_addresses` returns.\n - `service_address_allowed` rejects unspecified, loopback, multicast, link-local, broadcast, and IPv4-mapped addresses.\n - The source and addresses are stored in new `nemoclaw.nvidia.com/cluster-source` and `cluster-addresses` annotations. Refresh re-reads the addresses and rejects a profile whose endpoints no longer match them.\n- **Cluster grants:** `PolicyInput.cluster_grants` names managed rules whose `allowed_ips` come from verified cluster profiles (`RuntimeBinding::granted_policy`: one or two unique `/32` or `/128` addresses per rule). Sandbox create (`create_sandbox_request`) and refresh (`checked_sandbox_row_with`) check each grant against the deployment's own profile: same owner, listed among the sandbox's providers, and the same endpoint apart from `allowed_ips`. Removal checks only the recorded policy, so it works when the Service is gone. The field is omitted from serialized policy when empty.\n- **SDK:** `image_runtime::policy_input` sets `cluster_grants: Default::default()`.\n\n## Breaking or user-visible changes\n\n- **Provider schema:** `openshell_provider_profile` gains `cluster_source`, and the `openshell_sandbox` `policy` block gains `cluster_grants`. With the bundled `DockerServices`, a profile with `cluster_source` or a sandbox with `cluster_grants` fails on create and read (`docker_services_reject_cluster_profiles`).\n- **State and annotations:** no change for existing resources. `cluster_grants` is not serialized when empty, and a profile without a cluster source writes no new annotations.\n- **Rust API:** `nemoclaw_openshell::runtime::PolicyInput` gains the public `cluster_grants` field, so struct literals need it. The crates are `publish = false`.\n\n## Validation\n\n`cargo ci` passed on this tree (linux_amd64): 1462 tests and 136 lifecycle tests.\n\nNew tests:\n\n| Test | Checks |\n|---|---|\n| `nemoclaw-provider` `refresh::profile_refresh_preserves_the_bound_cluster_source` | Fails on `v1` before this PR: state becomes `substituted-service`. |\n| `refresh::changing_from_cluster_to_external_inference_replaces_the_owned_profile` | Fails on `v1` before this PR: planned `cluster_source` stays `owned-cluster-storage`. |\n| `nemoclaw-openshell` `profile::tests::cluster_profiles_accept_only_plain_service_endpoints_and_unicast_addresses` | Endpoint shape and address filter. |\n| `openshell-provider` `profile::tests::docker_services_reject_cluster_profiles` | Bundled default rejects cluster sources. |\n| `owned_cluster_profiles_grant_exact_observed_addresses_and_reject_others` | Exact `/32` and `/128` grants; no broader observed grant. |\n| `cluster_grants_resolve_the_endpoint_ambiguity_with_the_provider_profile` | Without the grant, OpenShell reports one endpoint ambiguity; with it, none. |\n| `profile_removal_validates_recorded_grants_when_the_service_is_absent` | Refresh needs the Service; removal does not, but still rejects a broadened grant. |\n| `cluster_sandbox_grants_require_the_matching_owned_profile_and_exact_host_addresses` | Grant count, prefix, uniqueness, owner, provider listing, endpoint. |\n| `sandbox_refresh_verifies_current_grants_but_removal_uses_recorded_policy` | Moved or absent Service fails refresh; removal checks only recorded policy. |\n| `fabric-provider` `configured_provider_observes_cluster_grants_through_its_injected_services` | `FabricProvider::with_services` keeps the cluster methods. |\n\nEach production check was mutated once, and a new test failed each time: the `granted_policy` address filter, `cluster_grant` endpoint equality, the sandbox refresh grant comparison, the profile refresh endpoint comparison, the `.svc.cluster.local` host check, and the `validate_cluster_source` call.\n\nThe openshell-provider tests build the cluster case from the `fabric-openclaw` contract fixture, so they need no SDK types. #13063 can keep or replace them with its SDK-built cases.\n\nSplit from #13060 (Hai Nguyen's work; co-authored). Follows #13125, #13126, and #13127." Co-authored-by: Hai Nguyen <haingu@nvidia.com>
gaveezy
added a commit
that referenced
this pull request
Oct 14, 2026
PR-6 and PR-7 merged v1 after #13060 was closed in favor of #13125, #13126, #13127, and #13128. This merge brings v1's versions of that code into PR-8; git merged it without conflicts. #13128 added SDK-free cluster tests to the `tests` module of `crates/openshell-provider/src/profile.rs`, next to PR-8's tests built from the SDK. Four names are now defined twice there, so that module does not compile at this commit. The next commit resolves them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
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.
Callers of the OpenShell and Fabric providers can inject a
Servicesimplementation for inference credential sources. The default,DockerServices, keeps today'snemoclaw_docker::credentialsbehavior, and the bundled provider binaries keep the default.Why
Provider credentials were parsed and resolved only through
nemoclaw_docker::credentials, so a caller could not supply another source, such as credentials for cluster model Services.What changes
openshell_provider::Serviceswithvalidate_credential_sourceandresolve_credential_source;DockerServicesimplements them withnemoclaw_docker::credentials.GatewayClient::with_services,OpenShell::connect_with_services,OpenShellProvider::with_services, andFabricProvider::with_services.DefaultandOpenShell::connectuseDockerServices.nemoclaw_docker::credentialsdirectly.No schema, state, or behavior change. Rust API additions only; the crates are
publish = false.Validation
fabric-providerprovider::tests::configured_provider_observes_registrations_through_its_injected_servicescreates a registration with a credential source only the injected services accept, then reads it throughFabricProvider::with_services. With a mutant wherewith_servicesignoresservices, the read fails withErr(Incomplete); with this change it passes. It runs in the regular test step, closing the gap where only an ignored lifecycle test constructedFabricProvider::with_services.cargo cipassed onv1with the three split PRs combined: 1452 tests, 136 lifecycle tests.The cluster methods (
validate_cluster_source,cluster_addresses) follow in a separate PR.Split from #13060 (Hai Nguyen's work; co-authored).