Skip to content

feat(openshell-provider): add openshell_inference - #13252

Merged
cv merged 5 commits into
v1from
feat/openshell-inference
Oct 15, 2026
Merged

cv merged 5 commits into
v1from
feat/openshell-inference

Conversation

@cv

@cv cv commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Part of #13228. Part of #13131.

Failure

Registering an inference server took two resources that had to agree:

  • a profile named nemoclaw-inference-<name>;
  • a registration with the same owner and generation.

Both took the server's endpoint as a plain string (ref.endpoint), even though readiness reads export a complete server ref. The travel example and every hand-written configuration repeated that bookkeeping.

Decision

  • New resource openshell_inference owns both objects. It takes:

    • workspace, a ref; its owner comes from the workspace;
    • name, the registration's name; the profile is nemoclaw-inference-<name>;
    • server, the inference_server ref of vllm_readiness, ollama_readiness, ollama_proxy_readiness, or openshell_external_inference_server, which supplies the endpoint and the credential's variable or source;
    • api (openai-completions, openai-responses, or anthropic-messages);
    • binaries;
    • optional cluster_source.

    Whether the profile is authenticated follows from the server's credential. Any input change replaces the resource.

  • openshell_web_search's backend becomes a shared composite module serving both kinds. Each kind supplies its two rows, its plan validation, the registration fields an observation reports back, and the input whose emptiness marks a missing registration: endpoint for inference, because credential_env may legitimately be empty.

  • Its ref is the shared openshell_provider type, so sandboxes take it in providers.

  • examples/hcl/travel now uses openshell_inference with server = data.ollama_readiness.nemotron.ref.

  • Schema compromise: server shows as optional in the schema. A reference attribute is optional when all the fields it carries are, and endpoint must be optional so that a missing registration shows as drift. Plans reject a missing server, as they reject missing web search inputs. Letting a field be empty in observations while required in configuration would remove all three compromises; that would be a separate change to nemoclaw-tofu.

Generated graphs still emit the separate profile and registration. Switching them to openshell_inference with readiness server refs, and removing the old types, is the follow-up that completes #13228.

Validation

  • New contract test inference_owns_its_profile_and_registration covers:

    • creating both objects from a server ref, with a sandbox attaching the resource's ref;
    • a no-op re-plan;
    • replacement after the registration disappears;
    • removal once the sandbox is gone.

    It failed before the change with an invalid resource type. The web search contract tests pass through the shared module.

  • The travel_example e2e test passes with the example using the server ref.

  • Plain cargo ci passes locally: 1540 unit tests and 144 lifecycle tests.

cv added 5 commits October 15, 2026 01:08
Contract test web_search_owns_its_profile_and_registration still fails:
the profile ensure returns BindingMismatch.
One resource owns a web search provider's OpenShell profile and
registration. Its owner comes from its workspace ref, its OpenShell names
derive from its inputs, and a missing half shows as drift and replaces
it. Registrations and web search export refs of the shared
openshell_provider type that sandboxes take in providers. Generated
graphs emit it in place of the search profile and registration, and the
SDK record version moves to 14.
One resource owns an inference server's OpenShell profile and
registration. It takes the server's ref from a readiness read, its owner
from its workspace ref, and an api; the profile is named after the
registration. openshell_web_search's backend becomes a composite module
serving both kinds. The travel example registers its server with it.
# Conflicts:
#	crates/nemoclaw-openshell/src/inputs.rs
#	crates/nemoclaw-openshell/src/lifecycle.rs
#	crates/nemoclaw-sdk/src/tofu_ui.rs
#	crates/openshell-provider/src/client.rs
#	crates/openshell-provider/src/lib.rs
#	docs/provider.md
@cv
cv enabled auto-merge (squash) October 15, 2026 09:00
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit 99e7454 into v1 Oct 15, 2026
@cv
cv deleted the feat/openshell-inference branch October 15, 2026 09:15
cv added a commit that referenced this pull request Oct 15, 2026
)

Part of #13228. Part of #13131.

## Failure

Generated graphs still registered each inference provider as two
resources, a provider profile and a registration, that had to agree on
names, owner, and generation. Hand-written HCL already uses
`openshell_inference` (#13252), so the two shapes diverged.

## Decision

- **One resource per provider.** Generated graphs emit
`openshell_inference.inference_<key>` for each selected inference
provider. It carries `api` (`anthropic-messages` or
`openai-completions`) in place of `provider_type` and `authenticated`,
and its `binaries` come from the harness, as the profile's did.
- **Literal server for now.** The `server` input is a literal
`inference_server` object built from the provider definition: endpoint,
credential variable, and managed credential source. That keeps behavior
unchanged. Reading servers through readiness reads and the blocking
external check is the next step; it changes behavior and needs fake
model servers in tests, so it gets its own PR.
- **Shared derivation.** Profile and registration row derivation moves
into `nemoclaw_openshell::pairs`, so the test fixtures expand compiled
`openshell_inference` and `openshell_web_search` resources the same way
the provider does.
- **Export, reporting, and the CLI** use the new kind and address:
sources and progress key on `openshell_inference.inference_<key>`, and
export compares `api`.
- **Old state.** The SDK record version is now 15, so state holding the
separate inference profile and registration is rejected with a recovery
message.
- **Recovery.** A registration deleted outside OpenTofu now plans a
replacement (`delete`, `create`) instead of a create. The surviving
profile is recreated identically, because generated graphs set the
generation, and sandboxes are unaffected.

The old `openshell_provider_profile` and
`openshell_provider_registration` types remain for hand-written
configurations until a later PR removes them.

## Validation

- SDK, CLI, e2e, contract, and fixture tests updated to the new shape:
counts drop by one resource per provider, and sources and addresses are
renamed. The compiled fixtures are regenerated, and the contract harness
supplies inference credentials from `server`.
- The state test rejects version 14 records.
- Plain `cargo ci` passes locally: 1542 unit tests and 144 lifecycle
tests.
cv added a commit that referenced this pull request Oct 15, 2026
…hell_provider_registration (#13257)

Closes #13228. Part of #13131.

## Failure

`openshell_inference` (#13252) and `openshell_web_search` (#13246)
replace the separate provider profile and registration types. Generated
graphs stopped emitting the old types in #13253. They were still served,
though, and fell short in ways that only showed once nothing else
covered them:

- `openshell_inference` replaced itself on any input change, including a
rotated credential reference. OpenShell refuses to delete a registration
a sandbox attaches, so rotating a key on a running deployment would have
failed. The old registration rotated keys in place.
- A missing profile replaced the resource for the same reason, and
failed the same way. The old profile resource simply recreated it.
- Omitting an optional input such as a credential, `binaries`, or
`cluster_source` silently kept the previous value instead of resetting
it.
- The composite read didn't report the registration's observed owner and
generation, so a registration taken over by another owner went
unnoticed.

## Decision

- **Old types removed.** The `openshell` provider no longer serves
`openshell_provider_profile` or `openshell_provider_registration`. The
profile and registration kinds remain only as the backend operations the
composite resources delegate to. Their type names, exports, references,
and structured inputs are gone from `nemoclaw-openshell`.
- **Credential rotation in place.** `openshell_inference` treats
`credential_env` as mutable and replaces only when authentication is
added or removed, the rule the old registration had.
- **Missing profile recreated in place.** For both composite resources,
`binaries` is mutable, and a change replaces only when the refreshed
value was non-empty. An empty value means the profile was missing, so
the change becomes an update that recreates it and leaves the attached
registration alone. A missing registration still replaces the resource;
nothing attaches a profile directly.
- **Omission resets.** Both resources declare `reset_when_omitted` for
their optional inputs, so omission selects the default.
- **Identity checked.** The composite read reports the registration's
owner and generation, and refuses when the profile and registration
disagree.
- **Tests and docs.** The standalone and Fabric contract configurations
use `openshell_inference`. The adapter refresh tests use the composite
definitions, and the fixture helpers and e2e expectations drop the old
types. One refresh test of the old profile's `bound_fields` rule is
removed: no served definition declares that rule now, and
`nemoclaw-tofu` tests it directly. `docs/provider.md` drops the old
types and describes the in-place cases.

The earlier attempt to give Ollama proxy registrations their readiness
read's `ref` (#13255) is closed. That read runs during apply, so the
`ref` was unknown at every plan and forced a replacement on each apply;
details are in #13254. Generated graphs keep literal `inference_server`
objects. Reading servers instead is tracked in #13254 (one root) and
#13256 (external server checks).

## Validation

- Standalone contract tests cover the new rules: credential rotation
keeps the registration's ID, adding or removing authentication replaces
it, a missing profile plans an update with one effect, a missing
registration plans a replacement, and a foreign owner is refused. The
two adapter refresh tests for omission defaults failed until
`reset_when_omitted` was added.
- Plain `cargo ci` passes locally: 1538 unit tests and 144 lifecycle
tests.
- `cargo ci live-docker` passes locally, including
`sdk_docker_proxy_lifecycle_preserves_readiness_and_storage_guards`,
which caught #13255.
@wscurran wscurran added area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality labels Oct 15, 2026
@wscurran wscurran added the v1 NemoClaw v1 branch label Oct 28, 2026
cv added a commit that referenced this pull request Nov 11, 2026
Corrects the inference, model, recipe, SSH placement, and limits pages,
the inference parts of the provider reference, and the generated
configuration reference where they disagree with `v1`, for users who
configure managed or external inference.

## Problem

An audit of these pages against the commits since `v0.1.0-rc9` and the
current code found statements that `v1` contradicts. For example,
`inference.md` says a model change restarts the runtime inside the
existing sandbox, but a changed agent configuration replaces the sandbox
and deletes its files and conversations. Several limits link issues that
are resolved or decided, and two describe gaps that CI's live cases now
cover.

## Change

Each change and what makes it necessary:

- **Sandbox replacement** (`inference.md`, twice): a model, settings, or
image change replaces the agent's sandbox. `compile.rs` sets
`replace_triggered_by` on the agent configuration (#13375), and
`usage.md`'s change path already says so.
- **Default memory limit** (`inference.md`,
`ServiceContainer.memoryLimitGiB` doc comment): NemoClaw sets the 104
GiB limit (`DEFAULT_MEMORY_LIMIT_GIB`); Docker has no such default.
- **Fields Ollama rejects** (`inference.md`): `kind: ollama` has no
`kvCacheGiB`, `batchTokens`, `recipe`, `serving.modelName`, or
`authentication`, and its schema objects set `additionalProperties:
false`, so a zero value is rejected too; the page said only nonzero
values were.
- **GPU selection** (`inference.md` managed Ollama prerequisites,
`models.md` Nemotron example): a host with several GPUs works when
`container.gpuDevices` selects one (#13929).
- **Managed Ollama replies** (`inference.md`, `limits.md`): CI's
`docker-openclaw-hermes-ollama` live case gets a Hermes reply through
managed Ollama with `qwen3:0.6b` on the Linux AMD64 GPU runner, so "GPU
inference and agent replies have not been tested" is replaced by what
the case covers; tool use and other GPUs stay limits. The Hermes context
section now says only what was observed: `Qwen/Qwen3-4B` can't meet
Hermes's 64,000-token minimum, and Hermes replied with `qwen3:0.6b` at
32,768 tokens in that case; it no longer states an unverified mechanism.
The limits row also covers harnesses other than Hermes.
- **Linux AMD64 row removed** (`limits.md`): the hosted live cases reach
agent replies on Linux AMD64 on every CI run.
- **SSH engines** (`remote-service.md`, `limits.md`): retained-data
removal on SSH engines is verified and the Docker procedure covers it
(#12640, completed); the SSH capacity collector is a POSIX shell script,
not Python (`hardware/ssh.rs`); SSH placement on GPU hardware has no
live test (#12641).
- **Decided issues** (`inference.md`, `limits.md`): a managed NIM
service is not planned, and NIM works as an external endpoint (#12649);
network-request approval and policy explanation belong to OpenShell's
policy advisor, and `grants` replace presets (#12651), now two rows. The
DGX Station rows, whose issues closed for replanning, point to #12641.
- **Provider reference** (`provider.md`): `openshell_inference` takes a
readiness `ref` as `server` (#13252), so the "until inference
registrations take the ref" workaround is gone. Each deployment is one
OpenTofu root (#13254, #13286), so the readiness and gateway sections
describe one generated graph, in which OpenShell objects wait for every
runtime resource and readiness read, instead of separate runtime and
OpenShell graphs. Not checking external servers is by design (#13256).
- **Plan-time configuration checks** (`agents.md`): #13319 is closed;
#14148 tracks checking at plan time.
- **Diagnostic limit** (`models.md`, `limits.md`): once a command's
OpenTofu diagnostics exceed 16 KiB, the SDK replaces them with `child
output exceeds the supported limit` (`process.rs`, #14399), which can
hide vLLM's exit excerpt.
- **Parser names** (`models.md`): NemoClaw checks only a parser name's
form (`PARSER` in `vllm/constraints.rs`); vLLM rejects an unknown parser
at startup, and the stop detail carries its error (#14397).
- **Several GPUs** (`inference.md`, `models.md`): the statements about
several selected GPUs apply once #14384 lifts `container.gpuDevices`'s
one-entry limit, and the pages say so.
- **Speculative tokens** (`recipes.md`): `serving.speculativeTokens`
works only with a recipe and passes `--speculative-config` with the
`mtp` method (`arguments.rs`, `vllm/schema.rs`); no guide described it.
- **Configuration reference**: the container descriptions mention GPU
selection, and the guide links for `ServiceContainer`,
`ServiceUpdatePolicy`, the Ollama types, `ExternalOllama`, and
`ServiceAuthentication` point to their sections instead of the general
usage page. `Overrides.model` names each managed service's served model
(`served_model` in `vllm/config.rs`, `services/registry.rs`); it named
only vLLM's. The generator's dead `OllamaProxy` arm is removed.
Regenerated with `nemoclaw-build schema`.

Checked and left unchanged: the recent multi-GPU changes (#14388 to
#14401), the vLLM bearer route filter, timeout budgets, profile catalog,
memory reserves, hardware profiles, onboarding catalogs, Ollama and vLLM
pins, image tags, interface pages, and the OAuth-refresh guide match
`v1`.

Left for follow-up, because no open issue tracks them:

- Limits and `inference.md` sentences link issues closed for replanning
with no successor: #12035 (llama.cpp, Model Router, Gemini), #12038
(hosted-provider guides), #12144, #12037, #12137, and #12042.
- `agents.md` links #13313 for Hermes not sending API placeholders to
MCP servers; #13313 tracked the `api` credential type.
- The OpenClaw walkthrough row links #13372, which is fixed; whether the
walkthrough was rehearsed afterward is unrecorded.
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants