Skip to content

feat(sdk): pass the Ollama proxy's readiness ref as the inference server - #13255

Closed
cv wants to merge 9 commits into
v1from
feat/sdk-server-reads
Closed

cv wants to merge 9 commits into
v1from
feat/sdk-server-reads

Conversation

@cv

@cv cv commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Part of #13228. Part of #13131.

Failure

Generated graphs gave every openshell_inference a literal inference_server object (#13253), even when the graph already reads the server. An Ollama proxy and its ollama_proxy_readiness read live in the same graph as the registration, so the read's ref was available but unused.

Decision

  • Proxy registrations take the read's ref. A registration through an Ollama proxy now takes server = data.ollama_proxy_readiness.<proxy>.ref, and the read gets the proxy's sandbox endpoint as sandbox_endpoint so it exports that ref. The registration's endpoint and credential source now come from the read's observation of the running proxy, as in hand-written HCL.
  • Managed vLLM and Ollama keep literal refs. Their containers and readiness reads are compiled into the separate runtime graph, which the OpenShell graph can't reference. Compile one OpenTofu root instead of separate runtime and OpenShell graphs #13254 plans moving both into one root; a spike there confirmed that pinned OpenTofu can still recover a stopped gateway from one root by planning with the OpenShell resources excluded.
  • No external check. The blocking external server check stays out of generated graphs. It changes behavior, since apply would fail for unreachable or rejected external endpoints, and the test suites would need fake model servers.

Validation

  • The Ollama proxy SDK test now expects the readiness ref and sandbox_endpoint; it failed before the change. The proxy tests that check the computed credential source read it from the compiled targets.
  • Plain cargo ci passes locally: 1540 unit tests and 144 lifecycle tests, including the proxy e2e tests.

cv added 9 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
Generated graphs emit one openshell_inference per selected inference
provider, with a literal inference_server object built from the provider
definition, in place of the separate profile and registration. Row
derivation moves to nemoclaw_openshell::pairs so test fixtures expand
compiled resources as the provider does. Export, reporting, and CLI labels
use the new kind; the SDK record version moves to 15.
…rence

# Conflicts:
#	crates/openshell-provider/src/composite.rs
#	crates/openshell-provider/src/lib.rs
#	docs/provider.md
A registration through an Ollama proxy takes the server ref its
ollama_proxy_readiness read exports, with the proxy's sandbox endpoint as
the read's sandbox_endpoint, instead of a literal object. Managed vLLM and
Ollama servers are read in the separate runtime graph, so their
registrations keep literal refs until #13254.
# Conflicts:
#	crates/nemoclaw-sdk/tests/ollama_proxy.rs
#	docs/provider.md
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv enabled auto-merge (squash) October 15, 2026 10:27
@cv

cv commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator Author

Closing without merging. The live Docker test found a design flaw.

The proxy's readiness read runs during apply (read_trigger), so its ref is unknown at every plan. openshell_inference treats an unknown endpoint or credential source as a possible change to an immutable input. Every apply after the first therefore plans a replacement, which OpenShell refuses while a sandbox attaches the registration: DeleteProvider rejected (FailedPrecondition): provider is attached to a sandbox.

The literal server object from #13253 carries the same values, known at plan. The readiness read still gates the registration through depends_on, so nothing is lost but the observed credential source. The finding is recorded in #13254.

@cv cv closed this Oct 15, 2026
auto-merge was automatically disabled October 15, 2026 10:36

Pull request was closed

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.
cv added a commit that referenced this pull request Oct 15, 2026
#13282)

Part of #13254. Part of #13131.

## Failure

Generated graphs gave every OpenShell and Fabric object `gateway =
${data.openshell_gateway.current.ref}`. In one root (#13254), that read
waits for apply on a fresh install and whenever a gateway resource has a
pending change. The `ref` would then be unknown at plan time, so objects
would plan as changed or replaced, sandboxes included. #13255 hit the
same problem with server refs.

## Decision

Objects take the gateway's `ref` as a literal, built from the same
connection the data source receives, so it's known at plan time.

- **The gateway reads still gate the objects:** every object already
lists `data.openshell_gateway.apply` in `depends_on` and checks
`data.openshell_gateway.current.compatible` in a precondition. Nothing
about ordering or compatibility checks changes.
- **Teardown:** the graphs already had literal refs, so their
substitution is removed, along with `gateway_ref_expression`.
- **Test support:** the OpenShell contract fixtures point each object's
literal at the fake gateway through `var.endpoint`, as they already did
for the data source. The fixture loader accepts the literal.

This changes the graphs but not what they do with today's two stages.

## Validation

- A compile test asserts:
- every object's `gateway` is the literal `openshell_gateway` ref, equal
field by field to what the gateway read receives;
  - each object still depends on `data.openshell_gateway.apply`.
  - It failed before the change.
- `cargo ci` passes locally (1539 unit tests, 144 lifecycle tests).
- `cargo ci live-docker` passes: all 8 live lifecycle tests plus the 3
standalone tests. These re-apply against a running gateway and require
unchanged plans afterward.
@wscurran wscurran added area: providers Inference provider integrations and provider behavior feature PR adds or expands user-visible functionality provider: ollama Ollama local model provider behavior labels Oct 15, 2026
@wscurran wscurran added the v1 NemoClaw v1 branch label Oct 28, 2026
@cv
cv deleted the feat/sdk-server-reads branch November 21, 2026 20:44
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 feature PR adds or expands user-visible functionality provider: ollama Ollama local model provider behavior v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants