Skip to content

refactor(sdk): extract the managed-model context advisory - #13104

Merged
cv merged 5 commits into
v1from
refactor/sdk-context-advisory
Oct 13, 2026
Merged

cv merged 5 commits into
v1from
refactor/sdk-context-advisory

Conversation

@cv

@cv cv commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Moves the OpenClaw and Hermes context advisory out of Deployment::run into its own module. The warnings stay the same.

Why

#13059 added about 90 lines of advisory logic inline in Deployment::run, between validation and opening the state store. Each of its four warnings repeated the (self.progress)(Progress::Warning { … }) call. Its tests went through Deployment::plan and apply against a missing bundle, and almost every case looped over both operations.

Change

  • deployment::context_advisory::context_warnings(&Document) -> Result<Vec<String>, ConfigError> returns the warnings in sandbox and route order. Deployment::run emits each one as Progress::Warning at the same point as before.
  • The Hermes and OpenClaw checks are separate methods. Messages, thresholds, and metadata handling are unchanged.
  • The unit tests call the function directly, after the same defaults and validate that run performs.
  • A new test, plan_and_apply_report_the_advisory_before_creating_state_or_mutating, checks that plan and apply report the same warnings before they create state or start a mutation. That covers the wiring the old per-test loops checked.

One difference: run now emits warnings after evaluating every route, not as it goes. The lookups that could fail at that point already passed validate, so the output is the same.

Validation

  • cargo test -p nemoclaw-sdk --lib deployment::: 107 passed (12 advisory tests before, 13 now).
  • cargo ci on linux_arm64: all steps passed.

cv added 2 commits October 13, 2026 10:36
ObservationError lost Copy in #13056, and #13081 merged after it with a test
that moves the class twice, so the SDK integration tests no longer compile on
v1 and CI fails at clippy.
Move the OpenClaw and Hermes context advisory out of Deployment::run into
deployment::context_advisory, which returns the warnings for a validated
document. Unit tests call it directly; one test still checks that plan and
apply report the same warnings before creating state or starting a mutation.
Base automatically changed from fix/kubernetes-interruption-build to v1 October 13, 2026 17:53
@cv
cv enabled auto-merge (squash) October 13, 2026 18:12
@cv cv added the v1 NemoClaw v1 branch label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit 337d668 into v1 Oct 13, 2026
@cv
cv deleted the refactor/sdk-context-advisory branch October 13, 2026 18:30
cv added a commit that referenced this pull request Oct 13, 2026
…13105)

Adds `ServiceDefinition` accessors for managed-model settings, so code
outside the registry stops matching on vLLM and Ollama itself.

Stacked on #13104.

## Why

Two places matched `ServiceDefinition::Vllm(s) | Ollama(s)` outside
`registry.rs`:

- the context advisory, to read `serving.context_tokens`;
- `preserve_docker_models`, to read `update_policy`.

`preserve_docker_models` also rebuilt each model container's address
with `format!("nemoclaw_inference_service.inference_{name}")` and
`format!("nemoclaw_ollama_service.{name}")`. Those strings copy the
installers' private `address` helpers. If the installers' naming
changed, the update protection would stop finding the container, and
nothing would report it.

## Change

- `ServiceDefinition::context_tokens`, `update_policy`, and
`model_address` return `None` for an Ollama proxy.
- `model_address` calls the new `installers::{vllm,
ollama}::service_address`, which use the installers' own `address`
helpers.
- `preserve_docker_models` still skips only `Recreate`; every other
policy protects the container.

## Validation

- `cargo test -p nemoclaw-sdk --lib`: 210 passed, including
`docker_model_updates_preserve_running_containers_unless_recreation_is_explicit`,
which finds the protected vLLM and Ollama addresses among the compiled
targets.
- `cargo ci` on linux_arm64: all steps passed.
gaveezy added a commit that referenced this pull request Oct 13, 2026
PR-7 now includes v1 337d668 (#13104), which moves the OpenClaw and
Hermes context advisory from `Deployment::run` into
`deployment::context_advisory` and its tests into
context_advisory/tests.rs.

deployment/context_warnings.rs conflicted: #13104 deletes it, and PR-8
changes its tests. The resolution deletes the file and ports PR-8's test
changes to context_advisory/tests.rs:

- The eight tests that cover both Docker examples also cover the
  cluster vLLM and Ollama examples.
- The tests that used only the Docker vLLM example use the cluster vLLM
  example, which authors maxTokens 2048 and contextWindow 32768.
- `with_route_budget` is gone; it added that budget to the Docker vLLM
  example.

The ported tests call `context_warnings` after `defaults` and `validate`,
as #13104's tests do. PR-8 changes no advisory code: the advisory
already reads `serving.contextTokens` from cluster vLLM and Ollama
services. deployment/mod.rs merges cleanly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wscurran wscurran added area: architecture Architecture, design debt, major refactors, or maintainability area: providers Inference provider integrations and provider behavior integration: hermes Hermes integration behavior integration: openclaw OpenClaw integration behavior refactor PR restructures code without intended behavior change labels Oct 28, 2026
@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: architecture Architecture, design debt, major refactors, or maintainability area: providers Inference provider integrations and provider behavior integration: hermes Hermes integration behavior integration: openclaw OpenClaw integration behavior refactor PR restructures code without intended behavior change v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants