Repository navigation
Conversation
…gateways ## Failure Managed Kubernetes and OpenShift gateways rejected every vLLM and Ollama service, so a cluster deployment needed a model endpoint outside NemoClaw. The reconciler behind the configuration gate could not be used: nothing compiled a document to its resources, and the provider did not serve them. The review of #12736 found these defects in the code that connects it; this commit contains the #12736 fixes: - X2-TAINT (high): a first apply that stopped at readiness, for example on an Unschedulable Pod, left the service resource tainted; no supported apply recovered it. - NEW-M1-DRIFT (low): no OpenTofu contract test changed cluster objects between applies. - N2b and X1-N3 (nits): a wrong-architecture runtime image got the generic metadata message, and the label message did not name org.nemoclaw.inference.routes. - STOPPED-RT (docs part), D3n, L1 and MG-WORD-3 (docs). ## Decision Lift the gate for managed cluster gateways and connect the reconciler: - Configuration: a vLLM or Ollama service on a managed Kubernetes or OpenShift gateway needs `kubernetes` settings, explicit `container.cpuLimitMillis` and `container.memoryLimitGiB`, private IPC and no Docker placement; `KubernetesService::resolve` combines them with the service-level `updatePolicy`. External gateways still reject services, and Docker and Podman still reject `kubernetes`. - Compile: the runtime stage emits `nemoclaw_kubernetes_service_storage` (prevent_destroy) and `nemoclaw_kubernetes_service`, ahead of agents. - Provider: `ClusterServicesBackend` serves both types. Owner and generation are derived from the spec. A first apply that is not ready returns `Mutation::stopped`: complete state with a warning, so OpenTofu does not taint it and an unchanged apply resumes waiting. The provider refuses bound port changes and removal outside destroy. - Images: plan and apply verify each cluster runtime image's platform and labels from its metadata bundle; bearer vLLM needs the routes label. - Deployment: cluster bindings and teardown, corrections limited to model workloads after a failed rollout, and a NetworkPolicy warning for every cluster service. Sandboxes cannot route to these services yet: that needs endpoint grants and credential reads that are not part of this commit. Validation rejects a provider whose `serviceRef` names a cluster service with "inference providers cannot reference cluster model services yet; use an external endpoint", instead of the later "invalid native inference policy". Tests use temporary fixtures with an external endpoint. The legacy `kubernetes.{cpuLimitMillis,memoryLimitGiB,updatePolicy}` layout from #12736 branch builds is not accepted. ## Validation - `cargo ci` on linux_arm64 passed in 607 s: fmt, clippy `-D warnings`, build, 1544 nextest tests (182 skipped; the base ran 1507) and 4 doctests, schema, bundle, and 135 lifecycle tests (48 skipped; the base ran 127), among them the 8 new contract tests through OpenTofu. `nemoclaw-build docs --check` passed. - On the base, with this commit's tests: the SDK and provider integration binaries do not compile (`Mutation::stopped`, `Definition::derived`); with those two files from the base, 18 new tests fail, and the 8 contract tests fail because the base provider does not serve the resource types. 12 unit tests are in files the base lacks. 10 pass on the base, which rejects every cluster service. - 22 production mutants, applied one at a time, each disabled one change, such as the X2-TAINT fix (`Mutation::stopped` replaced by a partial error), the routing refusal, the container-limit rule, owner and generation derivation, the bound port refusal or the routes label. Together they failed 37 of the 48 new or renamed tests. Three survived: the defensive Docker `Preserve` guard, the SDK's retained-storage comparison and the deployment image preflight, which the provider repeats. - `nemoclaw-provider::contract` summed budget 110 -> 150 s: the 8 new tests add 43.6 s locally, about 30 s at CI speed, putting the binary at its old budget. Split from #12736. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
This repository limits you to 5 open pull requests. Please close or merge an existing PR before opening another one. |
PR-6 now includes v1 025b95a. Resolve the docs conflicts with v1's retained-resource removal (#12929): - docs/inference.md: keep v1's link to Remove Retained Resources for Docker services and state that removing a cluster service's PVCs is not covered yet (#12640), because that procedure covers only Docker engines. - docs/kubernetes.md: keep this branch's destroy and retention text and add v1's sentence that removing the retained resources is not covered yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR-6 now includes PR-2's Rust route filter. The merge is clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cluster prerequisites said bearer vLLM images return 404 for unlisted requests "and disable WebSockets". That described the Python middleware, which closed WebSocket connections separately. PR-2's Rust supervisor filter answers a WebSocket upgrade with the same 404 as any other unlisted request, so the guide now lists it with them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR-6 now includes v1 a5445c7, which moves the onboarding crate to crates/nemoclaw-onboarding, and PR-3's split of the Docker model update steps out of the remote recovery tests. The merge is clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, and test fixtures (#13056) Report the gateway's reason when OpenShell rejects a credential-free mutation, and fix sandbox teardown, deployment-lock release, test-fixture flakes and the images plan message, with matching docs. Nothing here depends on Kubernetes. ## Why The review of #12736 found these problems; each predates or is independent of the cluster model services. - **F2** (#12736 review): OpenShell rejection text was discarded. `remote_error` maps every gateway status to a fixed category, so on kind a CreateSandbox rejection for conflicting `allowed_ips` endpoint metadata reached the user only as `observation query failed`. Finding the cause took a rebuilt bundle that logged `status.message()`. - **`transport.rs:220`** (#12736 review: open at 59ad198, fixed at c3496ea): removing a ready sandbox read its active-policy status, which teardown does not use, so a failing status read blocked removal. #12736 changed this without a test. - **T1** (#12736 review): the deployment lock is an `flock` on the open file description. A child spawned concurrently holds a copy of the descriptor until `exec`, so dropping `Store` could leave the deployment locked and the next open failed with `another operation holds the deployment lock`. Besides the flaky SDK suite, an SDK process that runs `tofu` can hit this. - **T1-tail** (#12736 review) and **N1** (#12736 review, nit): several tests wrote a script and executed it at once, which fails with `Text file busy` (ETXTBSY) when a concurrent spawn holds the write descriptor. Running the staged provider through `/bin/sh` stopped the staging test from checking the executable bit OpenTofu needs. - **HM-4** (#12736 review, nit): `cargo images build --platform linux/amd64 hermes` failed with Bake's `failed to find target hermes`. - **N2** (#12736 review) and [#12642](#12642): no documented OpenClaw request format, and no recovery path when a malformed request leaves the runtime `unknown`. The gateway profile-format break from #12941 had no operator note. ## What changes - **Rejection text.** `ObservationError` gains `Rejected { operation, code, detail }`. `nemoclaw_openshell::remote_rejection` keeps the gateway's detail only for CreateWorkspace, CreateSandbox, DeleteProvider and DeleteProviderProfile, whose requests carry no credentials, and only for `FailedPrecondition`, `InvalidArgument`, `AlreadyExists`, `OutOfRange` and `ResourceExhausted`. Other codes and operations return the same category as before. - **Redaction.** `ObservationError::sanitized_detail` reduces text to printable ASCII of at most 1024 characters and redacts bearer tokens, key/value credentials (`authorization`, `api_key`, `token`, `password`, `secret`) and runs of 32 or more token characters. `sanitized_resource_detail` additionally keeps one known resource name. Credential-bearing provider creation and update, reads and exec keep category-only errors. - **Teardown.** `openshell-provider` skips the active-policy status read when it reads a ready sandbox for removal (`if ready && !removing`). The owned identity checks still run. - **Lock.** `impl Drop for Store` unlocks before the file closes, which releases the `flock` for every copy of the descriptor. - **Test fixtures.** Tests execute an existing interpreter or binary (`/bin/sh`, `/bin/cat`) and pass the written script as data. The provider staging test asserts the executable bit. - **Images plan.** `images::plan` lists each platform's harnesses with `buildx bake --print agents` and names the platforms that build a requested harness. Groups and other targets keep Bake's resolution. - **Docs.** `agents.md`: the headless OpenClaw request and the reported malformed-request failure. `usage.md`: "Replace Workloads After an Unusable OpenClaw Runtime". `troubleshooting.md`: which rejections keep their detail, and table rows for both failures. `provider.md`: "Gateway Profile Format Upgrade". ## Breaking or user-visible changes - **Rust API:** `ObservationError` (from `nemoclaw-backend`, re-exported as `nemoclaw_sdk::ObservationError`) is `Clone` but no longer `Copy`, and has the new `Rejected` variant. Code that copies it must call `.clone()`, and exhaustive matches need a `Rejected` arm. The crates are `publish = false`; every use in this workspace is updated. An application using the SDK through a path dependency must make the same edits. - **Error text:** a rejected CreateWorkspace, CreateSandbox, DeleteProvider or DeleteProviderProfile now reports `OpenShell <operation> rejected (<code>): <detail>` instead of `observation query failed`. This applies to Docker, Podman and Kubernetes gateways. - **Images:** an unsupported harness now fails with, for example, `hermes is built only for linux/arm64; linux/amd64 builds deepagents, openclaw (docs/build.md#build-agent-images)`. - No configuration, schema, bundle or state format change. ## Test proof ### `cargo ci` (linux_arm64, this branch) Run on the GB300 host (aarch64). The tree tested is the commit's tree. ``` ok tools in 0s ok fmt in 1s ok clippy in 35s ok build in 76s Summary [ 19.032s] 1387 tests run: 1387 passed, 174 skipped ok test in 25s ok schema in 0s ok bundle in 178s Summary [ 364.941s] 127 tests run: 127 passed, 48 skipped ok lifecycle in 371s All selected CI steps passed in 690s ``` The test step's 4 doctests passed. The lifecycle timing report lists one local overrun: 364.9 s wall against the 300 s budget that applies on the Linux CI runners. This PR adds no lifecycle tests; the per-test (90 s) and per-binary budgets were met. `cargo run --locked -p nemoclaw-build -- docs --check` passed after `docs` generated the untracked output; no tracked file changed. ### New tests: red without the production change, green with it Each red run edited only the working tree and restored the PR tree afterwards. Commands: `cargo test --locked -p <crate> <target> -- <test names>`. | Test | Red change | Red result | Green | |---|---|---|---| | `nemoclaw-openshell` `connection::tests::live_endpoint_ambiguity_keeps_its_conflict_kind` | `remote_rejection` returns `remote_error` (v1 behaviour) | FAILED: message lacks `conflicting metadata: allowed_ips=[]` | ok | | `connection::tests::definitive_rejections_keep_bounded_gateway_text_and_other_statuses_stay_fixed` | same | FAILED: `missing operation rejection` | ok | | `openshell-provider` `fake_gateway_tests::gateway_validation_rejections_preserve_details_for_credential_free_mutations` | `connected.rs` restored to v1 | FAILED: `missing CreateWorkspace rejection detail: observation query failed` | ok | | `fake_gateway_tests::credential_requests_reads_and_exec_keep_backend_rejection_text_private` | guard: passes on v1 by design; mutant opts CreateProvider into `remote_rejection` | FAILED under the mutant: `Rejected { operation: "CreateProvider", …, detail: "PRIVATE_SENTINEL" }` ≠ `Query` | ok | | `fake_gateway_tests::ready_sandbox_teardown_needs_owned_identity_but_not_active_policy_status` | `transport.rs` restored to v1 (`if ready {`) | FAILED: removal read returned `Err(Transport)` | ok | | `nemoclaw-sdk` `error::workload_details_redact_short_bearer_and_quoted_credentials` | `sanitize_detail` returns its input | FAILED: secret kept | ok | | `error::workload_details_are_single_line_bounded_and_redact_token_like_runs` | same | FAILED: `safe.len() <= 1024` | ok | | `error::resource_details_preserve_only_the_exact_known_name_outside_credentials` | same | FAILED: name appears 5 times, expected 1 | ok | | the three `error::` tests | `observation.rs` restored to v1 | does not compile: no `sanitized_detail`, no `Rejected` (E0599) | ok | | `nemoclaw-sdk` `state::tests::dropping_store_releases_lock_while_a_duplicate_descriptor_remains_open` | `state/mod.rs` restored to v1 (no `Drop for Store`) | FAILED: `Conflict("another operation holds the deployment lock or locking failed")` | ok | | `nemoclaw-build` `images::harnesses_missing_from_the_selected_platform_name_the_platforms_that_build_them` (needs `docker buildx`; v0.37.1 here) | `images.rs` restored to v1 | FAILED: got `docker failed to plan the image build` | ok | | `nemoclaw-test-fixtures` `tofu::tests::stages_only_the_selected_provider_and_cleans_only_its_workspace` (changed test) | mutant: staging sets mode 0644 | FAILED: executable-bit assertion | ok | ### Repeated runs of the touched suites In-process `cargo test` runs on this host, which is where the descriptor races occur (nextest isolates each test). Branch and v1 (29bb057) ran under the same load. | Suite | This branch | v1 | |---|---|---| | `cargo test -p nemoclaw-sdk --lib` | 22/22 runs passed (192 tests) | 7/22; failures in `state::tests::lock_excludes_other_operations_and_atomic_intent_survives_reopen` (`Conflict("another operation holds the deployment lock…")`), `deployment::tests::changing_gateway_management_at_the_same_endpoint_preserves_saved_state`, `deployment::export::tests::export_reports_recovery_for_each_saved_operation_state_without_changing_files` | | `cargo test -p nemoclaw-test-fixtures --lib` | 50/50 | 46/50; kept logs show `Text file busy` in the staging test | | `cargo test -p nemoclaw-runtime --lib vllm::runtime` | 10/10 | 10/10 | | `cargo test -p nemoclaw-provider --lib hardware::ssh` | 10/10 | 10/10 | | `cargo test -p nemoclaw-sdk --test integration kubernetes_connection` | 10/10 | 10/10 | ### Lifecycle tests This PR adds no lifecycle-only tests. All 127 selected by the `lifecycle` profile passed. The ones that drive the changed OpenShell code through OpenTofu: - `openshell-provider::contract`: all 44 passed, including `standalone::standalone_hcl_rejects_replacement_and_unauthorized_removal_during_plan`, `standalone::standalone_hcl_recovers_lost_delete_response_without_repeating_the_mutation`, `standalone::standalone_registrations_replace_and_remove_without_destroy_mode` and the 22 example-configuration tests. - `nemoclaw-e2e::integration` teardown paths, all passed: `deployment::failed_first_apply_can_destroy_bound_resources_without_successful_reapply`, `deployment::destroy_waits_for_graceful_sandbox_stop_without_retrying`, `deployment::rejected_policy_fails_promptly_with_context_and_allows_recovery_or_destroy`, `deployment::sandbox_startup_failure_names_reason_and_guidance_and_allows_destroy`, `deployment::pi_start_failure_names_the_sandbox_in_cli_text_and_json_and_allows_destroy`, `deployment::mixed_sandboxes_reorder_add_recover_export_and_destroy_independently`. <details><summary>All 127 lifecycle tests (passed)</summary> - `fabric-provider::contract` (3): `capabilities::capabilities_judge_the_image_for_the_configuration`, `pi_configuration_updates_without_replacing_the_sandbox`, `readiness::readiness_reports_the_configured_agent_and_its_failed_health` - `nemoclaw-e2e::integration` (49): `deployment::` (24), `export_observations::` (4), `fabric_deployment::` (4), `helm_recovery::` (5), `inference_discovery::optional_catalog_failures_preserve_complete_unchanged_plans_and_typed_uncertainty`, `multiple_providers::provider_union_export_reapply_drift_and_destroy_remain_scoped_to_each_sandbox`, `remote_service::` (9), `sandbox_readiness::standalone_sandbox_completion_rejects_unknown_health_and_retains_bindings` - `nemoclaw-provider::contract` (29): `discovery::` (3), `gateway_readiness::` (1), `gateway_storage::` (1), `inference_capabilities::` (3), `kubernetes_hcl::` (1), `kubernetes_lifecycle::` (2), `provider_protocol::` (4), `runtime_image::` (1), `service_capacity::` (1), `service_readiness::` (2), `service_storage::` (6), `vllm_runtime::` (4) - `openshell-provider::contract` (44): `capabilities::` (2), `standalone::` (20), and the example configurations `explicit_policy`, `fabric`, `fabric_claude`, `fabric_codex`, `fabric_hermes`, `fabric_mini_swe_agent`, `fabric_nooa`, `fabric_nooa_bench`, `fabric_openclaw`, `fabric_pi`, `fabric_remote_agent`, `hermes_auth`, `hermes_interfaces`, `inference_tuning`, `inline_inference`, `local`, `multiple_models`, `multiple_providers`, `multiple_sandboxes`, `openclaw_dashboard`, `openclaw_web_search`, `tavily_web_search` - `nemoclaw-fixture-provider::archive` `the_fixture_provider_is_found_beside_the_test_executables`, `nemoclaw-test-fixtures::ssh_relay` `the_relay_is_found_beside_the_test_executables` </details> ### Live evidence (not qualification; #12732 stays open) This branch merged with `v1` 025b95a (local merge ba8499b, GB300 host, aarch64, 2026-10-13): - `cargo ci live-docker`: **11/11 passed** in 352 s, and the Docker inventory was the same before and after. - The suite includes `v1`'s new `dummy_agent::the_dummy_agent_completes_a_managed_docker_lifecycle` (48.1 s). It destroys a ready sandbox through the bundled OpenShell provider and checks that no sandbox containers or volumes remain, which is the live path of the teardown change (`if ready && !removing`). - Full `cargo ci` on the merged tree: 1394 tests + 127 lifecycle, all passed, 727 s. The branch needs no change for the new `v1`; "Update branch" produces the tested tree. No kind or GPU run: nothing in this PR depends on them. ## Depends on / merge order - Base: `v1` at 29bb057. No dependencies; it merges in parallel with #13057, #13058 and #13059, and the four branches merge into each other without conflicts. - #13060 is opened on this branch and retargets to `v1` when this branch is deleted after merge. - #13061 needs this PR and #13058 in `v1`. - Lines of #12736 in these files that this PR leaves out, for the later PRs to carry: the `ModelRuntimeStopped` doc comment in `observation.rs` (#13061); in `provider.md`, the cluster `owner`/`generation` paragraph and the "cluster resource identity refresh" clause of the profile-format note (#13062); in `usage.md`, "including the cluster model and credential PVCs" (#13062). Split from #12736. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…odel budget (#13059) Plan and apply warn, before any mutation, when an OpenClaw or Hermes route's context does not fit the managed vLLM or Ollama service it uses. ## Why Plan and apply accepted agent routes to managed model services whose `serving.contextTokens` could not hold the agent's prompt, and said nothing: - The managed Ollama examples served `8192` tokens. One measured initial OpenClaw prompt used 19,947 tokens before any reply, so the first turn could overflow the server or be silently truncated. - The pinned Hermes Agent requires a context window of at least 64,000 tokens (`MINIMUM_CONTEXT_LENGTH` at the `HERMES_REVISION` in `image/fabric/Dockerfile`). Below it, Hermes refuses to start when it can read the server's window. In operator tests it could not read the window behind the sandbox proxy and assumed 131,072 tokens instead, so longer conversations can overrun the server. This is review finding **HM-1** on #12736. ## What changes - **SDK** (`deployment/mod.rs`): a new `Progress::Warning { message }` event. Plan and apply check each OpenClaw and Hermes sandbox route to a managed vLLM or Ollama service before opening the bundle or state, and warn when: - an OpenClaw route's effective `contextWindow` (default `32768` at the pinned adapter revision, or `overrides.settings.model_metadata.contextWindow`) exceeds the service's `serving.contextTokens`; - the smaller of the two is below `20000` plus the effective reply allowance (`overrides.settings.model_metadata.maxTokens`, else `overrides.maxTokens`, else `4096`); - `settings.model_metadata` is not an object, or its `contextWindow` or `maxTokens` is not a positive integer, so the budget cannot be assessed (the value is not echoed and no default is substituted); - a Hermes route uses a service with `serving.contextTokens` below `64000` (`HERMES_MINIMUM_CONTEXT_TOKENS`). Other harnesses, external providers, and routes without a managed service are skipped. The warnings never reject a document. - **CLI** (`formatting.rs`, `progress/model.rs`): warnings are collected even with `--progress off`, de-duplicated, and printed after the result as a `Warnings:` section in text output and as a `warnings` array in JSON output. Both also appear when the command fails. Progress shows each warning as a durable line that does not mark work as active. - **Examples:** `examples/managed-ollama.yaml` and `examples/managed-ollama-gpu.yaml` serve `32768` tokens and set the route's `model_metadata.contextWindow` to `32768`. - **Docs:** `docs/inference.md` describes the budget rules and adds "Size the Context for Hermes"; `docs/reference/cli.md` documents the `warnings` field and that warnings survive `--progress off` and failures. ## Breaking or user-visible changes - Plan and apply can print new warnings. Text output gains a `Warnings:` section, and JSON results and JSON errors gain a `warnings` array (omitted when empty; it does not change `complete`). - Of the shipped examples, only `examples/managed-hermes.yaml` (unchanged here) now warns, because its Hermes route uses managed Ollama at `contextTokens: 8192`. - Rust API: `nemoclaw_sdk::Progress` gains the `Warning { message }` variant, so exhaustive matches on `Progress` need a new arm. ## Test proof **`cargo ci`** on linux_arm64 at this commit (the full `CI / Bundle` step list, lifecycle with `NEMOCLAW_TEST_BUNDLE` from the bundle step): ``` ok tools in 0s ok fmt in 1s ok clippy in 22s ok build in 42s Summary [ 19.195s] 1391 tests run: 1391 passed, 174 skipped ok test in 25s ok schema in 0s ok bundle in 25s Summary [ 403.614s] 127 tests run: 127 passed (1 slow), 48 skipped ok lifecycle in 409s All selected CI steps passed in 526s ``` The timing report flagged the lifecycle wall time (403.6 s against 300 s) and the `nemoclaw-provider::contract` and `openshell-provider::contract` sums. Those budgets apply only on Linux CI runners, and this run shared the host with other builds. An earlier run of the same code, differing by one docs sentence, kept both contract binaries within budget (97.3 s and 174.8 s) with a 374 s lifecycle wall. This PR changes no test in those binaries. **New tests: red without the production change, green with it.** Each red run kept the new tests and reverted the production hunks in the working tree. | Test | Base production code | Only the `Progress::Warning` variant added | Branch | |---|---|---|---| | 10 advisory tests that expect a warning (`native_route_window_above_the_service_limit_warns_even_with_initial_prompt_room`, `native_route_mismatch_is_assessed_independently_of_unusable_reply_metadata`, `small_managed_openclaw_context_warns_before_plan_or_apply_mutation`, `route_context_warns_even_when_the_managed_service_has_room`, `context_advisory_reserves_the_effective_reply_allowance`, `context_advisory_follows_native_defaults_and_metadata_precedence`, `context_advisory_reports_unusable_metadata_without_guessing_or_echoing_values`, `context_advisory_uses_the_selected_harness_and_service_budget`, `context_advisory_resolves_referenced_harnesses_and_local_providers`, `hermes_routes_to_managed_services_below_its_minimum_context_warn`) | does not compile: `E0599 no variant named Warning found for enum deployment::Progress` | **fail** (`left: 0`, expected 1 or 2 warnings) | pass | | `native_route_window_at_or_below_the_service_limit_needs_no_mismatch_warning`, `hermes_routes_at_its_minimum_context_need_no_warning_whatever_the_route_metadata` | does not compile (same error) | pass: they assert that no warning is emitted. With the advisory present, both **fail** under boundary mutants (`context <= 64000`, `contextWindow >= contextTokens`) | pass | | `formatting::tests::warnings_survive_hidden_progress_and_successful_or_failed_json_output` | does not compile (`E0599`, 3 sites) | with the CLI ignoring `Progress::Warning` and `formatting.rs` at base: **fail** (text output has no warning) | pass | | `progress::model::tests::warnings_are_durable_without_marking_work_as_active` | does not compile | with the CLI ignoring `Progress::Warning`: **fail** (`Option::unwrap()` on `None`) | pass | Commands: `cargo nextest run --locked -p nemoclaw-sdk --lib -E 'test(/^deployment::context_warnings::/)'` and `cargo nextest run --locked -p nemoclaw-cli -E 'test(/^formatting::tests::warnings_survive|warnings_are_durable/)'`. On the branch, all 14 passed in a filtered run and again in the `cargo ci` test step (JUnit: 14/14 pass, 0 failures of 1391). **Examples.** Without a bundle, plan fails after the advisory, so the branch binary can report warnings for each example. `nemoclaw --progress off plan -o json`: | Example | `v1` (`contextTokens: 8192`) | This branch (`32768`) | |---|---|---| | `examples/managed-ollama.yaml` | 2 warnings (route window 32768 exceeds 8192; 8192 < 24096 budget) | 0 | | `examples/managed-ollama-gpu.yaml` | 1 warning (8192 < 22048 budget) | 0 | Across every file under `examples/` (credential variables set to dummy values), only `examples/managed-hermes.yaml` warns on this branch. **Docs.** `cargo run -p nemoclaw-build -- docs --check` passes (local links and anchors). **Lifecycle-only tests.** This PR adds none. The existing lifecycle suite passed 127/127, including the 9 `nemoclaw-e2e` `remote_service` tests that plan and apply Docker managed vLLM and Ollama services. ## Depends on / merge order - Base: `v1` (29bb057). No dependencies; merges in parallel with #13056, #13057 and #13058. - It shares `docs/inference.md` with #13057 and #13058, and `crates/nemoclaw-cli/src/formatting.rs` with #13058. `git merge-tree` of this branch with the PR-1, PR-2, PR-3 and PR-5 slices reports no conflicts. - #13062 needs this PR in `v1`: its NetworkPolicy warning uses `Progress::Warning`. When #13062 adds managed cluster services and the cluster inference design doc, it extends this PR's `docs/inference.md` text to Kubernetes and adds the operator-report note to `docs/limits.md`. #13063 adds the cluster examples back to the advisory tests. ### Live evidence (not qualification; #12732 stays open) `split/4-context-advisory` @ `4fda90b4f`, this branch's `dist/linux_arm64` bundle (`0.1.0-dev.c4afaf1c80e8d2ea`). 2026-10-12, GB300 host (ARM64), local Docker engine. This was plan only, so no containers ran and the GPU was not used. **Setup.** Each plan used this branch's `examples/managed-ollama-gpu.yaml` (OpenClaw) or `examples/managed-hermes.yaml` (Hermes) with: - a fresh UID, endpoint and subnet, and profile `gb300`; - the local `nc-prototype-ollama@sha256:dea377de…`; - OpenClaw and Hermes agent images built from `split/8` (`image/` is identical to `v1`), because Docker plan inspects the sandbox image. Each case ran `plan` (text) and `--progress off plan -o json`. Each took about 5 s, and all ended with `Plan incomplete · 6 known resource changes` (no gateway yet). | Case | `contextTokens` / route `contextWindow` | Text `Warning:` lines | JSON `warnings` | |---|---|---|---| | OpenClaw, shipped example | 32768 / 32768 | 0 | 0 | | OpenClaw, service at 8192 | 8192 / 32768 | 2 | 2 | | Hermes, shipped example | 8192 / – | 1 | 1 | | Hermes, 32K | 32768 / – | 1 | 1 | | Hermes, 64K | 65536 / – | 0 | 0 | The warnings printed: - `OpenClaw sandbox assistant route primary advertises contextWindow=32768, exceeding managed service qwen serving.contextTokens=8192; longer conversations can exceed the server limit. Set overrides.settings.model_metadata.contextWindow to 8192 or less, …` - `OpenClaw sandbox assistant route primary uses managed service qwen with serving.contextTokens=8192 and settings.model_metadata.contextWindow=32768; allow at least 22048 tokens for an initial prompt of about 20,000 tokens plus 2048 reply tokens. …` - `Hermes sandbox assistant route primary uses managed service ollama-server with serving.contextTokens=32768; Hermes requires a model context window of at least 64000 tokens and can refuse to start or fail longer conversations below it. Set serving.contextTokens to 64000 or more …` The 8192 case gave the same message with 8192. Plans created no containers, and no network on 172.30.143–147.0/24. For the cluster cases of the advisory, which #13063 adds, see PR-8's evidence: Hermes on cluster vLLM warns at 32K and is silent at 64K. Split from #12736. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…#13057) Bearer vLLM services now answer only the authenticated inference endpoints and public `GET /health`; every other request gets 404 before it reaches vLLM. ## Why Native vLLM authentication guards only `/v1` paths. On a live bearer service, `POST /invocations` returned a full chat completion without the key, and `/tokenize` and `/metrics` answered too (review finding **X1**). Recipe `VLLM_*` variables can also register management routes under `/v1`, such as `/v1/load_lora_adapter`, which any key holder could then call, including a sandbox through its injected key (**X1-L1**). The review of the first filter also found: - The image-build test used a hand-built copy of vLLM's app, so an upstream middleware change would pass unnoticed (**X1-T1**). - `HEAD /health` and plain `OPTIONS` reached vLLM's router (**X1-N1**, **X1-N2**). - A missing or wrong routes label produced a rejection that did not name the label (**X1-N3**). - The vLLM-only route files were staged into the Ollama build contexts too (**X1-N4**). **Why Rust.** The first revision of this PR filtered routes with a Python ASGI middleware loaded into vLLM and checked it with a Python test during the image build. The repository's own code is Rust, so the filter now runs in the Rust runtime supervisor, which is already the image's entrypoint, in front of vLLM. That also retires X1-T1 and X1-N4: there is no Python filter to test in the image and no route file to stage. ## What changes vLLM moves to loopback TCP, so its launch changes only by host and port; the runtime container's own network namespace keeps that port unreachable from outside the container. - **Route filter in the supervisor.** For bearer services, the Rust supervisor (`nemoclaw-runtime`, the image entrypoint) binds `0.0.0.0:<serving.port>` before it starts vLLM, so a port conflict fails startup, and serves HTTP/1.1 there with hyper (`crates/nemoclaw-runtime/src/vllm/runtime/routes.rs`). It forwards only: - `GET /v1/models`, and `POST` to `/v1/chat/completions`, `/v1/completions`, `/v1/responses`, `/v1/messages` and `/v1/messages/count_tokens`, all of which still require the key; - `GET /health`, which stays public. The filter compares the method and the request-target path exactly as received, with no percent-decoding or dot-segment removal, and accepts only origin-form targets. Every other request gets `404 {"error":"Not found"}` with or without the key and opens no connection to vLLM. That includes `OPTIONS`, `HEAD`, `CONNECT`, absolute-form targets, other spellings of an allowed path (`//`, `/./`, `..`, `%2e`, `/V1`, a trailing slash), and requests that carry `Upgrade` (WebSocket, h2c). An HTTP/2 preface closes the connection. - **Forwarding.** Allowed requests keep their method, path, query and end-to-end headers, including `Authorization`. Hop-by-hop headers (`Connection` and the headers it names, `Keep-Alive`, `Proxy-*`, `TE`, `Trailer`, `Transfer-Encoding`, `Upgrade`) are dropped in both directions. Request and response bodies stream, so completion events reach the client as vLLM produces them, and a client that disconnects closes its vLLM request. vLLM's uvicorn trusts forwarding headers from loopback (`proxy_headers` on, `forwarded_allow_ips=127.0.0.1` in the pinned ARM64 base's uvicorn 0.52.4), and every filtered request now comes from loopback, so the filter sets `X-Forwarded-For` to the connecting address and drops `X-Forwarded-Proto`; a client cannot choose the address or scheme vLLM records. If vLLM does not accept the connection, the client gets `502 {"error":"Bad gateway"}`; if the client's body cannot be read, such as invalid chunked framing, it gets `400 {"error":"Bad request"}`. A client must send its request headers within 30 s. - **Connection limit.** The filter serves at most 256 connections at once; later clients wait in the listen backlog until one closes. When the filter starts, the supervisor raises its soft open-file limit to the hard limit (vLLM, already running, keeps the limit it inherited and raises itself), and the cap shrinks so that two descriptors per connection plus 128 kept for the supervisor fit the limit. Without the cap, about 1,000 idle connections exhausted the container's default soft limit of 1024, the supervisor's memory sample could not open `/proc/meminfo`, and the supervisor stopped vLLM until reapply. - **Launch.** Bearer vLLM starts with `--host 127.0.0.1 --port <serving.port + 1>`, or `--port 65534` when `serving.port` is 65535 (the schema allows 1024 to 65535), and no `--middleware`. Readiness still probes `http://127.0.0.1:<serving.port>/v1/models` with the key, now through the filter. Services without `authentication` get the same arguments as before and no filter. - **Lifecycle.** The filter runs beside supervision. If it fails, the supervisor stops vLLM and reports `inference route filter failed; managed service stopped; reapply required`. When supervision ends for any other reason, including an operator stop, the filter closes its listener and open connections before the supervisor returns. - **Images.** The `vllm`, `vllm-amd64` and `qwen38` Dockerfiles install and run no Python for routing; they add only `org.nemoclaw.inference.routes=openai-v2`, which now identifies the supervisor filter. `runtimes/vllm/nemoclaw_vllm_routes.py` is deleted, `runtimes/vllm/test_auth.py` is back to its `v1` content, and the build no longer stages either file (`stage_workload_files` and its reserved manifest names are gone). - **Label enforcement.** Unchanged from the first revision of this PR: Docker bearer installs require `org.nemoclaw.inference.routes=openai-v2`, and the provider's rejection names the label and points to `docs/build.md`. - **Dependencies.** `nemoclaw-runtime` declares `hyper`, `hyper-util` and `http-body-util` under its `execution` feature, at the versions `reqwest` already locked (hyper 1.11.1, hyper-util 0.1.20, http-body-util 0.1.5). `Cargo.lock` gains three lines in the runtime's dependency list. The runtime's Linux dependency closure gains one crate, `httpdate` 1.0.3, from hyper's server feature; `tests/dependencies.rs` passes unchanged. - **Docs.** `docs/inference.md` describes the filter, the loopback port, the 404, 400 and 502 responses, the header timeout, the connection limit, half-closed clients and logging; `docs/build.md` says what the label identifies. ## Breaking or user-visible changes - **Existing bearer vLLM images must be rebuilt.** Images built before this change lack `org.nemoclaw.inference.routes=openai-v2`, so plan and apply reject them with: `runtime image platform or required backend, recipe, authentication, or route-restriction (org.nemoclaw.inference.routes) labels are incompatible; rebuild the runtime image (docs/build.md) and update its digest` - Bearer services return 404 for `/invocations`, `/tokenize`, `/metrics`, `/ping`, `/version`, `/load`, `/openapi.json`, `/inference/v1/generate`, LoRA load and unload, `OPTIONS` and `HEAD`, even with the key. - Compared with the Python filter in the first revision of this PR: - Percent-encoded spellings of an allowed path, such as `/v1/%6Dodels`, now get 404; the Python filter saw the decoded path. - WebSocket requests get an HTTP 404 instead of a close with code 1008. - Requests that offer an h2c upgrade get 404, including those `curl --http2` and other clients send to an `http://` URL; uvicorn ignored the offer and answered over HTTP/1.1. - While vLLM is loading or after it stops accepting connections, allowed requests get 502 from the supervisor. - A request body that cannot be read gets 400 `{"error":"Bad request"}` from the supervisor instead of uvicorn's plain-text 400. - Connections that do not complete a request head within 30 s, including idle keep-alive connections, are closed. - A client that half-closes its socket after sending a request gets no response; the supervisor treats it as a disconnect, where uvicorn answered. - More than 256 concurrent connections wait to be accepted. - Rejected requests (404) and 502s are not logged; uvicorn's access log recorded them. - vLLM records each bearer client by the address the filter puts in `X-Forwarded-For`, with port 0. Checked against the pinned ARM64 base's `uvicorn.middleware.proxy_headers` (no GPU): `X-Forwarded-For: 172.18.0.1` from 127.0.0.1 gives client `('172.18.0.1', 0)`; a client-supplied `203.0.113.7` and `X-Forwarded-Proto: https` would give `('203.0.113.7', 0)` and `https`, which the filter prevents. - Services without `authentication: bearer` are unchanged. ## Test proof ### `cargo ci` Run on Linux ARM64 (a shared 72-core host) at this PR's head `e40278c9e`, which merges `v1` `a5445c7fe` into the review-fix commit `c623b0a0e`: ``` ok fmt in 1s ok clippy in 20s ok build in 38s Summary [ 19.219s] 1404 tests run: 1404 passed, 175 skipped ok test in 25s ok schema in 0s ok bundle in 40s Summary [ 383.847s] 127 tests run: 127 passed, 49 skipped ok lifecycle in 389s All selected CI steps passed in 515s ``` The doctests passed (4). Local runs only report budgets: the unpartitioned lifecycle wall time (383.8 s) is over the 300 s per-partition budget, as on every split branch. This PR adds no lifecycle tests; the bearer `remote_service` tests, which require the routes label at plan, passed. `cargo ci` also passed at `25586e02e` (1401 tests) and at `c623b0a0e` (1404 tests, 565 s). ### New and changed tests: red on the parent, green here Commands: `cargo nextest run --locked -p <crate> --lib -E '<filter>'`. | Test | Without the change | On this branch | |---|---|---| | `nemoclaw-runtime` `vllm::runtime::routes::tests::*` (15 tests from `25586e02e`) | No filter on the parent, so the tests do not compile (`cannot find function allowed / serve / bind / supervise`, `unresolved import http_body_util`). Behavioral failures: the mutation table below and the next row. | 15 passed | | `…::routes::tests::vllm_records_the_connecting_address_instead_of_forwarding_headers_from_the_client` | FAIL with the filter forwarding the client's headers: `left: ["203.0.113.7", "198.51.100.1"]`, `right: ["127.0.0.1"]` | PASS | | `…::routes::tests::connections_beyond_the_limit_wait_until_a_served_one_closes` (review fix) | FAIL at `25586e02e`, with `serve` taking a limit it ignored: `the filter served a connection beyond its limit` | PASS | | `…::routes::tests::the_filter_raises_the_open_file_limit_and_leaves_descriptors_for_the_supervisor` (review fix) | FAIL: after lowering the soft limit to 1024, it stayed there (`left: Some(1024)`, `right: Some(1048576)`) | PASS | | `…::routes::tests::a_request_body_that_cannot_be_read_gets_bad_request` (review fix) | FAIL: a non-hexadecimal chunk size got `["502"]` and `{"error":"Bad gateway"}` | PASS | | `nemoclaw-sdk` `services::installers::vllm::tests::bearer_vllm_listens_on_loopback_beside_the_published_port_with_otherwise_unchanged_arguments` (changed, and renamed in the review fix) | FAIL at `c7de4c807`: bearer arguments had `--host 0.0.0.0`, `--middleware nemoclaw_vllm_routes.OpenAIRoutes`, `--port 18888` instead of `--host 127.0.0.1 --port 18889` | PASS (also checks 65535 → 65534) | All 18 route tests passed 30 of 30 `--stress-count` iterations. Two of them, the port-bind and operator-stop tests, asserted at `25586e02e` on an ephemeral port they had released, which another test in the same process could take; they failed 10 of 100 single-process runs (`cargo test` style). They no longer reuse a released port; after the fix the route tests failed 0 of 100 single-process runs, 0 of 40 with 16 test threads, and 0 of 30 beside 32 busy loops. The route tests drive the real filter on a loopback port against a stand-in vLLM that counts connections and records each request, and use raw sockets so no client library normalizes a target. They cover: each allowed route forwarded with `Authorization`, query and body intact; every X1 probe (`/invocations`, `/tokenize`, `/metrics`, `/v1/load_lora_adapter`, `/v1/models/<id>`, `/version`, `OPTIONS /v1/chat/completions`, `HEAD /health`, `//invocations`, `/v1/../invocations`, `/v1/%2e%2e/invocations`, `/./invocations`, `/health/../invocations`, `/v1/..%2finvocations`, `/V1/chat/completions`, absolute-form `http://127.0.0.1:PORT/invocations` and `…/v1/models`, `/invocations?x=/v1/`, `/v1invocations`, `/v1/chat/completions/../../invocations`, `//v1/chat/completions`) answered 404 with zero connections to vLLM; WebSocket and h2c upgrades, `CONNECT` and `OPTIONS *` refused; hop-by-hop headers removed both ways; a client's `X-Forwarded-For` replaced by its address and its `X-Forwarded-Proto` dropped; the first SSE event delivered while vLLM still holds the stream open; a client disconnect, before or during streaming, closing the vLLM connection; 502 when vLLM refuses; 400 for a non-hexadecimal or overflowing chunk size; five pipelined requests on one connection, including a request smuggled inside a body, each filtered; a stalled or silent connection closed by the header timeout; with a limit of two, a third connection waiting while two served ones stay open and served once one closes; the soft open-file limit raised to the hard limit, and the connection cap leaving 128 descriptors free at any limit; a port conflict failing `bind`; a failed filter stopping the vLLM process; and an operator stop closing the filter's open connections and its listener, which resets a connection waiting in the backlog. Each production property was also broken on its own in `routes.rs`: 22 mutations, 16 at `25586e02e` and 6 for the review fixes, grouped below; each made at least one route test fail. The operator-stop and port-bind mutations were run again against the changed tests and still fail them. | Mutation | Failing tests | |---|---| | `allowed` returns `true` (no filter) | matcher, X1 probes (`POST /invocations` got 200), upgrades, pipelining | | absolute-form not rejected | matcher, X1 probes (`GET http://…/v1/models` got 200) | | `Upgrade` not rejected | matcher, upgrades | | request or response hop-by-hop headers kept | hop-by-hop (`connection reached vLLM`, `x-upstream-hop reached the client`) | | response body buffered | streaming, client disconnect (first event never arrives) | | no header timeout | header timeout | | connect error not mapped to 502 | 502 | | filter failure ignored by supervision | failed filter (vLLM stand-in kept running) | | filter not stopped when supervision ends | operator stop (idle connection stays open) | | `bind` on `127.0.0.1` | port bind (not all interfaces) | | query or `Authorization` dropped | allowed routes | | connections detached from the filter | operator stop (idle connection stays open) | | a client's `X-Forwarded-For` or `X-Forwarded-Proto` kept | forwarding headers | | no connection limit, or a slot released at accept instead of when the connection closes | connection limit (`the filter served a connection beyond its limit`) | | soft open-file limit not raised | open-file limit (`left: Some(1024)`) | | cap ignores the reserve, or counts one descriptor per connection | open-file limit (fails at 130 descriptors) | | unreadable request body mapped to 502 | bad request (`["502"]`) | `ambiguous_request_framing_never_reaches_vllm` is characterization of hyper 1.11.1, not a red test: with both `Content-Length` and `Transfer-Encoding: chunked`, hyper drops the length, decodes the chunked body and closes the connection after the response, so vLLM gets one chunked request and the trailing `/invocations` is never parsed; `Transfer-Encoding: gzip` with a length, two different lengths, and `Transfer-Encoding` on HTTP/1.0 get hyper's 400 without reaching vLLM. The tests removed with the Python filter: `runtime::tests::only_vllm_runtime_contexts_receive_the_shared_routes_and_their_image_build_check` (with `stage_workload_files`), and the reserved-name half of `artifacts::artifact_inputs_cannot_overwrite_retained_build_or_workload_inputs`, which is back to `v1`'s `artifact_inputs_cannot_overwrite_the_retained_build_manifest`. The label tests in `nemoclaw-sdk` and `nemoclaw-provider`, and the lifecycle `remote_service` bearer fixtures, are unchanged and pass. ### Connection flood A throwaway ignored test, not committed, ran `serve` on a fixed port, `routes::supervise` with `/bin/sleep` as vLLM, and `run_owned`'s once-a-second memory sampler. Another process opened up to 1,100 idle connections to the port, sending nothing. | Tree | `prlimit --nofile` | Result | |---|---|---| | `25586e02e` | `1024:524288` | after 7 s, supervision returned `Protection("memory observation failed: host memory is unobservable; managed service stopped; reapply required")` and the stand-in was stopped | | this branch | `1024:524288` | soft limit raised to 524288, cap 256; after 40 s supervision was still running with 269 open descriptors, and the stand-in was alive | | this branch | `1024:1024` | soft limit stays 1024, cap 256; after 40 s supervision was still running with 269 open descriptors, and the stand-in was alive | ### Retained source and image - **Offline rebuild.** The ignored `nemoclaw-build` test `runtime::tests::retained_runtime_rebuilds_offline_without_protobuf_or_a_dependency_cache` passed in 51.9 s at `25586e02e` and in 52.6 s at `c623b0a0e`, whose dependencies are unchanged. It vendored and compiled `hyper` 1.11.1, `hyper-util` 0.1.20, `http-body-util` 0.1.5 and `httpdate` 1.0.3 from the retained archive with no dependency cache and no protoc. - **Dependency closure.** `cargo tree -p nemoclaw-runtime -e normal` for `aarch64-` and `x86_64-unknown-linux-gnu` lists 175 packages, compared with 174 at `c7de4c807`; `httpdate` 1.0.3 is the only addition. - **Image.** The table below describes the image built at `25586e02e`, before the review fixes, which did not change the Dockerfiles. The live run below used an image built at `c623b0a0e` (`sha256:62d0c76cd07c…`), checked the same way for route files and its retained `routes.rs`. `cargo run --locked -p nemoclaw-build --no-default-features -- runtime runtimes/vllm/build.json` at `25586e02e` finished in 532 s and printed `Runtime image loaded: nc-prototype-vllm@sha256:6adb9cc9088b7be5f945d1032b91672e84ebe27f0d840027cc14c0abb6492871`. | Check | Observed | |---|---| | Image ID and labels | `sha256:6adb9cc9088b…`, arm64; `org.nemoclaw.inference.routes=openai-v2`, `org.nemoclaw.inference.authentication=bearer-v1`, `org.nemoclaw.backend=vllm`, `org.nemoclaw.runtime.spec=v1` | | Build steps | `[2/5]`–`[5/5]` are the four `COPY` lines; no `RUN` step | | `docker history --no-trunc` | NemoClaw adds 4 `COPY`s, `ENTRYPOINT`, `CMD` and `LABEL`; no line names `nemoclaw_vllm_routes` or `test_vllm_auth` | | Files (`docker run --network none`) | `/opt/nemoclaw/source` holds only `Dockerfile`, `LICENSE`, `NOTICE.md`, `build.json`, `supervisor-source.tar.gz` and `supervisor.json`; `find /` finds no `nemoclaw_vllm_routes*` or `test_vllm_auth*`; Python cannot import `nemoclaw_vllm_routes` | | Supervisor | The binary contains the filter's failure message; the source archive contains `crates/nemoclaw-runtime/src/vllm/runtime/routes.rs` | ### Not run on this branch - An image build for `vllm-amd64` and `qwen38`. Their Dockerfiles differ from `v1` only by the label. - A client that holds all 256 connections while vLLM loads. The readiness probe goes through the filter with a 1 s timeout, so such a client can delay readiness; held until the startup budget runs out, that would stop vLLM. This follows from the design and was not tested. ### Live evidence (not qualification; #12732 stays open) `split/2-vllm-route-filter` @ `c623b0a0e` (the Rust route filter), with this head's `dist/linux_arm64` bundle (`0.1.0-dev.bc051796453ca7cb`). Run on 2026-10-13 on one GB300 (ARM64) with the local Docker engine (containerd image store) and a Docker managed gateway. **Image build from this head.** I ran `cargo run --locked -p nemoclaw-build --no-default-features -- runtime runtimes/vllm/build.json` in a clean clone at `c623b0a0e`. It exited 0 after 688 s. - Result: `nc-prototype-vllm@sha256:62d0c76cd07c…`, labelled `org.nemoclaw.inference.routes=openai-v2`, `authentication=bearer-v1` and `backend=vllm`. - The image has no `nemoclaw_vllm_routes*` or `test_vllm_auth*` file. - The `routes.rs` in the image's retained supervisor source is byte-identical to this head's file. | Check | Observed | |---|---| | Plan with the `openai-v1` image | Rejected in 1 s: `Runtime image compatibility check failed runtime image platform or required backend, recipe, authentication, or route-restriction (org.nemoclaw.inference.routes) labels are incompatible; …` | | Plan with the new image | `Plan incomplete · 7 known resource changes` (EXIT 0) | | Apply: bearer vLLM `Qwen/Qwen3-4B`, profile `gb300`, port 18899, OpenClaw sandbox | Took 336 s, including the model download. Runtime `nvidia`, 1 GPU request. | | Processes in the model container | PID 1 is `nemoclaw-runtime`. vLLM runs with `--host 127.0.0.1 --port 18900`. No process has `--middleware`. | | TCP listeners (read from `/proc/net/tcp`) | `0.0.0.0:18899` belongs to PID 1, `nemoclaw-runtime`. `127.0.0.1:18900` belongs to vLLM's `api_server`. The container publishes only port 18899, bound to 172.30.151.1. | | Key file | Mode 600, 1 link, 64 bytes | | X1 HTTP probes inside the container, against port 18899 (14) | `/v1/models` and `/v1/chat/completions` returned 401 without the key and 200 with it. `/v1/completions` with the key: 200. `GET /health`: 200. These returned 404, even with the key: `/invocations`, `/tokenize`, `/metrics`, `/v1/load_lora_adapter`, `/v1/models/<id>`, `/version`, `OPTIONS`, `HEAD /health`. | | X1 raw-socket bypass probes (24) | All 404. **Unexpected completions: 0** | | Routes this head adds | `POST /v1/responses`, `/v1/messages` and `/v1/messages/count_tokens` returned 401 without the key and 200 with it. | | Other methods and request forms, all sent with the key | All returned 404: `HEAD /v1/models`, `OPTIONS /v1/models`, `CONNECT 127.0.0.1:18900`, a WebSocket upgrade on `GET /v1/models`, an h2c upgrade on `GET /health`, and an absolute-form `GET http://…/health`. Each 404 has `content-type: application/json` and the body `{"error":"Not found"}`. `GET /health?x=1` returned 200. | | Do rejected requests reach vLLM? | No. vLLM's access log has 0 lines for any rejected route. | | Can other hosts reach vLLM's port 18900? | No. Inside the container, `172.30.151.3:18900` refuses connections. From another container on the deployment network, port 18899 answered `/health` 200, `/v1/models` 401, and `/metrics` and `/v1/load_lora_adapter` 404. Port 18900 at `172.30.151.3` refused the connection (curl exit 7). From the host, `172.30.151.1:18900` refused. | | Streaming inside the container | A `stream: true` request through port 18899 returned `text/event-stream`, chunked. 115 events arrived, the first at 121 ms and the last at 4079 ms. | | **OpenClaw agent turn** through OpenShell `ExecSandbox` on the Docker gateway | Succeeded in 16 s. The sandbox's `baseUrl` is `http://172.30.151.1:18899/v1`. Qwen3-4B called the `tts` and `message` tools, then replied "I'll help you with that. Let me check the necessary steps…". vLLM logged 3 × `POST /v1/chat/completions 200` from 172.30.151.1, through the filter. | | Streaming from the sandbox | The sandbox's Python sent the sandbox's `openshell:resolve:env:` credential placeholder as the key. The response was 200 `text/event-stream`. 115 events arrived: the first at 122 ms, then a median gap of 32.5 ms, the last at 3888 ms. | | Other routes from the sandbox (OpenShell injects the key) | `GET /v1/models` returned 200. The filter returned 404 for `/v1/models/<id>` and `/v1/load_lora_adapter`. OpenShell's own policy returned 403 `policy_denied` for `/metrics`, `/tokenize`, `/invocations`, `/version` and `/health`, so they never reached the filter. | | Bearer key in the sandbox environment (23 vars) / `/sandbox/.openclaw` (21 files) / state files / model log | **0/0/0/0** | | Destroy | `Destroy complete · 12s`. The model and agent containers were removed. The gateway-init container, the network and the gateway, model and auth volumes were retained. GPU back to 0 MiB. | Notes: - Every apply ended with the known upstream "Fabric readiness could not be established" (`fabric_health_unsupported`). This is not a failure of this PR. - An earlier image for this PR, `sha256:6adb9cc9…`, was built from `25586e02e`, before the hardening commit, and its `routes.rs` differs. This run used a new image built from `c623b0a0e`. - vLLM's `EngineCore` process also listens on six random ports on the container address, for torch.distributed and ZMQ. These ports do not serve HTTP. vLLM opens them with or without the filter, and this PR does not change them. - The probes run with the container's own `python3`, the interpreter vLLM uses. They are test scaffolding, not repository code. - Turns and sandbox probes went through a debug `ExecSandbox` tool, built against this head's SDK, that is not part of this PR. For the Docker gateway it connects the same way the provider does: to the plaintext loopback endpoint, with no credential. - The sandbox sent 6 `POST /v1/chat/completions` requests: 3 for the turn and 3 for streaming. The first two streaming attempts got 200 from vLLM but printed nothing, because the probe buffered its output and then waited on the kept-alive connection. The streaming row shows the rerun, sent with `Connection: close`. - The OpenClaw image is `nc-pr12736s8@sha256:dadc747a…`, built from `split/8`. #### On Kubernetes, through the stack The stack top #13063 with this filter merged (`3e25941f5`), its own bundle, and a vLLM image built from that head (`sha256:ff09fb4b79a3…`, same `routes.rs`), on kind `nvkind-demo` (one GB300): - The model Pod has one container. `0.0.0.0:18888` belongs to `nemoclaw-runtime`; vLLM listens only on `127.0.0.1:18889`, and port 18889 on the Pod IP refuses connections. The NetworkPolicy still blocks a plain Pod in the namespace. - 14 HTTP and 24 raw-socket probes in the Pod: **0 unexpected completions**; the extra routes, methods and upgrade checks match Docker. Streaming: 115 events, the first at 136 ms. - **OpenClaw turn** through the OpenShell supervisor: succeeded in 17 s, with 4 × `POST /v1/chat/completions 200`, all from the supervisor Pod. **Hermes turn at 64K context**: `kind GPU ok.` in 3 s; Hermes's `GET /v1/models` context probe gets 401 as before. - The bearer key appears 0 times in the sandbox environment, export, state files, ConfigMaps and model Pod log. Destroy kept the model and credential PVCs; GPU back to 0 MiB. ## Depends on and merge order - Base: `v1`. This PR has no dependencies and can merge in parallel with #13056, #13058 and #13059. - #13062 needs this PR in `v1`, because cluster bearer images need the routes label. #13062 also adds the cluster parts of this change: - the label in the SDK image-metadata check, with its message (the rest of X1-N3); - the Kubernetes wording in `docs/kubernetes.md`; - the `docs/inference.md` sentence about the supervisor-only NetworkPolicy; - a one-line `docs/kubernetes.md` fix from the move to Rust: WebSocket upgrades now get 404 like any other refused request. Managed services are not supported on Kubernetes in `v1`, so this PR leaves those out. Split from #12736. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…el services (#13058) Docker-managed vLLM and Ollama services get CPU and memory limits, and a service-level `updatePolicy` that stops plan and apply from replacing a running model container unless the user opts in. ## Why On `v1`, every managed model container on Docker runs with a fixed 104 GiB memory limit and no CPU cap. An image, model, or serving change replaces the running container without asking, so a routine re-apply, for example from automation that bumps an image, can take a serving model down. This PR also carries the fixes for the review findings on the limits commit of #12736 (review at 487cfc8, items N1–N7): | Finding | Problem | Fixed here by | |---|---|---| | CL-1 / N1 (medium) | Lowering `memoryLimitGiB` resized the running model in place under `Preserve` and could OOM-kill it | A `memory-limit-gib` label forces replacement, and `preserve_docker_models` refuses an in-place memory decrease | | CL-2 / N2 | The new default had no release note and no CLI hint | Release-notes entry, and a `help` field on `DockerModelUpdateRefused` naming `spec.services.<name>.updatePolicy` | | CL-5 / N5 | A 1 s CFS period gave up to 1 s throttle stalls | 100 ms period, `quota = millis × 100`, raised to the kernel's 1000 µs minimum | | CL-6 / N6 | Docs said `Preserve` blocks limit changes when Docker applied memory in place; no `/proc` watchdog caveat; no CFS period | `inference.md`, `usage.md`, `provider.md` updated | | CL-7 / N7 | Tests accepted the in-place memory update and never checked provider refresh | Unit cases for memory decreases and Podman with SSH placement; e2e steps for the stopped-container refresh and memory refusal | CL-3 and CL-4 concern the legacy `kubernetes.*` field migration, which is not part of this split. ## What changes - **Configuration.** `container.cpuLimitMillis` and `container.memoryLimitGiB` on `kind: vllm` and `kind: ollama`, and a per-service `updatePolicy` (`Preserve`, the default, or `Recreate`). The new `ServiceUpdatePolicy` type lives in `services/update_policy.rs` and is exported as `nemoclaw_sdk::services::ServiceUpdatePolicy`. The schema default comes from `registry::constrain_schema`. - **Validation.** An explicit memory limit must cover `sharedMemoryGiB` under private IPC and the inline recipe's `preparationMemoryGiB`. A zero CPU limit is refused before native container creation. - **Docker compilation** (`docker_compute.rs`, `managed/spec.rs`). - A CPU limit sets `cpu_period = 100000` and `cpu_quota = cpuLimitMillis × 100` (at least 1000) in the OpenTofu resource and in the native `HostConfig`. - A memory limit sets `memory` and `memory_swap`. - Labels `nemoclaw.nvidia.com/cpu-limit-millis` (when a CPU limit is set) and `nemoclaw.nvidia.com/memory-limit-gib` (when memory differs from 104 GiB) force replacement. Without them, the pinned Docker provider v4.6.0 would update limits in place, drop the CFS quota, and could OOM-kill the model by lowering memory. - Omitted limits add no CPU settings or labels and keep the 104 GiB memory limit; `Process` omits `cpu_limit_millis` when unset, so existing specifications serialize unchanged. - **Update safety** (`deployment/runtime.rs`). `preserve_docker_models` runs during runtime observation for plan and apply. Under `Preserve` it refuses a plan that deletes a running or incompletely observed model container, or lowers its `memory`/`memory_swap`, with the new `Error::DockerModelUpdateRefused`. Missing containers, containers the provider refreshes as stopped (`must_run = false`), deposed instances, the gateway, and the Ollama proxy are not affected. - **CLI.** The refusal carries a `help` line in text and JSON output that names `spec.services.<name>.updatePolicy: Recreate` and links the new docs section. - **Docs.** New "Set Container Limits and Update Policy" section in `docs/inference.md`; updates to `usage.md` (change table, Podman note), `provider.md` (generated Docker attributes), `troubleshooting.md`, and a release-notes entry. Schema and `docs/reference/configuration.md` regenerated. ## Breaking or user-visible changes - **Docker model updates default to `Preserve`.** Changing a managed vLLM or Ollama service's image, model, serving settings, `cpuLimitMillis`, or `memoryLimitGiB` now fails at plan and apply while the container runs: ``` Docker model service 'qwen' is preserved by updatePolicy: Preserve; replacing a running or incompletely observed container requires explicit updatePolicy: Recreate, which permits downtime if the replacement cannot start; resources retained ``` Set `spec.services.<name>.updatePolicy: Recreate` to allow the replacement and its downtime. Changing only the policy does not restart the container. - Declaring `memoryLimitGiB: 104` (the default) does not replace an existing container. - Rust API: `managed::Process` gains `cpu_limit_millis: Option<u32>`, and `Error` gains `DockerModelUpdateRefused { service }`. ## Test proof `cargo ci` on linux_arm64 (aarch64, `CARGO_BUILD_JOBS=16`), tree `b63292802` (commit `c8166f739`, on top of `642211537`, which merges `v1` a5445c7): ``` ok tools in 0s ok fmt in 1s ok clippy in 21s ok build in 37s Summary [ 18.905s] 1392 tests run: 1392 passed, 177 skipped ok test in 24s ok schema in 0s ok bundle in 64s Summary [ 424.928s] 129 tests run: 129 passed (1 slow), 49 skipped ok lifecycle in 430s All selected CI steps passed in 580s ``` The test step also ran 4 doctests, all passing. `nemoclaw-build docs` (local link and heading check) also passes. The slow test is `nemoclaw-provider::contract service_readiness::standalone_proxy_readiness_rechecks_identity_and_credentials_without_sdk_or_gateway` (10.3 s against its 10 s limit). This PR does not change that binary, and `v1` runs the test in 9.9 s on this host. ### New tests: red on `v1`, green here "v1 code" means every production file in this PR reset to `v1` 29bb057, with this PR's test files kept. "Hunk removed" means the branch with one production hunk taken out or disabled. Each run was restored to the commit afterwards. | Test | v1 code | Hunk removed (branch) | Branch | |---|---|---|---| | `deployment::runtime::tests::docker_model_updates_preserve_running_containers_unless_recreation_is_explicit` | FAIL: `updatePolicy` is an unknown field | FAIL without the `preserve_docker_models` call; FAIL without the memory-decrease check (CL-1) | PASS | | `managed::spec::tests::zero_cpu_limit_is_rejected_before_native_container_creation` | FAIL: unknown field `cpu_limit_millis` | FAIL without the `cpu_limit_millis != Some(0)` check | PASS | | `managed::spec::tests::legacy_service_process_keeps_its_fields_without_cpu_limit` | does not compile (E0609, no field `cpu_limit_millis` on `Process`) | FAIL without `skip_serializing_if` on `cpu_limit_millis` | PASS | | `runtime_compile::docker_model_limits_reach_opentofu_and_native_container_configuration` | FAIL: `container.cpuLimitMillis` is an unknown field | FAIL without the memory-limit label; FAIL without the CPU quota on the Docker resource | PASS | | `runtime_compile::omitted_docker_model_limits_keep_independent_legacy_defaults` | does not compile (E0609) | FAIL without the memory-limit label; FAIL without `skip_serializing_if` | PASS | | `runtime_compile::docker_model_update_policy_does_not_change_runtime_resources` | FAIL: `updatePolicy` is an unknown field | FAIL when the policy is made to change the runtime process (a mutation; there is no hunk to remove) | PASS | | `runtime_compile::portable_container_memory_limits_cover_shared_memory_and_recipe_preparation_on_docker` | FAIL: `container.memoryLimitGiB` is an unknown field | FAIL without `validate_memory` | PASS | | `formatting::tests::docker_model_refusal_names_the_service_update_policy_field` (nemoclaw-cli) | does not compile (E0599, no variant `DockerModelUpdateRefused`) | FAIL without the `help` arm | PASS | Commands: `cargo nextest run --locked -p nemoclaw-sdk -p nemoclaw-cli --profile ci -E 'test(=…)'` for the unit and integration tests. Each "v1 code" run first compiled out the tests that cannot compile there (`#[cfg(any())]`) so the rest of the binary could run. ### Lifecycle-only tests (`remote_service`, run with the bundle from `cargo ci bundle`) | Test | Branch | Time | |---|---|---| | `remote_service::remote_model_reapply_and_drift_keep_bindings_and_stop_on_observation_failure` | PASS | 85.6 s | | `remote_service::remote_ollama_recovers_reapplies_and_stops_on_observation_failure_keeping_data` | PASS | 82.9 s | | `remote_service::managed_bearer_credentials_survive_recovery_reapply_and_replacement_outside_state` | PASS | 73.4 s | | `remote_service::managed_bearer_cleanup_recovers_damage_keeps_bindings_and_teardown_accepts_both_identities` | PASS | 73.0 s | | `remote_service::managed_pi_applies_without_generation_and_refused_sandbox_changes_keep_intent` | PASS | 60.7 s | | `remote_service::remote_ollama_preserve_refuses_image_and_memory_changes_and_recreate_plans_replacement` | PASS | 42.8 s | | `remote_service::remote_vllm_preserve_refuses_image_change_and_recreate_plans_replacement` | PASS | 26.4 s | | `remote_service::partial_runtime_destroy_retains_storage_without_creating_network` | PASS | 10.3 s | | `remote_service::partial_ollama_destroy_retains_storage_without_creating_network` | PASS | 10.0 s | | `remote_service::unverified_ollama_images_are_checked_after_pull_before_storage` | PASS | 9.2 s | | `remote_service::unverified_vllm_images_are_checked_after_pull_before_storage` | PASS | 9.0 s | Every scenario now deploys with `cpuLimitMillis` (1250 for vLLM, 10 for Ollama) and `memoryLimitGiB: 64`. What this PR adds to them: - Each apply through the shared `Scenario::apply` helper checks `CpuPeriod`, `CpuQuota`, `Memory` and `MemorySwap` in the container's `HostConfig`, and its `memory-limit-gib` label, for vLLM and, in `remote_ollama_preserve_…`, for Ollama. - An image change (vLLM and Ollama) and a memory decrease (Ollama) are refused at plan and apply, leaving the engine state, runtime state and `intent.json` unchanged, then planned as a replacement under `Recreate`. These steps run in their own scenarios, `remote_vllm_preserve_…` and `remote_ollama_preserve_…`, each ending with the no-probe check, so `remote_model_…` and `remote_ollama_recovers_…` keep close to `v1`'s steps and time. - A stopped vLLM container, which the provider refreshes as `must_run = false`, is replaced under `Preserve`. - The bearer key survives an image replacement under `Recreate`. Reds: each run rebuilt the bundle with `cargo ci bundle` from the modified tree, then ran `NEMOCLAW_TEST_BUNDLE=$PWD/dist/linux_arm64 cargo nextest run --locked --workspace --all-targets --profile lifecycle --run-ignored only -E 'test(/^remote_service::/)'` on all 11 `remote_service` tests. - **v1 code** (`v1` a5445c7 with its own bundle, and this branch's `remote_service.rs`): all 11 fail at scenario setup, because `v1` rejects `container.cpuLimitMillis` ("unknown fields are not allowed"). - **Without the `preserve_docker_models` call:** `remote_vllm_preserve_…` and `remote_ollama_preserve_…` fail, because the plan they expect to be refused succeeds. The other 9 pass: `managed_bearer_credentials_…` uses `Recreate`, and `remote_model_…` and `remote_ollama_recovers_…` no longer change the image or memory. - **Without the memory-limit label:** the five scenarios that apply through `Scenario::apply` (`remote_model_…`, both `…_preserve_…` tests, `managed_bearer_cleanup_…` and `managed_pi_…`) fail the `memory-limit-gib` label check after their first apply. In a diagnostic run that applied `remote_ollama_preserve_…` without that check, it failed because a memory decrease under `Recreate` plans an in-place `["update"]`, not a replacement. That in-place update is the CL-1 failure. - **With stopped containers also protected** (the `must_run != false` clause removed): `remote_model_…` fails, because the plan for its stopped container is refused with `DockerModelUpdateRefused`. The other 10 pass. **Timing budget.** On linux_amd64, this PR's first CI run took 91.3 s for `remote_ollama_recovers_…`, over the 90 s per-test lifecycle limit in `.config/test-budgets.yaml`, and 81.0 s for `remote_model_…`; `v1` runs them there in 65.7–68.7 s and 67.5–68.7 s. This PR had added an image change and a memory decrease to `remote_ollama_recovers_…`, and `Preserve` refusals to `remote_model_…`'s existing image-change step. Those steps now run in `remote_vllm_preserve_…` and `remote_ollama_preserve_…`, as #13042 split the deployment lifecycle test into explicit scenarios; no limit changes. In three runs of the `remote_service` tests on this host, interleaved with `v1` a5445c7's: | Test | This PR | `v1` | Estimate on linux_amd64 | |---|---|---|---| | `remote_model_…` | 85.0–85.3 s | 86.4–87.3 s | 67 s | | `remote_ollama_recovers_…` | 86.0–87.0 s | 86.0–87.4 s | 67 s | | `remote_ollama_preserve_…` | 42.7–43.1 s | — | 33–39 s | | `remote_vllm_preserve_…` | 25.5–26.3 s | — | 20–24 s | Each estimate multiplies this PR's time by `v1`'s linux_amd64 time over its time here: 0.77–0.79 for the two existing tests, and 0.77–0.91 (the range across `remote_service` tests) for the new ones. CI runs the lifecycle suite in two slices with a 300 s budget each. Run the same way here (`cargo ci lifecycle --partition slice:N/2`, twice each), this branch's slices took 208.9–211.1 s and 218.0–226.6 s; `v1`'s took 208.9–209.0 s and 198.7–201.7 s here and 201.6–206.0 s and 184.2–186.8 s on linux_amd64. Scaled the same way, this branch's slices would take about 204 s and 206 s there. ## Depends on / merge order - Base: `v1` (a5445c7 is merged into this branch). No dependencies; merges in parallel with #13056, #13057 and #13059. - It shares files with #13057 (`remote_service.rs`, `vllm/mod.rs`) and #13059 (`formatting.rs`). `git merge-tree` of this branch with the planning slices for #13056, #13057, #13059 and #13060 reports no conflicts. - #13061 needs this PR in `v1`, because its cluster settings use `ServiceUpdatePolicy`. #13062 adds back the Kubernetes and OpenShift wording removed from this PR's doc comments and docs, and the `kubernetes.is_none()` guards in `preserve_docker_models`. ### Live evidence (not qualification; #12732 stays open) `split/3-docker-container-limits` @ `fe97763b7`, this branch's `dist/linux_arm64` bundle (`0.1.0-dev.2857ec70977bc92c`). 2026-10-12, one GB300 (ARM64), local Docker engine, Docker managed gateway. **Setup.** A copy of #12736's review deployment `docker-openclaw` with a fresh UID and state directory, on 172.30.142.0/24 port 17842: - managed Ollama `qwen3:0.6b`, profile `gb300`, image `nc-prototype-ollama@sha256:dea377de…`; - `container.cpuLimitMillis: 4000`, `container.memoryLimitGiB: 48`; - an OpenClaw sandbox (image built from `split/8`; `image/` is identical to `v1`). | Check | Observed | |---|---| | Plan | `Plan incomplete · 6 known resource changes` | | Apply | Ollama created in 1 s, agent runtime in 17 s. Apply ended after 102 s with the known readiness message. | | `docker inspect` of the model container | `CpuPeriod=100000`, `CpuQuota=400000` (4000 millis × 100), `NanoCpus=0`, `Memory=51539607552` (48 GiB), labels `nemoclaw.nvidia.com/cpu-limit-millis=4000` and `memory-limit-gib=48`, runtime `nvidia` | | `memoryLimitGiB` 48 → 40 under the default `Preserve`: plan | EXIT 1: `Docker model service 'qwen' is preserved by updatePolicy: Preserve; replacing a running or incompletely observed container requires explicit updatePolicy: Recreate, which permits downtime if the replacement cannot start; resources retained`, plus the `DockerModelUpdateRefused` help (below) | | Same change: apply | EXIT 1: `No runtime resources changed.` plus the same help | | Container after the refused change | Same container ID; `Memory` still 48 GiB | | Same change with `updatePolicy: Recreate` | 68 s. `ollama/qwen: delete complete`, then `create complete`. New container ID with `Memory=42949672960` (40 GiB), label `memory-limit-gib=40`, `CpuQuota=400000` unchanged. The next plan: `No resource changes planned.` | | Destroy | `Destroy complete · 10s`; GPU back to 0 MiB | The help printed at both plan and apply: `To replace the running model container, set spec.services.qwen.updatePolicy: Recreate and apply again; the model is unavailable until the replacement starts. See docs/inference.md#set-container-limits-and-update-policy.` Notes: - Both applies ended with the known upstream "Fabric readiness could not be established" (`fabric_health_unsupported`). This is not a failure of this PR. - Destroy retained the gateway-init container, the network and the `gateway-data` and `ollama-qwen-data` volumes, as designed. Split from #12736. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR-6 now includes v1 337d668 (#13104), which moves the OpenClaw and Hermes context advisory from `Deployment::run` into `deployment::context_advisory`. deployment/mod.rs conflicted in `Deployment::run`: PR-7 adds the cluster network-boundary warning directly before the inline advisory that #13104 replaced. The resolution keeps #13104's `context_warnings` call and puts PR-7's loop before it, so plan and apply still report cluster warnings before context warnings. PR-7 changes no advisory logic or tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…vices Adds a test that `preserve_docker_models` refuses a Docker vLLM or Ollama model under `updatePolicy: Preserve`, but not a cluster model service with the same name, kind, and policy. Production code is unchanged. ## Why Merging #13105 into PR-7 replaced PR-7's `kubernetes.is_none()` guards on the vLLM and Ollama match arms with one leading `if service.kubernetes().is_some() { continue; }`. No test covered either form: removing the guard left every test passing. ## Change `docker_model_preservation_refuses_docker_models_but_not_cluster_models_of_the_same_name` pairs `examples/station/vllm.yaml` with `crates/test-support/cluster-models/vllm.yaml`, and `examples/managed-ollama-gpu.yaml` with `crates/test-support/cluster-models/ollama.yaml`. Each pair has a `Preserve` service `qwen` of one kind. For a replacement, a deletion, and an in-place memory decrease of a running container at the Docker address that `qwen` derives, `runtime_observations` returns `DockerModelUpdateRefused { service: "qwen" }` for the Docker document and succeeds for the cluster document. ## Validation - With the `continue` removed, the test failed: the cluster document returned `DockerModelUpdateRefused { service: "qwen" }`. Excluding only cluster vLLM, or only cluster Ollama, also failed it, and skipping every service failed the Docker assertion. - With the guard, the 16 `deployment::runtime::tests` passed, and `cargo clippy --locked --workspace --all-targets -- -D warnings` passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR-6 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-7. PR-7 extends the `bound_fields` code from #13126 in `crates/nemoclaw-tofu` and `crates/nemoclaw-provider/tests/support`; those files are the same in #13060 and v1, so PR-7's changes apply unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR-6 merged v1 up to #13153 and now requires `get pods/exec` in its access review. This merge brings both into PR-7. One conflict: `ResourceAdapter::checked` in `crates/nemoclaw-tofu/src/resource.rs`. v1 (#13153) first copies carried fields from the prior row; PR-7 then derives `owner` and `generation` through `row`. The resolution keeps both, in that order, so derivation sees the carried fields. PR-7's change is otherwise unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#13131 superseded the stacked cluster work: - the `nemoclaw` provider is gone (#13224); - one OpenTofu root replaces the separate state files (#13286); - off Docker, the platform owns keys and readiness (#13225, #13226); - NemoClaw adds no address policy (#13232). This merge takes v1's tree, so the branch now carries only the in-cluster routing change that follows. #13061 and #13062 are parked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… servers (#13063) Sandboxes on a Kubernetes or OpenShift gateway can now use a model server that the user runs in the same cluster, addressed by its Service name: `http://<service>.<namespace>.svc.cluster.local:<port>/v1`, optionally with a key. NemoClaw places nothing on the cluster. This is the "Placing servers" model of #13131: the platform owns placement, readiness and the key. The PR also fixes a `v1` bug that the key needs: on a managed Kubernetes gateway, any provider with a `credential` failed at apply with "observation authentication failed". Supersedes the earlier stacked version of this PR; #13061 and #13062 are parked. ## Why Before this PR, YAML that names an in-cluster Service failed in two places (both seen by compiling `examples/kubernetes/managed-development.yaml` with the endpoint changed): - **Without `credential`:** plan and compile failed with "inference discovery inputs are invalid". The control-host model-catalog read accepts plain HTTP only to a literal loopback or private address (`nemoclaw-backend` `validate_endpoint`), and the machine running NemoClaw usually cannot resolve cluster DNS anyway. - **With `credential`:** the schema rejected the document, because `config/schema/validation.rs` forbade `credential` on every `http:` endpoint. A YAML user could reach an in-cluster server only by a literal ClusterIP and without a key, and that address changes when the Service is recreated. HCL users can already do this with a literal `openshell_inference` server (`docs/inference.md`, "Supply the Key on Other Platforms"). The first live run of the keyed form on kind then failed at apply in `v1` itself, before OpenShell received the provider (fix in commit 4 below). ## What changes Six commits and three merges of `v1`. The first merge took `v1`'s tree unchanged (parents `46eea8340` and `ef3115d4e`). The second, `2fa69d20a`, merges `v1` at `7d7772eda` (#13411), and the third, `c9136276a`, merges `v1` at `64c384eff` (#13413); their conflicts and test adaptations are listed after the commits. 1. **Route without a catalog read** (`feat(sdk): route Kubernetes sandboxes to in-cluster Services`) - `inference_discovery::is_cluster_service_endpoint` accepts exactly `http://<service>.<namespace>.svc.cluster.local:<port>` with an optional path: a DNS-1035 service label, a DNS-1123 namespace label, and an explicit, nonzero, unpadded port. Nothing else matches. - `EndpointRequest::for_provider` skips the catalog read for that form when `gateway.runtime.provider` is `kubernetes` or `openshift`. Plan (`endpoint_requests`) and onboarding (`inference_request_for_document`) both use it, so they ask the same questions. - Docker and Podman gateways, and every other endpoint, keep their reads; the Service form still fails planning on Docker and Podman. - Compile needed no change. The graph registers the literal `openshell_inference` server with that endpoint, gives the sandbox an FQDN rule without `allowed_ips` or `cluster_grants`, and passes the endpoint to Fabric as `base_url`. 2. **Optional key** (`feat(sdk): accept a key for in-cluster Service endpoints`), a separate commit so it can be dropped (Q1 below) - `credential` is allowed on the Service form only when the gateway runtime is `kubernetes` or `openshift`. The provider definition still forbids a key on every other `http:` endpoint, and a document-level rule forbids it on the Service form with Docker or Podman, in all five places a provider can be declared. - Both rejections name the rule instead of a bare `not`. 3. **Docs and examples** (`docs(kubernetes): use a model server that runs in the cluster`) - `docs/kubernetes.md`, "Use a Model Server in the Cluster": the endpoint form and its limits, then a procedure that runs NemoClaw's vLLM runtime from `vllm_runtime`'s spec, `launch` and `requirements`: a Secret for the key, a ConfigMap for the spec, a PVC, a `Recreate` Deployment with `/health` startup and readiness probes, a ClusterIP Service, an ingress NetworkPolicy that admits only OpenShell supervisor Pods, and waiting for the rollout, because apply does not check the server. - `examples/kubernetes/in-cluster-vllm.yaml` (endpoint and `credential`) and `in-cluster-ollama.yaml` (endpoint only). - `docs/inference.md` (service-mode row, the HTTPS exception, link from "Supply the Key on Other Platforms"), `docs/limits.md` (the #12641 row now covers only services NemoClaw places) and `docs/security.md` (who can read the key; the plain-HTTP exception). - `schemas/nemoclaw-v1alpha1.schema.json` and `docs/reference/configuration.md` are regenerated. 4. **Provider fix** (`fix(openshell-provider): resolve credential variables on managed Kubernetes gateways`) - **Why it is here:** the key from commit 2 cannot reach OpenShell on a managed Kubernetes gateway without it. It also fixes every other provider with a `credential` on such a gateway, HTTPS included. - **Failure:** since #13264, the provider reaches a managed Kubernetes gateway through a port-forward and resolved every secret reference through `ForwardSecrets`. That map holds only the forward's bearer token and TLS file paths, named `token`, `ca`, `certificate` and `key`. A provider's `credential_env`, such as `QWEN_INFERENCE_KEY`, missed it, so apply failed with "observation authentication failed" and the gateway received no `CreateProvider`. A `credential_env` named `token` resolved, and sent the gateway's bearer token to OpenShell as the provider's credential. - **Change:** the forward's secrets authenticate only the connection. Objects resolve their references from the environment, as on a direct connection, so no reference reaches the forward's values, whatever its name. `OpenShell::connect_with_credentials` (crate-private) takes the two resolvers separately; `connect_with_services` passes the same one for both, so direct connections are unchanged. A missing or empty variable still fails with `Authentication`. - The first live run used a scratch fix that fell back to the environment for names the forward lacks. This commit does not do that: under that approach `token` still resolved to the gateway's token, which the second new test catches. The second live run used this commit. 5. **Docs corrections from review and the first live run** (`docs(kubernetes): correct the in-cluster model server steps`) - Step 1 sets `memory { gpu_memory_gib = 20, kv_cache_gib = 6 }`. Without it, Qwen3-4B's 7.5 GiB of weights, the default 8 GiB KV cache and 2 GiB exceed the default 16 GiB budget, and the server crash-loops with "model weights exceed the declared GPU memory budget". `docs/provider.md`'s `vllm_runtime` example gets the same block. - Step 1 sets `tool_parser = "hermes"` and `reasoning_parser = "qwen3"`; without a tool parser, vLLM answers OpenClaw with HTTP 400. - A "Run Ollama Instead" subsection replaces the one-line Ollama instruction: `ollama_runtime` on port 11434, the Ollama runtime image, the names `ollama`, no key, probes on `GET /api/version` (Ollama has no `/health`), and the example's sandbox namespace. - `runtimeClassName` where the node's default container runtime is not NVIDIA's. - The NetworkPolicy paragraph says that anyone who can create a Pod in the sandbox namespace can carry the supervisor labels and reach the server, and that the policy is a keyless server's only access control. - The ports OpenShell refuses for declared hosts: 2379, 2380, 6443, 10250 and 10255 (`BLOCKED_CONTROL_PLANE_PORTS`, OpenShell `5a7728c`). - Changing the key: a new variable name, because apply does not notice a new value behind the same name; replace the Secret, restart the server, then apply, which updates OpenShell's registration in place. Requests fail in between. - A `docs/limits.md` row for what has been tried and what is untested. 6. **Docs from the second live run** (`docs(kubernetes): finish the in-cluster server steps from the live run`) - Both examples set `maxTokens: 2048` on the route, with a comment. Without it, OpenClaw asked vLLM for `max_completion_tokens=166699`, and vLLM, with a 32768-token context, answered 400; 8192 also failed, because OpenClaw's prompt is about 22-28k tokens. `v1`'s OpenClaw examples all set `maxTokens`, and `examples/managed-ollama-gpu.yaml` uses 2048 for the same Ollama model. - "Run Ollama Instead" names every change: the `ollama` provider and the `data.ollama_runtime.ollama.spec` output in step 1, the ConfigMap `ollama-runtime` in step 2, and `configMapKeyRef.name` `ollama-runtime` and `claimName` `ollama-data` in step 3. It replaces the copied probe comment "GET /health needs no key". - For Ollama, `rollout status` finishes as soon as Ollama listens, before the runtime has loaded the model, so step 4 also waits for the runtime's log line "ready: managed service readiness confirmed". - "You need" states the node memory that both runtimes check at start: `host_reserve_gib` (default 32) plus 20 GiB of the node's available memory for a GPU with its own memory, or the GPU budget plus 20 GiB on `dgx-spark` and `rtx-spark` (`vllm::hardware_capacity::check_memory`, `ollama::hardware_capacity::check_memory`). - After a key change, readers remove the old key from their secret manager and unset its variable. - One sentence says that OpenClaw, which both examples use, cannot start in OpenShell sandboxes with the pinned Fabric (#13372). - The `docs/limits.md` row now says the vLLM and Ollama runtimes were tried on one kind cluster; OpenShift and other network plugins are untested. The second `v1` merge: - `deployment_journey` counts 40 single-sandbox examples: `v1` added eight and this branch adds two. - The configuration reference keeps `v1`'s `api` description and this branch's `credential` and `endpoint` descriptions; `schema --check` reports both generated files current. - #13384 made `policy.managed` an unlabeled list, so two tests from this branch now find the inference grant by its `name`. The third `v1` merge (#13390, #13388, #13409, #13413): - One conflict, in `docs/security.md`'s inference transport row. #13388 says NemoClaw accepts HTTP and HTTPS URLs and recommends HTTPS for credentialed endpoints; this branch adds that a key for an in-cluster Service endpoint crosses the cluster network over plain HTTP. The row keeps both, next to `v1`'s new onboarding catalog row. - `schema --check` reports both generated files current after #13390's `imagePullSecrets`. `git diff --stat upstream/v1 HEAD`: ``` Cargo.lock | 1 + crates/nemoclaw-authoring/src/discovery_queries.rs | 4 +- .../nemoclaw-authoring/tests/deployment_journey.rs | 2 +- .../nemoclaw-authoring/tests/discovery_queries.rs | 39 +++ crates/nemoclaw-sdk/src/config/constraints.rs | 3 + .../nemoclaw-sdk/src/config/schema/validation.rs | 32 +- crates/nemoclaw-sdk/src/config/types.rs | 4 +- crates/nemoclaw-sdk/src/inference_discovery.rs | 56 ++- crates/nemoclaw-sdk/tests/kubernetes_inference.rs | 390 +++++++++++++++++++++ crates/nemoclaw-sdk/tests/main.rs | 2 + crates/openshell-provider/Cargo.toml | 2 + crates/openshell-provider/src/client.rs | 18 +- crates/openshell-provider/src/connected.rs | 1 + .../openshell-provider/src/fake_gateway_tests.rs | 235 +++++++++++++ crates/openshell-provider/src/transport.rs | 21 +- docs/inference.md | 3 + docs/kubernetes.md | 304 +++++++++++++++- docs/limits.md | 3 +- docs/provider.md | 5 + docs/reference/configuration.md | 4 +- docs/security.md | 3 +- examples/kubernetes/in-cluster-ollama.yaml | 53 +++ examples/kubernetes/in-cluster-vllm.yaml | 55 +++ schemas/nemoclaw-v1alpha1.schema.json | 224 +++++++++++- 24 files changed, 1442 insertions(+), 22 deletions(-) ``` Production code is about 125 lines; the schema grows because the document-level key rule repeats for each provider location. `rcgen` is a new dev-dependency of `openshell-provider`, for the fake gateway's certificates; the lock file already held it. ## Breaking or user-visible changes - **Accepted now:** with a Kubernetes or OpenShift gateway, a provider endpoint of the Service form plans and compiles, and may carry `credential`. Plan and onboarding read no model catalog for it, so a successful plan does not show that the server runs or serves the route's model. - **Fixed:** on a managed Kubernetes gateway, a provider's `credential` variable resolves from the environment where `nemoclaw` runs, as on every other gateway, instead of failing apply. A variable named `token`, `ca`, `certificate` or `key` no longer resolves to the forward's own credentials. - **Unchanged:** Docker and Podman gateways still reject the Service form, with or without a key. Every other `http:` endpoint still takes no key. - **Key transport:** a key for the Service form crosses the cluster network over plain HTTP unless the network plugin or a service mesh encrypts Pod traffic. The docs say so. - **Error text:** a key on a plain-HTTP endpoint now fails with "credential requires an HTTPS endpoint, or an http://SERVICE.NAMESPACE.svc.cluster.local:PORT endpoint with a Kubernetes or OpenShift gateway" instead of "...: not". A key on the Service form with Docker or Podman fails with "credential on an http://SERVICE.NAMESPACE.svc.cluster.local endpoint requires a Kubernetes or OpenShift gateway". - **Examples:** two new single-sandbox examples, both with OpenClaw. The authoring example check now covers 40, and onboarding generates two more example journeys. With the pinned Fabric v0.5.0, OpenClaw does not start in OpenShell sandboxes (#13372), as for every OpenClaw example on `v1`. - **Rust API** (`publish = false` crates): new `nemoclaw_sdk::inference_discovery::is_cluster_service_endpoint` and `EndpointRequest::for_provider`. `nemoclaw_authoring::inference_request_for_document` returns `None` for such a route, as it does for a managed-service route. - No change to compiled graphs, state, or provider schemas. ## Test proof ### `cargo ci --full` (linux_arm64, final head) It ran on head `eda1e3fbe`, tree `27f526e77`, with `upstream/v1` at `64c384eff`. ``` ok tools in 0s ok fmt in 1s ok clippy in 27s ok build in 48s Summary [ 20.436s] 1568 tests run: 1568 passed, 204 skipped ok test in 26s ok schema in 0s ok bundle in 66s Summary [ 116.878s] 153 tests run: 153 passed, 51 skipped ok lifecycle in 122s All selected CI steps passed in 292s cargo-ci-exit=0 elapsed=295s ``` - The test step's 4 doctests passed. It ran 1568 tests, 4 more than at `59545ebf4`: the third merge's `v1` commits add 4 tests to this step. This PR's 14 new names are its 12 tests and the 2 generated onboarding journeys (`tui::tests::example_journeys::kubernetes_in_cluster_{vllm,ollama}`). - Lifecycle ran 153 tests, as before the third merge; this PR adds none. - Timing budgets, reported only on this host: every step and every budgeted binary is within budget (`openshell-provider::contract` 99.3 s of 105 s). ### New tests: red without the production change, green with it Twelve new tests, plus two onboarding example journeys that the build generates from the new examples. Red runs reverted only production sources in the working tree, or ran before they existed; the final `cargo ci --full` ran on the committed tree. | Test | Red: before its production change | Green | |---|---|---| | `kubernetes_inference::a_cluster_service_endpoint_is_an_http_service_dns_name_with_an_explicit_port` (7 accepted and 38 rejected endpoints) | the function does not exist; the red run used a panicking stand-in, which fails | passes | | `kubernetes_inference::cluster_gateways_read_no_model_catalog_for_a_cluster_service` (Kubernetes and OpenShift, external and managed) | `endpoint_requests` fails: "HTTP requires a literal loopback address or private inference address" | no catalog read | | `kubernetes_inference::a_cluster_service_compiles_to_a_literal_server_and_an_fqdn_sandbox_rule` | compile fails: "inference discovery inputs are invalid" | literal server, FQDN rule without `allowed_ips` or `cluster_grants`, Fabric `base_url` | | `discovery_queries::a_cluster_service_route_has_no_control_host_catalog_to_read` (authoring) | `inference_request_for_document` returns `Some(EndpointRequest { endpoint: "http://qwen.models.svc.cluster.local:8000/v1", .. })` | `None`; neither plan nor onboarding reads a catalog | | `kubernetes_inference::a_cluster_service_endpoint_takes_a_key_only_with_a_cluster_gateway` (5 provider locations; compiled `credential_env`) | the input schema rejects the key on Kubernetes | accepted on Kubernetes and OpenShift, rejected on Docker and Podman with the named error | | `kubernetes_inference::a_constructed_document_cannot_send_a_key_to_a_service_from_a_local_gateway` | the Kubernetes document with a key does not parse ("violates schema … : not") | `validate` rejects the document after its gateway moves to Docker | | `kubernetes_inference::only_the_service_form_takes_a_key_over_plain_http` | the Service form with a key does not parse (`left: false, right: true`) | an `http:` endpoint with a key parses exactly when `is_cluster_service_endpoint` accepts it | | `openshell-provider` `fake_gateway_tests::a_managed_kubernetes_gateway_resolves_provider_credentials_from_the_environment` | `provider: Some(Authentication)`, the live failure | the fake gateway stores the provider with this process's `PATH` as its credential | | `openshell-provider` `fake_gateway_tests::a_providers_credential_variable_never_resolves_to_the_forwards_credentials` | `token` registers with the forward's bearer token (`left: None, right: Some(Authentication)`) | `token`, `ca`, `certificate` and `key` each fail with `Authentication`, and the gateway receives no provider | The two provider tests reach the fake gateway through `GatewayClient` with a fake forward that supplies a bearer token and mutual-TLS files, as `SdkKubernetes` does; the fixture gateway requires both, so the workspace and profile they create first also show that the forward still authenticates the connection. `PATH` stands in for a key because a test cannot set a variable safely while other tests run. With the first live run's scratch fallback in place of the fix (mutation), the first test passes and the second fails at `token`. Guards and characterization, which pass before and after by design: - `kubernetes_inference::local_gateways_still_reject_a_cluster_service_endpoint` fails when the skip ignores the gateway runtime (mutation). - `kubernetes_inference::other_endpoints_on_cluster_gateways_keep_their_catalog_reads` fails when any `http:` name containing `.svc` counts as a Service (mutation); that mutation also fails the endpoint table. - Dropping the sandbox `agent.inference` location from the document-level key rule fails `a_cluster_service_endpoint_takes_a_key_only_with_a_cluster_gateway` at "docker agent inference" (mutation). - `openshell-provider` `fake_gateway_tests::a_service_name_profile_and_a_sandbox_without_grants_pass_endpoint_ambiguity_checks` (rows from the `local` and `hermes-auth` fixtures, unauthenticated and authenticated): it composes the provider profile and the sandbox policy that the fake gateway received with OpenShell's own `compose_effective_policy` and `find_endpoint_ambiguities`. The check finds no ambiguity, and a ClusterIP on the sandbox's rule alone gives exactly one `allowed_ips` conflict. It passes on `v1` with no production change; the first live run confirmed it on an OpenShell v0.1.4 gateway, and the second stored the same rule. ### Other checks - The docs' `vllm_runtime` and `ollama_runtime` blocks, including the Ollama block's new `spec` output, and `docs/provider.md`'s `vllm_runtime` example compute their specs with OpenTofu 1.12.6 and the `vllm` and `ollama` providers of the final head's bundle. `ollama_runtime` reports port 11434, `/data` and no `key_env`, and both specs carry `hostReserveGiB` 32, the default the node-memory bullet names. - The documented Secret and ConfigMap commands, and the Secret replacement for a key change, produce the expected objects in a `kubectl` client dry run against an empty kubeconfig; the second live run ran the Secret and ConfigMap commands on a cluster. The key change was never run on a cluster. - `nemoclaw-build docs`, then `docs --check`, pass on the final head, including link and anchor checks. `nemoclaw-build fern check` needs Node.js, which this host lacks; deferred to CI. - Not run live: commit 6 as committed (the vLLM route's `maxTokens: 2048` ran; the Ollama example's did not, and the Ollama readiness wait was observed, not run as written), the third `v1` merge, the key change, OpenShift, and other network plugins. ### Live evidence (not qualification; #12732 stays open) The second live run, on 2026-10-18, used head `59545ebf4`: `v1` `7d7772eda` and commits 1-5. Since then the branch gained commit 6, which makes the docs changes this run called for, and the third `v1` merge (`64c384eff`); this PR's own code did not change, and `v1`'s changes from that merge did not run live. **Setup.** A kind cluster with one GB300 worker and the `nvidia` RuntimeClass (the worker's containerd default runtime is `runc`). The linux_arm64 bundle came from that head's `cargo ci --full`; the vLLM runtime, Ollama runtime and OpenClaw agent images were built from that head and loaded on the worker by digest. The docs steps ran as written, except for the namespaces, the image digests, the deployment UID and context, `hardware` (`gb300`, `arm64`), and `runtimeClassName: nvidia`, which step 3 says to set on such a node. **Locally modified agent image.** With the pinned Fabric v0.5.0, OpenClaw cannot start in OpenShell sandboxes (`v1` #13372). The first apply registered the keyed provider and created the sandbox, then stopped at the agent with `start_failed`; Fabric's start reported `setpriv: activate capabilities: Operation not permitted`, with and without the key. Every later apply in this run used the head's OpenClaw image with `/usr/bin/setpriv` removed, built locally for this run only. Without `setpriv`, Fabric's adapter runs the OpenClaw gateway directly. **Keyed vLLM** (`in-cluster-vllm.yaml` with `QWEN_INFERENCE_KEY` set): - **Provider fix:** apply registered the keyed provider `qwen` on the managed Kubernetes gateway. At `620ea6966` this step failed with "observation authentication failed". - **Server:** steps 1-4 created the Secret, ConfigMap, PVC, Deployment, Service and NetworkPolicy, and `rollout status` finished in 296 s. Inside the model Pod, `/health` answered 200 without a key; `/v1/models` answered 401 without a key and with a wrong key, and chat 401 without a key; with the key, `/v1/models` and a chat with tools and `tool_choice: auto` answered 200. - **Policy rule:** a read-only `GetSandbox` showed one network rule, the same after each sandbox replacement: ``` sandbox assistant phase SANDBOX_PHASE_READY policy version 1; policy-input cluster_grants: []; managed rules: ["nemoclaw-inference-qwen-eb79800cf1772956a635ba0b"] rule nemoclaw-inference-qwen-eb79800cf1772956a635ba0b: qwen.nemoclaw-pr13063-r2-models.svc.cluster.local:8000 ports [8000] protocol=rest allowed_ips=[] binaries=2 rules with allowed_ips: []; Service ClusterIP 10.96.23.27 appears in policy: 0 ``` The agent's model entry names that endpoint as `base_url`, and its key variable holds an `openshell:resolve:env:` placeholder. - **OpenClaw turn:** with the example's route as committed before commit 6, the turn failed with vLLM 400 (`max_completion_tokens=166699 cannot be greater than max_model_len`); with `maxTokens: 8192` it failed the same way (prompt of at least 24,577 tokens). With `maxTokens: 2048` the turn `succeeded`: 6 × `POST /v1/chat/completions -> 200`, all from the sandbox's OpenShell supervisor Pod; the sandbox's workload Pod never reached the server. The 4B model did not reply with the requested words; it tried a messaging tool. - **401 without the key:** a Pod with the supervisor labels in the sandbox namespace got `GET /v1/models` 401 without a key, while the supervisor's requests got 200, so OpenShell supplied the key. - **Key exposure, 0 matches in each place:** the sandbox environment (only the placeholder variable and `NEMOCLAW_ANONYMOUS_API_KEY="unused"` name a key); all 24 sandbox files under `/sandbox` and `/tmp` outside the Node compile cache, including OpenClaw's configuration, its SQLite WAL and its log; `export`; the deployment state directory; ConfigMaps in both namespaces; Secrets in the gateway namespace, raw and base64; the logs of 4 gateway-namespace containers; the model Pod log. - **Export:** keeps `credential: {env: QWEN_INFERENCE_KEY}` and `maxTokens: 2048`; planning the export reports no changes. **Keyless Ollama** ("Run Ollama Instead" steps 1-4, then `in-cluster-ollama.yaml` without `maxTokens`): - `rollout status` finished in 25 s; plan and apply succeeded; one turn replied "in-cluster ok" with 1 × `POST /v1/chat/completions -> 200` from the supervisor Pod. - The stored policy held one rule, `ollama.nemoclaw-pr13063-r2-omodels.svc.cluster.local:11434 ports [11434] protocol=rest allowed_ips=[]`, with `cluster_grants: []`. The agent uses `NEMOCLAW_ANONYMOUS_API_KEY`. - The rollout finished 45 s before the runtime logged "ready: managed service readiness confirmed"; commit 6 adds that wait to step 4. - Planning the export reports no changes. **NetworkPolicy:** - vLLM: plain Pods in the sandbox namespace, the server namespace and `default` timed out, and so did a Pod with the supervisor labels in `default`. - Ollama: plain Pods timed out; a Pod with the supervisor labels in the sandbox namespace got 200 on `/api/version` and `/v1/models`. Without a key, the NetworkPolicy is the only access control, as the docs say. **Earlier findings.** The first live run (2026-10-16, head `620ea6966` on `v1` `ef3115d4e`) found the provider bug that commit 4 fixes and the docs gaps that commit 5 fixes; this run confirmed both. Its re-apply-after-destroy failure is fixed in `v1` by #13408: here, destroy and a new apply with the same state succeeded. **`v1` observations, not this PR:** after the failed agent start, `plan --destroy` and destroy succeeded. After that start failure, apply refused to replace the sandbox for a changed `image.ref` ("apply cannot replace sandbox 'assistant'; its files and conversation history are not separately retained"), but replaced it for a changed route `maxTokens`, which deletes the same files. **Cleanup.** Both destroys completed; the run's namespaces and their PVs were deleted; the cluster's namespaces, PVs, PVCs and cluster-scoped objects match the start; GPU memory was 0 MiB at the end. The key file was deleted after the last check. ## Review items left unchanged - On a cluster gateway, a mistyped Service endpoint (for example `http://qwen.models.svc:8000/v1`) fails planning with the generic "inference discovery inputs are invalid" (`discovery.rs` drops the cause). The text predates this PR; a hint naming the accepted form could follow separately. - A trailing space or NUL in a Service endpoint is accepted, because `validate_endpoint_url` rejects only some control characters. The host stays the Service, so the key goes nowhere else; the fix belongs in endpoint validation for every endpoint, separately. - The `feat` commit messages say "Q1" and call the endpoint table red; the PR body is what lands on squash merge, and it describes both correctly. ## Questions pending with the maintainers (#12641) - **Q1, key over in-cluster HTTP:** may a YAML provider set `credential` on the Service form with a Kubernetes or OpenShift gateway? HCL already allows it, and managed Docker vLLM already sends its key over private HTTP. If not, drop the second commit and the key parts of the docs and the vLLM example; the routing half needs no decision, and commit 4 stands on its own. - **Q2, discovery:** may compile skip the control-host catalog read for these endpoints? The control host cannot resolve cluster DNS; this follows #13291. - **Q3, cluster domain:** this PR accepts only the lowercase `<service>.<namespace>.svc.cluster.local` form. OpenShell's own `is_kubernetes_service_host` (`profiles.rs`, `5a7728c`) also accepts `<service>.<namespace>.svc`, any letter case, and a trailing dot. Should NemoClaw accept those, or a custom cluster domain? - **Q4, NetworkPolicy selector:** the docs admit Pods labelled `openshell.ai/boundary-role=supervisor` (with `openshell.ai/managed-by=openshell`), OpenShell's own labels at `5a7728c`. Anyone who can create a Pod in the sandbox namespace can set them. Is that stable enough to document, or should we ask OpenShell for a supported selector? 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Update (maintainer) Merged `v1` and reworked, following the principle settled in #13131: NemoClaw does what it owns, and leaves destination policy to OpenShell (#13232). - **No cluster-DNS special cases.** Removed `is_cluster_service_endpoint`, `CLUSTER_SERVICE_ENDPOINT`, the cluster-only credential exception, and the rule rejecting a cluster address with a key on Docker or Podman. Instead, the general provider rule forbidding a `credential` on `http:` endpoints is gone. OpenShell decides where a sandbox's key may go, as it already decides where its traffic goes. - **Catalog reads.** Plans no longer read catalogs (#13291). Discovery now builds a catalog query only for endpoints NemoClaw's own connection rules allow (HTTPS, or HTTP to a literal loopback or private address). Others, such as a cluster Service, get none, rather than making compilation fail. Onboarding then can't suggest that server's models. - **Kept:** the credential fix for Kubernetes gateways (the connection's secrets are separate from those of the objects it manages), its fake-gateway tests, the compile test for routing to a cluster Service, and both examples. `kubernetes_inference.rs` now checks that any HTTP or HTTPS endpoint takes a key on any gateway, wherever the provider is declared. - **Docs:** "Use a Model Server in the Cluster" is now a short section. The server is deployed with the platform's own tools, and "Supply the Key on Other Platforms" covers the key. The step-by-step runbook was removed. `inference.md` and `security.md` say to prefer HTTPS for credentialed endpoints, because over plain HTTP the key travels unencrypted. `limits.md` keeps the two model-server rows and drops the resolved #12692 and #12709 rows. `cargo ci` passes locally: 1,565 unit tests and 153 lifecycle tests. `fern check` reports 0 errors. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Carlos Villela <cvillela@nvidia.com>
PR-6 merged v1 up to #13411. Three v1 changes move code this branch builds on: - #13224 removed the `nemoclaw` provider, which served this branch's cluster model types. They become `openshell_kubernetes_service` and `openshell_kubernetes_service_storage`, served by the openshell provider beside the Kubernetes gateway installation types: two more `INSTALLATION_TYPES` entries, and `cluster_services::definitions()` in `all_definitions()`. Their contract tests move to `openshell-provider::contract` with the Kubernetes gateway tests, their schema to the openshell snapshot, and the docs name the new types. - #13286 plans and applies each deployment as one OpenTofu root. The cluster image preflight moves from the removed runtime stage into `Deployment::run`, before compilation. #13286 also removed the "unfinished Kubernetes platform apply" rule, so this branch's exception to it (`revises_only_model_workloads`), its test, and its usage.md paragraph go too. The compile test now checks that the apply-time gateway read, which every object waits on, waits on the cluster service, instead of checking that agents compile into a separate graph. - #13184 added `Definition::derived`: a computed attribute kept out of backend rows. This branch's `derived` is an optional input checked against the spec and kept in the row, so ownership checks still see `owner` and `generation`. It is renamed `derived_input`. Smaller follow-ups: - #13093 added `ServiceDefinition::Container`; the cluster matches cover it. The cluster service is no longer a `runtime_process` kind: that flag now also selects Docker readiness and compute, which decode a Docker spec. Its only other readers handle the cluster kind first. - #13223 dropped the `org.nemoclaw.runtime.spec` label everywhere; the cluster image check no longer requires it. - #13369 removed `model_metadata` from OpenClaw routes, since Fabric v0.5.0's adapter rejects it; the cluster fixtures and docs drop it. The remaining conflicts keep both sides. `openshell-provider::contract`'s summed budget rises from 105 to 130 s, keeping v1's margin: the 8 moved cluster model tests add 23.2 s in a local linux_arm64 run (slowest 3.9 s, within the 6 s limit), about 17 s at CI speed. `nemoclaw-provider::contract` keeps its v1 budget; this branch's earlier raise to 150 s went with the tests. Validation on linux_arm64: the `cargo ci` fmt, clippy, test, schema, bundle and lifecycle steps pass (161 lifecycle tests, among them the 8 cluster model contract tests), as does `nemoclaw-build docs --check`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Superseded by #13489, which rebuilds this on This PR connected the SDK-side reconciler from #13061, which was closed under The branch |
Run managed vLLM and Ollama services on managed Kubernetes and OpenShift gateways: plan and apply create, verify, update and retain their cluster storage and workloads through the #13061 reconciler. Sandboxes cannot route to these services until #13063; this PR refuses such routes explicitly.
Important
With this PR, cluster model services deploy and run, but no agent can use them: validation rejects any inference provider whose
serviceRefnames a cluster service. #13063 adds the endpoint grants and credential reads that routing needs, and removes the refusal and this PR's temporary test fixtures. Do not cut a release between this PR and #13063.Why
Managed Kubernetes and OpenShift gateways rejected every model service (
spec.servicesmaxProperties: 0), so a cluster deployment needed a model endpoint that NemoClaw does not manage. #13061 added the reconciler behind that gate, but nothing compiled a document to its resources and the OpenTofu provider did not serve them. This PR is the part of #12736 that connects them, split out so it can be reviewed without the routing changes.The #12736 review at 487cfc8 found these defects in this code. The fixes landed in #12736 and are part of this PR:
nemoclaw_kubernetes_service. A tainted service could only be replaced, which apply refuses; recovery needed a manualtofu untaint. Confirmed live at c3496ea (R13).org.nemoclaw.inference.routes.nemoclaw-provider::contractis over its timing budget with the new tests; see the budget change below.kubernetes.mdnames who can read the cluster vLLM key and links the security guide. Thesecurity.mdandinference.mdtext that names cluster key readers is in feat(sdk): route sandboxes on Kubernetes gateways to in-cluster model servers #13063.What changes
config/schema/validation.rs,services/cluster_config.rs,services/registry.rs):kind: vllmandkind: ollamaservices that setkubernetes, explicitcontainer.cpuLimitMillisandcontainer.memoryLimitGiB, private IPC, and no Dockerplacementorpublication. A missing limit names its field ("cluster model services require container.cpuLimitMillis").KubernetesService::resolvecombines thekubernetessettings with the service's container limits and service-levelupdatePolicyinto theKubernetesSettingsthat feat(sdk): reconcile cluster model storage and workloads through the Kubernetes API #13061 records.kubernetes.serviceRefnames a cluster service is rejected with "inference providers cannot reference cluster model services yet; use an external endpoint". Without it, a routed document failed later with "invalid native inference policy".services/cluster.rs,compile_runtime.rs): the runtime stage emitsnemoclaw_kubernetes_service_storage(withprevent_destroy) andnemoclaw_kubernetes_service, which depends on its storage and the gateway. Agents apply in the later stage.nemoclaw-provider/src/cluster_services.rs,nemoclaw-tofu,nemoclaw-backend):ClusterServicesBackendserves both types: plan runs the feat(sdk): reconcile cluster model storage and workloads through the Kubernetes API #13061 preflight and dry runs; apply ensures storage and the workload and waits for readiness; refresh verifies the receipt; destroy removes compute and keeps the PVCs.Mutation::stopped: complete state withrunning=falseand the reason as a warning. OpenTofu does not taint it, therunningpostcondition still fails the apply, and an unchanged apply resumes waiting.ownerandgenerationare optional computed attributes derived fromspec(Definition::derived); supplied values must match it. Refreshing state from schemas without them adds them without rewritingspec.nemoclaw-sdk/src/image_metadata.rs,nemoclaw-fabricverify_runtime_labels): plan and apply verify each cluster runtime image's digest chain, platform and labels from its local metadata bundle before changing cluster resources. Bearer vLLM needsorg.nemoclaw.inference.routes=openai-v2from fix(runtime)!: restrict bearer vLLM to authenticated inference routes #13057. A wrong platform and a wrong label each get their own message.deployment/runtime.rs,runtime/teardown.rs,deployment/mod.rs,state/mod.rs):Progress::Warning).Preservecheck skips cluster services.kubernetes_models.rs,kubernetes_model_api.rs), provider identity tests, SDK configuration, compile, runtime, teardown and image-metadata tests.crates/test-support/cluster-models/{vllm,ollama}.yaml: [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736'sexamples/kubernetes/local-{vllm,ollama}.yamlwith the provider'sserviceRef: qwenreplaced by an external endpoint. 17include_*references use them, 2 of them in the refusal test; feat(sdk): route sandboxes on Kubernetes gateways to in-cluster model servers #13063 adds the examples and deletes the fixtures..config/test-budgets.yaml):nemoclaw-provider::contractsummed_seconds110 → 150. Reason: the 8 new cluster model contract tests added 43.6 s summed (slowest 7.5 s) in a local linux_arm64 lifecycle run of this branch (43.8 s and 7.8 s in the final run), where the 29 existing tests took 117.1 s on feat(sdk): reconcile cluster model storage and workloads through the Kubernetes API #13061. CI measured those 29 at most 80 s, so the new total is about 110 s at CI speed, at the old budget.test_secondsstays 10.kubernetes.md(the managed model service procedure, quota recovery, stopped-Pod diagnosis; it states that sandboxes cannot route to these services yet and leaves out [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736's example links and routing instructions until feat(sdk): route sandboxes on Kubernetes gateways to in-cluster model servers #13063), the newdesign/cluster-inference-compatibility.md(a record of [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736 as a whole, so it mentions the cluster examples that feat(sdk): route sandboxes on Kubernetes gateways to in-cluster model servers #13063 adds), and cluster parts ofinference.md,limits.md,provider.md,state.md,troubleshooting.md,usage.mdandreference/cli.md. Schema and configuration reference regenerated.Breaking or user-visible changes
Managed Kubernetes and OpenShift gateways accept model services. Plan and apply create, per service, a retained model PVC (plus a credential PVC for bearer vLLM) and a Pod, ConfigMap, ClusterIP Service and NetworkPolicy; destroy removes the compute and keeps the PVCs. No sandbox can use the service until feat(sdk): route sandboxes on Kubernetes gateways to in-cluster model servers #13063.
Validation messages observed with the same documents on the base (
split/6-cluster-reconciler) and on this branch (all pathsconfiguration violates schema at …, positions omitted):kubernetesand container limitsspec.services: maxPropertiesspec.services: maxPropertiesspec.services.<name>: cluster model services require container.cpuLimitMilliskubernetesspec.services: maxPropertiesspec.services.<name>: required field: "kubernetes"serviceRefand a sandbox routespec.services: maxPropertiesinference providers cannot reference cluster model services yet; use an external endpointkubernetesand limitsspec.services: maxPropertieskubernetes, no limitsspec.services: maxPropertiesspec.services.<name>: cluster model services require container.cpuLimitMilliskubernetes, no limitsspec.services.<name>: notspec.services.<name>: cluster model services require container.cpuLimitMilliskubernetesand limitsspec.services.<name>: notThe limit message on Docker and external gateways matches [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736, which also named the legacy location. Removing
kubernetesis the fix there, which the message does not say; the Rust check has a better message ("service kubernetes settings require a managed Kubernetes or OpenShift gateway…") but the schema check reports first.Legacy layout not accepted:
kubernetes.cpuLimitMillis,kubernetes.memoryLimitGiBandkubernetes.updatePolicy, which builds from the [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736 branch accepted, are unknown fields here (the legacy-field migration was dropped from the split). No tagged release accepted them.Plan and apply warnings: each cluster service adds a warning that its isolation depends on NetworkPolicy enforcement the Kubernetes API cannot verify; it appears in text output and in JSON
warnings.Recovery: an unfinished Kubernetes apply now accepts a revision that changes only model workloads, so a failed rollout can be corrected (for example back to the previous digest) without the original YAML.
Bundle: the bundled
nemoclawOpenTofu provider servesnemoclaw_kubernetes_serviceandnemoclaw_kubernetes_service_storage, and itsdestroysetting also permits deleting cluster model workloads.Schema and configuration reference: the cluster container-limit rule, and the cluster wording that feat(services)!: add container limits and updatePolicy for Docker model services #13058 left out of the
container,cpuLimitMillis,memoryLimitGiBandupdatePolicydescriptions.Rust API (
publish = falsecrates; every use in the workspace is updated):nemoclaw_tofu::Definitiongains a publicderivedfield, so struct literals need it; newDerive,Definition::derived,is_derived;Mutation::stoppedandMutation::warning;nemoclaw_sdk::image_metadatabecomes an SDK module that keeps the re-exportedobserve,verifyandMAX_BUNDLE_BYTESand addsverify_cluster_runtime_imagesandobserve_runtime; newnemoclaw_fabric::image_metadata::verify_runtime_labelsandnemoclaw_provider::cluster_services.No change for Docker or Podman documents that validate on the base.
Test proof
cargo ci(linux_arm64, this branch)Run on the GB300 host (aarch64). The tree tested, aeb5cc331, is the commit's tree.
split/6-cluster-reconcilerran 1507. 40 test names are new there (8 more run only in lifecycle) and 3 are gone: the 2 replaced gate tests and 1 renamed test.cargo run --locked -p nemoclaw-build -- docs --checkpassed afterdocsgenerated the untracked output; no tracked file changed. With [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736'skubernetes.md, which linksexamples/kubernetes/local-vllm.yaml, the same check fails:No such file or directory.nemoclaw-provider::contractat 162.4 s summed against the new 150 s budget, and itsservice_readiness::standalone_proxy_readiness_rechecks_identity_and_credentials_without_sdk_or_gatewayat 10.5 s against 10 s. That test and binary were already over locally on feat(sdk): reconcile cluster model storage and workloads through the Kubernetes API #13061 (117.1 s for 29 tests, 10.3 s); CI measured the same 29 tests at most 80 s, so this host runs the binary about 1.46 times slower, and the estimate for 37 tests at CI speed is about 111 s. The slowest new test took 7.8 s. Also listed, unchanged by this PR: 430.0 s wall against 300 s (CI splits lifecycle into two partitions),remote_service115.4 s and 102.1 s against 90 s, andopenshell-provider::contract196.8 s against 190 s. Check the CI Lifecycle timing job.v1as feat(tofu): reject refreshes that change a bound field #13126): this diff does not apply tov1+ fix: report bounded OpenShell rejections and harden teardown, locking, and test fixtures #13056…feat(sdk): warn when OpenClaw or Hermes context exceeds the managed model budget #13059 + feat(sdk): reconcile cluster model storage and workloads through the Kubernetes API #13061. Itsnemoclaw-tofu/src/resource.rsandnemoclaw-provider/tests/support/mod.rshunks conflict with refactor(openshell-provider): inject a Services hook for cluster grants and profile sources #13060'sbound_fieldscode, which they extend.New tests: red without the production change, green with it
This PR adds 47 tests, renames 1 and removes 2; the tables cover all 48 new names. #13061's two gate tests, which held only while the gate was closed, are replaced by
managed_cluster_gateways_accept_complete_cluster_settings_that_external_gateways_rejectandlocal_engine_gateways_reject_cluster_service_settings.kubernetes_rejects_managed_services_even_when_no_route_selects_themis renamedkubernetes_services_require_cluster_settings_even_when_no_route_selects_them, unchanged. Four existing tests are extended:mutation::mutation_constructors_preserve_success_failure_and_partial_bindings(Mutation::stopped),planning::stopped_managed_process_reapplies_install_without_promising_readiness_or_replacementandrefresh::kubernetes_storage_absence_and_destroy_preserve_its_binding(the two new kinds), andevery_type_has_a_contract_test. Red runs edited only the working tree and restored the commit's tree afterwards.On the base: #13061's production code (
split/6-cluster-reconciler, cb4167a) with this PR's tests, test support and fixtures.cargo test --locked -p nemoclaw-sdk --test integration --no-runstoppedonMutation(themutation.rsextension)cargo test --locked -p nemoclaw-provider --test integration --no-runderivedonDefinition(tests/support/mod.rs)mutation.rsandsupport/mod.rs, the new and extended SDK and provider testscargo nextest run --locked --profile ci --no-fail-fast -p nemoclaw-sdk -p nemoclaw-provider -E 'test(/^cluster_service_config::/) | test(/^cluster_services_compile::/) | test(/^config_kubernetes::/) | test(/^deployment::runtime::tests::/) | test(/^cluster_identity::/) | test(/^refresh::/) | test(/^planning::/)'cluster_identity5,deployment::runtime::tests3,cluster_service_config7,cluster_services_compile2,managed_cluster_gateways_accept_…) and the extendedplanningandrefreshtestsevery_type_has_a_contract_testNEMOCLAW_TEST_BUNDLE=$PWD/dist/linux_arm64 cargo nextest run --locked --profile lifecycle --no-fail-fast -p nemoclaw-provider --test contract --run-ignored all -E 'test(/^kubernetes_models::/) | test(every_type_has_a_contract_test)'The provider nvidia/nemoclaw does not support resource type "nemoclaw_kubernetes_service_storage".every_type_has_a_contract_testpassed: the base serves no cluster model typescluster_services::tests(2),image_metadata::tests(8), and 2 inruntime/teardown.rscluster_service_configtests pin rejections the base also makes, because it rejects every cluster service;docker_service_defaults_do_not_add_cluster_settingsandlocal_engine_gateways_reject_cluster_service_settingspin unchanged Docker behavior; the tenth is the renamed test. Of these,portable_cluster_limits_and_update_policy_reject_invalid_or_misplaced_declarationsfails under thelimit-rule-offmutant belowOn this branch, one production mutant at a time. Unit and integration command:
cargo nextest run --locked --profile ci --no-fail-fast -p nemoclaw-sdk -p nemoclaw-provider -p nemoclaw-tofu -p nemoclaw-fabric -p nemoclaw-backend(901 tests). Contract command: the lifecycle command above with-E 'test(/^kubernetes_models::/) | test(/^kubernetes_lifecycle::/) | test(/^kubernetes_hcl::/)'(11 tests). Every failure under every mutant was a new test. 37 of the 48 new or renamed tests fail under at least one mutant; all pass on the commit.gate-closed: #13061's gate restored (maxProperties: 0for services on managed cluster gateways)cluster_model_services_accept_explicit_capacity_storage_and_scheduling,cluster_services_provision_retained_storage_and_workloads_before_agents,cluster_service_changes_keep_bound_storage_and_require_all_recorded_prerequisites,cluster_identity::omitted_cluster_identity_is_derived_from_spec_and_preserves_legacy_bindings,image_metadata::tests::deployment_preflight_requires_metadata_for_every_declared_cluster_servicelimit-rule-off: the schema does not require container limits withkubernetescluster_services_reject_missing_capacity_and_incompatible_execution_settings,portable_cluster_limits_and_update_policy_reject_invalid_or_misplaced_declarations,managed_cluster_gateways_accept_complete_cluster_settings_that_external_gateways_rejectroute-refusal-off: providers may reference cluster servicessandboxes_cannot_route_to_cluster_model_services_yet(the document then fails with "invalid native inference policy")update-policy-ignored: compiled settings ignore the service-levelupdatePolicycluster_update_policy_defaults_to_preserve_and_requires_an_explicit_known_choicenetwork-warning-offplan_and_apply_warn_about_cluster_network_boundaries_even_with_bearer_authenticationrollout-correction-off: an unfinished Kubernetes apply refuses every revisionfailed_kubernetes_model_rollout_accepts_only_revised_model_workloadsbindings-unchecked: a service binding without its storage or gateway binding is acceptedcluster_service_changes_keep_bound_storage_and_require_all_recorded_prerequisites,cluster_teardown_uses_the_recorded_process_configuration_and_retained_storageteardown-spec-unbound: teardown uses the current spec, not the recorded onecluster_teardown_uses_the_recorded_process_configuration_and_retained_storageteardown-metadata-kept: teardown asks for the image metadata fileteardown_preserves_cluster_service_metadata_without_requesting_its_fileroutes-label-off: bearer vLLM need not carry the routes labelauthenticated_runtime_requires_native_bearer_and_restricted_routeslabels-unchecked: required runtime labels are not comparedauthenticated_runtime_requires_native_bearer_and_restricted_routes,recipe_runtime_requires_every_declared_image_capability,runtime_metadata_rejects_wrong_platform_contract_and_changed_bytesrecipe-labels-ignoredrecipe_runtime_requires_every_declared_image_capabilitypinned-architecture-off: a multi-architecture index is refused even for a pinned architectureruntime_index_selects_the_explicit_cluster_architecture,a_runtime_image_for_another_architecture_is_reported_as_a_platform_mismatchderive-unchecked: suppliedowner/generationneed not match the speccluster_identity::conflicting_cluster_identity_is_rejected_before_backend_calls,cluster_identity::contradictory_observed_cluster_identity_retains_saved_statederive-off:owner/generationare not derivedcluster_identity(3); through OpenTofu, all 8kubernetes_modelstestsport-refusal-off: plan accepts a bound serving-port changeplan_rejects_bound_port_changes_before_reading_metadata_or_cluster_credentialsremove-outside-destroy: removal outside destroy is attemptedremoving_a_model_workload_outside_destroy_names_whole_deployment_destroystopped-as-partial(X2-TAINT): an unready first apply is reported as an error with statea_first_apply_readiness_failure_stays_untainted_and_an_unchanged_apply_resumesandupdate_policy_protects_only_model_pods_that_servedpod-uid-unchecked(#13061 code, NEW-M1-DRIFT): a substituted object's UID is not comparedvllm_/ollama_plan_refuses_a_substituted_pod_or_deleted_service_without_changing_stateThree mutants survived the unit and integration run; none of them is covered by a new test:
docker-guard-off(feat(services)!: add container limits and updatePolicy for Docker model services #13058's DockerPreservecheck also inspects cluster services): a cluster plan contains no Docker model addresses, so the guard is defensive.bound-storage-unchecked(the SDK accepts a changed storage identity from retained intent): no SDK test changes a bound service's storage; the provider's plan still refuses it ("model storage or cluster binding changed; resources retained").metadata-preflight-off(the deployment's image check before OpenTofu):deployment_preflight_requires_metadata_for_every_declared_cluster_servicecalls the check directly; the provider repeats it at plan and apply.The 11 new tests that no mutant failed are the 9 that pass on the base,
runtime_metadata_verifies_backend_images_without_a_fabric_catalogandruntime_bundle_reads_are_bounded_and_errors_do_not_expose_local_paths; the last two test the new module's success path and bounded reads.Lifecycle tests
The 8 new lifecycle-only tests run both resource types through the bundled OpenTofu against the fake Kubernetes API and Pod exec (
nemoclaw-provider::contract,kubernetes_models::). All passed:vllm_resources_apply_refresh_update_and_destroy_keeping_model_and_credential_claimsollama_resources_apply_refresh_update_and_destroy_keeping_model_claimvllm_plan_refuses_a_substituted_pod_or_deleted_service_without_changing_state(NEW-M1-DRIFT)ollama_plan_refuses_a_substituted_pod_or_deleted_service_without_changing_state(NEW-M1-DRIFT)a_first_apply_readiness_failure_stays_untainted_and_an_unchanged_apply_resumes(X2-TAINT)update_policy_protects_only_model_pods_that_serveda_recreate_rollout_that_cannot_start_reverts_under_the_default_policyfirst_apply_waits_while_the_cluster_adds_a_node_for_an_unschedulable_pod(the 15-minute Unschedulable grace from feat(sdk): reconcile cluster model storage and workloads through the Kubernetes API #13061, through OpenTofu)every_type_has_a_contract_test, which now requires the two new types, runs in the test step and passed. All 135 tests selected by thelifecycleprofile passed (JUnit:ci-7-lifecycle.xml).All 135 lifecycle tests (passed)
fabric-provider::contract(3):capabilities::capabilities_judge_the_image_for_the_configuration,pi_configuration_updates_without_replacing_the_sandbox,readiness::readiness_reports_the_configured_agent_and_its_failed_healthnemoclaw-e2e::integration(49):deployment::(24),export_observations::(4),fabric_deployment::(4),helm_recovery::(5),inference_discovery::(1),multiple_providers::(1),remote_service::(9),sandbox_readiness::(1)nemoclaw-provider::contract(37):discovery::(3),gateway_readiness::(1),gateway_storage::(1),inference_capabilities::(3),kubernetes_hcl::(1),kubernetes_lifecycle::(2),kubernetes_models::(8, new),provider_protocol::(4),runtime_image::(1),service_capacity::(1),service_readiness::(2),service_storage::(6),vllm_runtime::(4)openshell-provider::contract(44):capabilities::(2),standalone::(20), and the 22 example configurationsnemoclaw-fixture-provider::archivethe_fixture_provider_is_found_beside_the_test_executables,nemoclaw-test-fixtures::ssh_relaythe_relay_is_found_beside_the_test_executablesLive evidence (not qualification; #12732 stays open)
split/7-cluster-model-services@787b1dc2d, this branch'sdist/linux_arm64bundle (0.1.0-dev.63b22ddb10fb85ee). 2026-10-12, kindnvkind-demo(Kubernetes 1.37, one GB300 worker), namespacesnemoclaw-pr12736-s7-{vllm,ollama}.Setup. This branch's unrouted fixtures
crates/test-support/cluster-models/{vllm,ollama}.yaml(the provider names an external endpoint), adapted to:gb300andruntimeClassName: nvidia;openai-v2sha256:4b80cffa…, whoseruntimes/and runtime crate are identical to this branch; Ollamasha256:dea377de…;split/8(image/is identical).serviceRef: qwen)inference providers cannot reference cluster model services yet; use an external endpointPlan incomplete · 6 known resource changeswith the NetworkPolicy warningstorageGiB10 (min 16);kvCacheGiB30; wrong image metadata;openai-v1image (the message namesorg.nemoclaw.inference.routes)storageGiB10; CPU request above limitanother operation holds the deployment lockrunAsNonRoot, seccompRuntimeDefault, no SA token,allowPrivilegeEscalation: false, drop ALL; limits 1 GPU / 64Gi / 4 CPUopenshell.ai/boundary-role=supervisoronly), probed from a plain Pod in the namespace/v1/*gave 401 without the key and 200 with it./invocations,/tokenize,/metrics, LoRA,OPTIONSandHEADgave 404. 0 unexpected completions.No resource changes planned.ServiceexternalIPsdrift:…does not match its saved binding at spec.externalIPs; resources retained…at spec.ingressPreserve: memory limit 64 → 60 Gi…is preserved by service updatePolicy: Preserve; replacing it requires explicit updatePolicy: Recreate…. Pod UID unchanged.Recreateupdate complete (1s), Pod UID unchanged…check-…" is forbidden: maximum memory usage per Container is 80Gi, but limit is 96Gi. Pod UID unchanged.RecreatewithnodeSelectoron an absent label)cannot be scheduled: replacement preflight: no Node matches nodeSelector; the current Pod was not replaced. Pod UID unchanged, still Running.RecreateKubernetes model Pod nemoclaw-pr12736-s7-vllm/nc-…-model-… stopped: reason Error, exit code 1; model metadata request rejected; ……stopped: reason Error, exit code 1; Ollama tag differs from the pinned manifest digestupdate complete (3m 13s), stateok/running=true. The rename check ran on Ollama.unfinished Kubernetes platform apply requires its original configuration and state for recovery. Revert in 35 s. Returning toPreservekept the Pod UID.update complete (3m 7s)verifying selected Ollama model snapshot, so nothing was re-downloaded.nodeSelectorcreate … (15m 0s)):cannot be scheduled: Unschedulable: 0/2 nodes are available: 1 node(s) didn't match Pod's node affinity/selector…. Statestatus=ok running=false(not tainted). The corrected config underPreserveresumed withupdate complete (1m 14s), and the Pod ran.plan --destroy: 8 deletions; destroy took 42 s. The-dataand-authPVCs kept their UIDs; the sandbox workspace PVC was deleted. GPU 0 MiB.-dataPVC kept its UID across both applies. GPU 0 MiB.Notes and deviations:
fabric_health_unsupported). This is not a failure of this PR.verify_endpoints, used only for routing grants) arrives in feat(sdk): route sandboxes on Kubernetes gateways to in-cluster model servers #13063 and is verified there. On this branch, nothing consumes the Service.Plan failedline, so it was repeated on Ollama. The vLLM recovery log was not kept, so the "no re-download" evidence comes from the Ollama run and PR-8.Updated for
v16526400 (after #13060 landed as #13125–#13128)#13060 was closed after its code landed in
v1as #13125, #13126, #13127 and #13128 (Carlos Villela). An audit of all 67 of #13060's hunks found 66 byte-identical inv1and one doc-comment rewording; nothing is missing and no API this stack uses changed. The branches mergedv16526400 with no conflicts.nemoclaw-tofuand provider test-support hunks extendbound_fields, which is now inv1through feat(tofu): reject refreshes that change a bound field #13126, unchanged from refactor(openshell-provider): inject a Services hook for cluster grants and profile sources #13060's version.cargo ciat e19b5bb: 1591 tests + 144 lifecycle, all passed.Earlier:
v1bceec80 (after #13056–#13059 merged)#13056–#13059 are merged into
v1, and the maintainers have since refactored that code inv1(#13104, #13105, #13106, #13108, #13109, #13110, #13111, #13112). The stack followsv1with signed merge commits, no rebase, and this PR's own diff stays as published except where noted.deployment::context_advisory. This PR changes no advisory code; its cluster NetworkPolicy warning loop now sits directly before thecontext_warningscall inDeployment::run, so plan and apply still report cluster warnings first.ServiceDefinition. This PR'skubernetes()accessor sits besidev1's new accessors, andpreserve_docker_modelsnow skips cluster services with one leadingif service.kubernetes().is_some() { continue; }instead of guards on the vLLM and Ollama arms.cargo cipassed with that skip deleted, so nothing pinned it. The test pairs Docker and clusterPreserveservices namedqwen(vLLM and Ollama) and checks that a replacement, a deletion and a memory decrease are refused for Docker and accepted for the cluster service; deleting the skip makes it fail withDockerModelUpdateRefused { service: "qwen" }.docs/design/cluster-inference-compatibility.mdnow points Fabric health integration to Apply always fails at Fabric readiness; the pinned Fabric has no health API and is not on main #13031, as docs: state that apply fails at Fabric readiness #13032 did for the rest of the docs.cargo ciat bc5e531: 1582 tests + 144 lifecycle, 615 s, all passed.Depends on / merge order
split/6-cluster-reconciler.v1(merged): cluster bearer vLLM images must carryorg.nemoclaw.inference.routes=openai-v2.v1(merged): the NetworkPolicy warning usesProgress::Warning.bound_fieldsinv1(done): thenemoclaw-tofuand provider test-support hunks extend it (checked above). It landed as feat(tofu): reject refreshes that change a bound field #13126, unchanged from refactor(openshell-provider): inject a Services hook for cluster grants and profile sources #13060.examples/kubernetes/local-{vllm,ollama}.yaml. It must remove:services/registry.rsvalidate_providerand its testsandboxes_cannot_route_to_cluster_model_services_yet;crates/test-support/cluster-models/and its 17 references;kubernetes.md, the "cannot route … yet" sentences (it restores the example links, the examples' context paragraph and the routing paragraphs left out here); ininference.md, the service-mode table row.cluster_services_provision_retained_storage_and_workloads_before_agents([tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736's…_and_publish_their_cluster_endpoint), [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736'scluster_endpoint_provenance_preserves_literal_kubeconfig_contexts, and the "on Docker as well as Kubernetes" phrases and cluster example references ininference.md, which describe feat(sdk): route sandboxes on Kubernetes gateways to in-cluster model servers #13063's cluster cases of the context advisory.Differences from #12736
Apart from the routing that #13063 adds:
kubernetes.{cpuLimitMillis,memoryLimitGiB,updatePolicy}aliases, deprecation warnings, normalization or docs. The 8cluster_service_configtests that used the legacy layout were rewritten to thecontainerlayout and service-levelupdatePolicy, and the fixturescluster_documentandcluster_recipe_documentwith them; [tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736'smissing_or_duplicated_moved_fields_report_their_current_and_legacy_pathsandportable_service_settings_preserve_cluster_resource_specs_across_legacy_migrationare not included.portable_cluster_limits_and_update_policy_reject_…now asserts that the old locations are unknown fields.cluster_update_policy_defaults_to_preserve_…checks the policy in the compilednemoclaw_kubernetes_servicespec instead of deserializing a legacykubernetes.updatePolicy.portable_container_memory_limits_cover_shared_memory_and_recipe_preparation_on_docker, which feat(services)!: add container limits and updatePolicy for Docker model services #13058 moved toruntime_compile.rs, is not repeated incluster_service_config.rs.container.*.reference/cli.md: the NetworkPolicy warning applies to every cluster service, including bearer vLLM, not only unauthenticated ones ([tracking] feat(kubernetes): manage vLLM and Ollama services (split) #12736's text contradicted the code andinference.md).nemoclaw-provider::contractbudget raised (above).Split from #12736.
🤖 Generated with Claude Code