Skip to content

feat(runtime): add a readiness command and hold after protective stops - #13487

Closed
gaveezy wants to merge 3 commits into
v1from
feat/runtime-ready-hold
Closed

gaveezy wants to merge 3 commits into
v1from
feat/runtime-ready-hold

Conversation

@gaveezy

@gaveezy gaveezy commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Failure

A platform other than Docker can place the vLLM and Ollama runtimes
from vllm_runtime and ollama_runtime's launch and requirements,
but two things the Docker placement gets from the provider have no
platform-side equivalent:

  • Readiness. Docker readiness reads the runtime's status phase inside
    the container. Elsewhere, docs/inference.md points a probe at
    GET /health. That route exists only for vLLM, and Ollama answers
    HTTP before its model is pulled, so a probe cannot tell when the model
    is served.
  • Memory protection. When the watchdog stops the server, the runtime
    exits. A platform that restarts exited containers, such as a
    Kubernetes Deployment, starts the model again under the same memory
    pressure. docs/design/scope.md requires memory protection "without
    automatic restart loops".

Decision

  • nemoclaw-runtime-ready: the runtime binary under this name, a
    symlink in the vLLM and Ollama images (image/vllm and
    image/ollama), exits 0 only when
    /data/status.json reports ready and the recorded server process
    is still running. It reads only; it neither locks nor writes. A name
    selects it rather than an argument, because older runtimes ignore
    their arguments and would start a second server.
  • The runtime reports initializing as soon as it holds the storage
    lock. A ready status left on retained storage by an earlier
    container therefore never counts. Docker readiness already accepts
    that phase.
  • NEMOCLAW_RUNTIME_ON_STOP=hold: after memory protection stops the
    server, or the operator trips it, the runtime reports stopped and
    stays alive, unready and holding the lock, until the platform stops
    the container. Other failures still exit, so platforms can retry
    them. Omitted or exit keeps today's behavior; any other value stops
    startup. Docker placement doesn't set it.
  • vllm_runtime and ollama_runtime export launch.ready_command.
  • docs/provider.md and docs/inference.md describe both for other
    platforms.

Nothing changes for Docker placement.

Validation

  • New tests:
    • ready_requires_a_ready_phase_and_a_running_server_process:
      missing status, ready with a live or a gone process, every other
      phase, and an incomplete status.
    • only_memory_protection_holds_and_only_when_the_platform_asks and
      the_stop_setting_accepts_only_hold_or_exit.
    • the_launch_names_the_readiness_command_the_runtime_images_install
      checks the contract against both Dockerfiles.
  • Schema snapshots for vllm and ollama regenerated.
  • cargo ci on linux_arm64 (Rust 1.99.1), after merging v1 at
    0bc2601, passed in 193 s: fmt, clippy, build, test (1603 passed,
    199 skipped), schema, bundle and lifecycle (150 passed, 52 skipped),
    all within budget. nemoclaw-build docs --check passed.
  • Not run: runtime image builds and cargo images qualify, which need
    Docker, which this host doesn't have. The Dockerfiles add one RUN ln -s
    layer each.

🤖 Generated with Claude Code

## Failure

A platform other than Docker can place the vLLM and Ollama runtimes
from `vllm_runtime` and `ollama_runtime`'s `launch` and `requirements`,
but two things the Docker placement gets from the provider have no
platform-side equivalent:

- Readiness. Docker readiness reads the runtime's status phase inside
  the container. Elsewhere, docs/inference.md points a probe at
  `GET /health`. That route exists only for vLLM, and Ollama answers
  HTTP before its model is pulled, so a probe cannot tell when the model
  is served.
- Memory protection. When the watchdog stops the server, the runtime
  exits. A platform that restarts exited containers, such as a
  Kubernetes Deployment, starts the model again under the same memory
  pressure. docs/design/scope.md requires memory protection "without
  automatic restart loops".

## Decision

- `nemoclaw-runtime-ready`: the runtime binary under this name, a
  symlink in the vLLM, Ollama and Qwen 3.8 images, exits 0 only when
  `/data/status.json` reports `ready` and the recorded server process
  is still running. It reads only; it neither locks nor writes. A name
  selects it rather than an argument, because older runtimes ignore
  their arguments and would start a second server.
- The runtime reports `initializing` as soon as it holds the storage
  lock. A `ready` status left on retained storage by an earlier
  container therefore never counts. Docker readiness already accepts
  that phase.
- `NEMOCLAW_RUNTIME_ON_STOP=hold`: after memory protection stops the
  server, or the operator trips it, the runtime reports `stopped` and
  stays alive, unready and holding the lock, until the platform stops
  the container. Other failures still exit, so platforms can retry
  them. Omitted or `exit` keeps today's behavior; any other value stops
  startup. Docker placement doesn't set it.
- `vllm_runtime` and `ollama_runtime` export `launch.ready_command`.
- docs/provider.md and docs/inference.md describe both for other
  platforms.

Nothing changes for Docker placement.

## Validation

- New tests:
  - `ready_requires_a_ready_phase_and_a_running_server_process`:
    missing status, ready with a live or a gone process, every other
    phase, and an incomplete status.
  - `only_memory_protection_holds_and_only_when_the_platform_asks` and
    `the_stop_setting_accepts_only_hold_or_exit`.
  - `the_launch_names_the_readiness_command_the_runtime_images_install`
    checks the contract against all three Dockerfiles.
- Schema snapshots for `vllm` and `ollama` regenerated.
- `cargo ci` on linux_arm64 (Rust 1.99.1) passed in 378 s: fmt, clippy,
  build, test (1604 passed, 201 skipped), schema, bundle and lifecycle
  (150 passed, 52 skipped), all within budget. `nemoclaw-build docs
  --check` passed.
- Not run: runtime image builds and `cargo images qualify`, which need
  Docker, which this host doesn't have. The Dockerfiles add one `RUN ln -s`
  layer each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

@gaveezy
gaveezy requested review from cv and sandl99 October 19, 2026 18:00
gaveezy and others added 2 commits October 20, 2026 02:31
v1 removed the Qwen3.8 recipe image (#13506). This branch had added the
`nemoclaw-runtime-ready` symlink to `runtimes/qwen38/Dockerfile`, so the
merge takes v1's deletion. The contract test that checks the readiness
command against the runtime images now covers the two that remain,
vllm and ollama.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v1 moved the runtime images under image/ and builds them with Bake
(#13507), deleting runtimes/vllm/Dockerfile and runtimes/ollama/Dockerfile.
This branch had added the `nemoclaw-runtime-ready` symlink to both, so
the merge takes the deletions and adds the same `RUN ln -s` line to
image/vllm/Dockerfile and image/ollama/Dockerfile, right after the
supervisor binary is copied. The contract test that checks the readiness
command against the runtime images now reads them from image/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wscurran wscurran added area: local-models Local model providers, downloads, launch, or connectivity area: providers Inference provider integrations and provider behavior feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior labels Oct 23, 2026
@cv

cv commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this. It found two real problems, but we're landing a smaller change instead of this PR, so I'm closing it.

  • Stale status on retained storage. A ready left by an earlier container could be read as current. Writing initializing as soon as the runtime takes the storage lock fixes that, and it matters for NemoClaw's own Docker readiness too. We'll land that part separately.
  • GET /health isn't enough for Ollama. Ollama answers HTTP before the runtime has pulled the model. Rather than a NemoClaw-specific readiness command, we'll point platforms at the servers' own interfaces: GET /health for vLLM, and Ollama's own check that the model is present (ollama show <model>) as an exec probe.

We're not taking the other two parts:

  • The readiness command (nemoclaw-runtime-ready, launch.ready_command) builds a NemoClaw status check where vLLM and Ollama already answer the question. The name-based dispatch exists to cope with older runtimes, and the launch contract and image are always pinned together.
  • NEMOCLAW_RUNTIME_ON_STOP=hold keeps a stopped workload alive to defeat the platform's restart policy. Whether to restart an exited container is the platform's decision. The docs will recommend a restart policy that doesn't loop after a protective stop instead.

@cv cv closed this Oct 23, 2026
cv added a commit that referenced this pull request Oct 23, 2026
… storage (#13659)

## Failure

The vLLM and Ollama runtimes write their status to `/data/status.json`,
which persists on retained storage. A new container wrote nothing until
its service reached a later phase, so a `ready` left by an earlier
container could be read as current. That affects NemoClaw's own Docker
readiness, and any platform that reads the status.

Separately, `docs/inference.md` told other platforms to probe `GET
/health`. That's right for vLLM, but Ollama answers HTTP before the
runtime has pulled its model.

#13487 found both. That PR is closed in favor of this smaller change.

## Decision

- Both runtimes record `initializing` as soon as they hold the storage
lock, through a shared `begin` helper, replacing any status an earlier
container left behind. Both of the provider's status readers already
accept `initializing` as not ready (`host_container_health.rs`,
`services/status.rs`).
- `docs/inference.md` points platforms at the servers' own checks: `GET
/health` for vLLM, an exec probe running `ollama show MODEL` for Ollama,
and a restart policy that doesn't restart the model after memory
protection stops it.
- No NemoClaw readiness command and no hold mode: vLLM and Ollama
already answer readiness, and restarting is the platform's decision.

## Validation

- New test
`a_started_runtime_replaces_a_ready_status_left_by_an_earlier_container`
failed before the fix (the helper didn't exist), and passes now.
- `cargo ci` passed, including the bundle and lifecycle steps.
- `cargo ci live-docker` passed all 9 tests, including managed Ollama's
Docker readiness.
- `fern check` reported 0 errors.

Thanks to @gaveezy for #13487, which found both problems.
@wscurran wscurran added the v1 NemoClaw v1 branch label Oct 28, 2026
@cv
cv deleted the feat/runtime-ready-hold 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: local-models Local model providers, downloads, launch, or connectivity area: providers Inference provider integrations and provider behavior feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants