Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
aa8034e
fix(inference): release superseded Ollama model on provider switch
yimoj Oct 9, 2026
a53b96c
fix(inference): remove obsolete Ollama ownership path
yimoj Oct 9, 2026
fed3637
Merge origin/main into fix/12677-unload-ollama-on-provider-switch
yimoj Oct 9, 2026
d706ee7
fix(inference): protect shared Ollama models during destroy
yimoj Oct 9, 2026
681c18a
test(inference): align destroy cleanup ownership harness
yimoj Oct 9, 2026
d85ceaa
Merge remote-tracking branch 'origin/main' into fix/12677-unload-olla…
yimoj Oct 12, 2026
c7350e0
refactor: share sandbox phase capture
yimoj Oct 12, 2026
ff0f6c7
Merge remote-tracking branch 'origin/main' into fix/12677-unload-olla…
yimoj Oct 12, 2026
43bf8e3
test: mock shared sandbox phase capture
yimoj Oct 12, 2026
b21b92a
Merge remote-tracking branch 'origin/main' into fix/12677-unload-olla…
yimoj Oct 12, 2026
0904dfd
test: align ownership capture output fixture
yimoj Oct 12, 2026
776e117
fix(inference): serialize Ollama route transitions
yimoj Oct 12, 2026
90c5240
docs(inference): clarify Ollama retry failures
yimoj Oct 12, 2026
e31627b
test(onboard): cover concurrent Ollama ownership transitions
yimoj Oct 12, 2026
a387aba
fix(ollama): scope cleanup retries to sandbox lifecycle (#12677)
yimoj Oct 12, 2026
e753124
test: match connect timeout message case-insensitively (#12677)
yimoj Oct 12, 2026
2d7d505
Merge remote-tracking branch 'origin/main' into fix/12677-unload-olla…
yimoj Oct 12, 2026
1fbe1b5
fix(ollama): guide legacy cleanup recovery (#12677)
yimoj Oct 12, 2026
6a52cb9
fix(ollama): harden ownership cleanup recovery (#12677)
yimoj Oct 12, 2026
81b5271
fix: fail closed on incomplete Ollama inventory
yimoj Oct 12, 2026
c11b483
Merge remote-tracking branch 'origin/main' into fix/12677-unload-olla…
yimoj Oct 12, 2026
43b1758
test: resolve Ollama peers to recorded gateway
yimoj Oct 12, 2026
a09be40
Merge remote-tracking branch 'origin/main' into fix/12677-unload-olla…
yimoj Oct 12, 2026
d08def1
test: include active peer in destroy inventory
yimoj Oct 12, 2026
7ab029c
fix(inference): retain host receipt for stopped peers
yimoj Oct 13, 2026
b36bdf6
Merge remote-tracking branch 'origin/main' into fix/12677-unload-olla…
yimoj Oct 13, 2026
c468360
chore(inference): align conflict files with main for branch update
rsliter Oct 26, 2026
935998f
Merge branch 'main' into fix/12677-unload-ollama-on-provider-switch
rsliter Oct 26, 2026
5b68ff8
fix(inference): reconcile Ollama cleanup with current main
rsliter Oct 26, 2026
bb7f71b
fix(inference): satisfy cleanup PR guardrails
rsliter Oct 26, 2026
e2871db
Merge branch 'main' into fix/12677-unload-ollama-on-provider-switch
rsliter Oct 26, 2026
6648e4c
fix(ollama): reject gateway override during ownership probe
rsliter Oct 27, 2026
d491bc7
chore(e2e): align conflict files with target branch
rsliter Oct 27, 2026
9a79e3e
Merge branch 'main' into fix/12677-unload-ollama-on-provider-switch
rsliter Oct 27, 2026
770eaaf
test(e2e): retain GPU and Python workflow boundary checks
rsliter Oct 27, 2026
ab7f863
fix: limit OpenShell phase probe environment
rsliter Oct 27, 2026
cfd8e06
test: keep GPU provider-switch validation credential-free
rsliter Oct 27, 2026
76d6845
fix: retain Ollama token mode check and simplify ownership imports
rsliter Oct 27, 2026
ccb9dbb
fix: preserve Ollama cleanup ownership on provider switch
rsliter Oct 27, 2026
1d4def1
Merge branch 'main' into fix/12677-unload-ollama-on-provider-switch
rsliter Oct 27, 2026
322ed37
test: preserve provider-switch profile coverage after main sync
rsliter Oct 27, 2026
d82fd07
fix(ollama): share fail-closed ownership discovery during destroy
rsliter Oct 27, 2026
faab805
merge: resolve conflicts with main
github-actions[bot] Oct 27, 2026
052243a
merge: resolve conflicts with main
github-actions[bot] Oct 27, 2026
48638bf
test(onboard): split Ollama cleanup regression tests
rsliter Oct 28, 2026
2a6154f
test(destroy): model sibling phases in cross-root fixtures
rsliter Oct 28, 2026
b7b9c7a
test(destroy): keep fixture branching in support harness
rsliter Oct 28, 2026
60e6364
test(e2e): cover Ollama switch through re-onboarding
rsliter Oct 28, 2026
886b3e8
docs: clarify recovery for absent legacy Ollama model
rsliter Oct 28, 2026
9376e20
docs: match implicit Ollama latest tag during cleanup
rsliter Oct 28, 2026
7909500
test(e2e): exercise ordinary provider switch after Ollama
rsliter Oct 28, 2026
f8887a6
Merge branch 'main' into fix/12677-unload-ollama-on-provider-switch
rsliter Oct 28, 2026
6e04e46
test(e2e): keep Ollama model resident through provider switch
rsliter Oct 28, 2026
857dfdf
docs: clarify Ollama model aliases during manual cleanup
rsliter Oct 28, 2026
237e65f
docs: distinguish sandbox and host-service Ollama cleanup
rsliter Oct 28, 2026
661cdd9
docs: clarify Ollama ownership and manual cleanup
rsliter Oct 28, 2026
081f92d
fix(ollama): keep legacy receipt recovery deferred
rsliter Oct 28, 2026
c42c6ea
docs(ollama): correct recovery and E2E contract wording
rsliter Oct 28, 2026
4e5ed96
docs(ollama): name every model in cleanup guidance
rsliter Oct 28, 2026
6a25f56
Merge branch 'main' into fix/12677-unload-ollama-on-provider-switch
rsliter Oct 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/source-architecture-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"src/lib/adapters/openshell/client.ts": 18,
"src/lib/adapters/openshell/command-argv.ts": 17,
"src/lib/adapters/openshell/resolve.ts": 22,
"src/lib/adapters/openshell/runtime.ts": 41,
"src/lib/adapters/openshell/runtime.ts": 42,
"src/lib/adapters/openshell/sandbox-observer-cli.ts": 21,
"src/lib/adapters/openshell/sandbox-observer.ts": 35,
"src/lib/adapters/openshell/timeouts.ts": 23,
Expand Down
14 changes: 9 additions & 5 deletions docs/inference/set-up-ollama.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,18 @@ Windows-host Ollama does not receive this Linux recovery guidance.

## Release GPU Memory

When you destroy an Ollama-backed sandbox or stop host services, NemoClaw asks Ollama to unload each currently loaded model by sending `keep_alive: 0`.
When you destroy a sandbox, NemoClaw asks Ollama to unload its current model and models recorded for lifecycle-scoped cleanup retry, but only after verifying that no other active sandbox uses each model. If ownership cannot be verified, no model is unloaded. Other models resident on the shared host daemon are left alone. Legacy pending cleanup receipts lack ownership identity and are left untouched.
The host-service commands `$$nemoclaw stop` and `$$nemoclaw tunnel stop` run host-wide Ollama cleanup, which may unload unrelated resident models.
When you stop a single Ollama-backed sandbox, NemoClaw unloads only that sandbox's own model.
It leaves the model loaded only when OpenShell reports that another matching Ollama-backed sandbox is active.
It keeps the model loaded when OpenShell reports that another active sandbox uses the same local Ollama daemon and model.
Stopped or incomplete sibling registry rows do not retain the model.
If NemoClaw cannot verify sibling state, it does not unload the model and `stop` exits nonzero.
When you re-onboard an existing Ollama-backed sandbox onto a different model, NemoClaw unloads the model it replaced, with the same sibling protection.
A re-onboard that keeps the same model leaves it loaded, because the new route can still be served by the same Ollama daemon.
This cleanup runs on a best-effort basis and does not delete downloaded model files.
When you re-onboard an Ollama-backed sandbox from the host Ollama route to a different model or provider, NemoClaw checks live ownership before releasing its previous model.
If another active sandbox uses the same local Ollama model, NemoClaw keeps it loaded.
If NemoClaw cannot verify whether another sandbox uses the model, it keeps the model loaded and attempts to record cleanup for retry while leaving the new route active. When NemoClaw reports that retry state could not be recorded, keep every listed model loaded until you manually verify that no active matching sandbox owns each one, then release only the listed models from the local Ollama host.
If the new route uses the same model through the same local daemon, NemoClaw keeps the model loaded.
If the unload cleanup fails, the new route remains active and NemoClaw attempts to record the model for cleanup retry. Rerun onboarding or run `$$nemoclaw <name> destroy` to retry it; if the warning says the retry state could not be recorded, use its reported manual-release guidance instead.
This cleanup is best-effort and does not delete downloaded model files.

## Related Topics

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ The sandbox must be running for `nemohermes my-assistant gateway-token --quiet`

### `$$nemoclaw <name> destroy`

Stop managed local inference resources, remove runtime-provider-owned resources created during onboarding, and delete the sandbox. This removes the sandbox from the registry. NemoClaw resolves the registry that owns the sandbox before it starts cleanup, even when another local OpenShell gateway is active. If `OPENSHELL_GATEWAY_ENDPOINT` is set, `destroy` refuses to probe or delete the sandbox; unset the variable and retry. For Ollama-backed sandboxes, `destroy` also asks Ollama to unload currently loaded models and clears stale auth proxy state on a best-effort basis.
Stop managed local inference resources, remove runtime-provider-owned resources created during onboarding, and delete the sandbox. After confirmed deletion, `destroy` removes the sandbox from the registry only when required cleanup and ownership checks succeed. If Ollama cleanup or ownership verification fails, it retains the registry entry; follow the reported recovery action and retry `destroy`. NemoClaw resolves the registry that owns the sandbox before it starts cleanup, even when another local OpenShell gateway is active. If `OPENSHELL_GATEWAY_ENDPOINT` is set, `destroy` refuses to probe or delete the sandbox; unset the variable and retry. For Ollama-backed sandboxes, `destroy` unloads only that sandbox's current Ollama model and any models recorded for a cleanup retry. It preserves a model still used by an active matching sandbox, and clears stale auth proxy state on a best-effort basis.

`destroy` considers retirement of the host-global `nemoclaw-vllm` container for a sandbox with provider `vllm-local`, including Local NIM.
It requires confirmed sandbox deletion and no remaining registered `vllm-local` consumer in any gateway state root.
Expand Down
28 changes: 25 additions & 3 deletions src/lib/actions/sandbox/destroy-cross-root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

import {
configureSiblingSandboxAfterDelete,
createDestroyHarness,
resetDestroyModuleCache,
} from "../../../../test/helpers/destroy-flow-test-harness";
Expand Down Expand Up @@ -96,7 +97,14 @@ describe("destroySandbox cross-root registry authority", () => {
it("cleans up the destroyed gateway while preserving a sandbox on another gateway", async () => {
writeGatewayRegistry(home, 8244, "alpha");
writeGatewayRegistry(home, 8245, "beta");
const harness = createDestroyHarness();
const harness = createDestroyHarness({
sandboxListResult: {
status: 0,
stdout: "NAME PHASE\nalpha Ready\nbeta Ready",
stderr: "",
},
});
configureSiblingSandboxAfterDelete(harness, "beta", ["alpha"]);

await expect(
harness.destroySandbox("beta", { yes: true, cleanupGateway: true }),
Expand All @@ -120,7 +128,14 @@ describe("destroySandbox cross-root registry authority", () => {
writeGatewayRegistry(home, 8244, "alpha");
writeGatewayRegistry(home, 8245, "beta");
const betaRegistryFile = path.join(home, ".nemoclaw", "gateways", "8245", "sandboxes.json");
const harness = createDestroyHarness();
const harness = createDestroyHarness({
sandboxListResult: {
status: 0,
stdout: "NAME PHASE\nalpha Ready\nbeta Ready",
stderr: "",
},
});
configureSiblingSandboxAfterDelete(harness, "beta", ["alpha"]);
harness.withGatewayRouteMutationLockSpy
.mockImplementationOnce(async (_gatewayName: unknown, operation: unknown) =>
(operation as () => Promise<unknown>)(),
Expand Down Expand Up @@ -232,7 +247,13 @@ describe("destroySandbox cross-root registry authority", () => {
},
}),
);
const harness = createDestroyHarness();
const harness = createDestroyHarness({
sandboxListResult: {
status: 0,
stdout: "NAME PHASE\nalpha Ready\nbeta Ready",
stderr: "",
},
});

await expect(
harness.destroySandbox("alpha", { yes: true, cleanupGateway: true }),
Expand All @@ -243,6 +264,7 @@ describe("destroySandbox cross-root registry authority", () => {
sandboxes: { beta: { name: "beta" } },
});
expect(harness.cleanupGatewaySpy).not.toHaveBeenCalled();
expect(harness.unloadOllamaModelsSpy).not.toHaveBeenCalled();
expect(harness.removeSandboxSpy).not.toHaveBeenCalled();
});
});
Loading
Loading