Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7a7daf5
feat(onboard): add hosted inference to portable profile
ericksoa Aug 7, 2026
27e493f
feat(onboard): support activated portable credentials
ericksoa Aug 7, 2026
442e8c7
test(onboard): tighten portable inference isolation
ericksoa Aug 7, 2026
75766ca
fix(onboard): skip portable dashboard forwards
ericksoa Aug 7, 2026
e2a45b8
fix(onboard): require portable hosted inference
ericksoa Aug 7, 2026
ab85412
fix(onboard): secure portable inference bootstrap
ericksoa Aug 7, 2026
3a2c90c
merge: resolve conflicts with main
github-actions[bot] Aug 7, 2026
a2deec5
fix(onboard): apply personal policy for portable profile
ericksoa Aug 7, 2026
b62b3be
fix(onboard): bound portable personal policy
ericksoa Aug 7, 2026
8703856
Revert "fix(onboard): bound portable personal policy"
ericksoa Aug 7, 2026
8fcfb17
fix(policy): recover from policy-set transport resets
ericksoa Aug 7, 2026
bb2f814
chore: keep transport recovery production-only
ericksoa Aug 7, 2026
9d95523
fix(onboard): use basic portable network policy
ericksoa Aug 7, 2026
268d391
fix(onboard): install compact portable policy set
ericksoa Aug 7, 2026
beb7b2b
fix(onboard): use balanced portable policy tier
ericksoa Aug 7, 2026
cc6b7c1
fix(policy): compose personal tier for openshell 0.0.99
ericksoa Aug 7, 2026
4c3fac4
chore(deps): upgrade openshell to 0.0.101
ericksoa Aug 7, 2026
4de5086
fix(onboard): recover portable resume lifecycle
ericksoa Aug 7, 2026
5718a06
fix(build): handle rootless perl icmp tests
ericksoa Aug 7, 2026
7f5d758
fix(build): avoid intentional perl crash popup
ericksoa Aug 7, 2026
9e40284
fix(portable): preserve gateway state on resume
ericksoa Aug 7, 2026
413df3f
fix(installer): restore portable build input
ericksoa Aug 8, 2026
ce4c02d
fix(portable): reopen authoritative gateway state
ericksoa Aug 8, 2026
f4f0937
fix(portable): enroll committed sandbox container
ericksoa Aug 8, 2026
1bfb3c7
fix(portable): discover exact OpenShell container
ericksoa Aug 8, 2026
3fd5d1d
fix(portable): resolve Docker-owned sandbox container
ericksoa Aug 8, 2026
e969c9f
fix(portable): match OpenShell Podman labels
ericksoa Aug 8, 2026
a98754e
Merge branch 'main' into feat/portable-remote-inference-bootstrap
cv Aug 8, 2026
76a8d5d
fix(portable): recover replaced sandbox containers
ericksoa Aug 8, 2026
6f08ad7
fix(portable): always restart GFN sandbox
ericksoa Aug 8, 2026
5d70484
merge: resolve conflicts with main
github-actions[bot] Aug 8, 2026
75e4341
fix(portable): persist Podman container metadata
ericksoa Aug 8, 2026
e014b1e
fix(portable): keep Podman state in durable home
ericksoa Aug 8, 2026
84dde51
fix(portable): isolate Podman image cache
ericksoa Aug 8, 2026
bad3134
fix(portable): persist complete Podman store
ericksoa Aug 8, 2026
64779f0
fix(portable): remove registry on uninstall
ericksoa Aug 8, 2026
434f35b
fix(portable): remove UID-mapped stores
ericksoa Aug 8, 2026
1f94fde
fix(portable): recover stale Podman namespace
ericksoa Aug 8, 2026
793a339
fix(portable): retry Podman 5.4 migration panic
ericksoa Aug 8, 2026
9cf097f
fix(portable): pin OpenShell 0.0.85
ericksoa Aug 8, 2026
4e3f478
fix(portable): restore podman run state on resume
ericksoa Aug 8, 2026
82ccbc9
fix(portable): isolate OpenShell 0.0.85 fallback
ericksoa Aug 8, 2026
1d08909
fix(onboard): restore dashboard registration variable
ericksoa Aug 8, 2026
270df38
fix(portable): restore receipt container run directory
ericksoa Aug 8, 2026
f4a0e76
fix(portable): restore video-era OpenShell 0.0.85 runtime
ericksoa Aug 8, 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
89 changes: 89 additions & 0 deletions src/lib/onboard/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { loadServingCatalog } from "../inference/serving/catalog-loader";
import { servingProfileProvenance } from "../inference/serving/profile-provenance";
import { resolveOnboardOptions, runOnboardCommand } from "./command";
import type { OnboardFlags } from "./command-support";
import { PortableInferenceSourceError } from "./experimental/portable-inference-source";
import { invalidGatewayManagementDeclarationError } from "./gateway-management";
import { GatewayAuthorityError } from "./gateway-teardown-authority";

Expand Down Expand Up @@ -484,6 +485,94 @@ describe("onboard command options", () => {
});
});

it("uses the portable hosted inference descriptor without starting local inference", async () => {
const env: NodeJS.ProcessEnv = {
S3_BUCKET: "portable-inference",
S3_KEY: "path/credential.b64",
COMPATIBLE_API_KEY: "previous-compatible-key",
NEMOCLAW_ENDPOINT_URL: "https://previous.example.test/v1",
NEMOCLAW_PREFERRED_API: "openai-responses",
NEMOCLAW_PROVIDER: "previous-provider",
NEMOCLAW_MODEL: "previous-model",
};
const observed: Record<string, string | undefined> = {};
const resolvePortableInferenceSource = vi.fn(() => ({
apiKey: "test-credential-value-1234",
baseUrl: "https://inference.example.test/v1",
model: "example/model-1",
}));

await runOnboardCommand({
flags: { "experimental-profile": "portable" },
env,
resolvePortableInferenceSource,
runOnboard: async () => {
for (const key of [
"COMPATIBLE_API_KEY",
"NEMOCLAW_ENDPOINT_URL",
"NEMOCLAW_PREFERRED_API",
"NEMOCLAW_PROVIDER",
"NEMOCLAW_MODEL",
"NEMOCLAW_OLLAMA_NO_AUTOSTART",
]) {
observed[key] = env[key];
}
},
});

expect(resolvePortableInferenceSource).toHaveBeenCalledWith(env);
expect(observed).toEqual({
COMPATIBLE_API_KEY: "test-credential-value-1234",
NEMOCLAW_ENDPOINT_URL: "https://inference.example.test/v1",
NEMOCLAW_PREFERRED_API: "openai-completions",
NEMOCLAW_PROVIDER: "custom",
NEMOCLAW_MODEL: "example/model-1",
NEMOCLAW_OLLAMA_NO_AUTOSTART: "1",
});
expect(env).toMatchObject({
S3_BUCKET: "portable-inference",
S3_KEY: "path/credential.b64",
COMPATIBLE_API_KEY: "previous-compatible-key",
NEMOCLAW_ENDPOINT_URL: "https://previous.example.test/v1",
NEMOCLAW_PREFERRED_API: "openai-responses",
NEMOCLAW_PROVIDER: "previous-provider",
NEMOCLAW_MODEL: "previous-model",
});
});

it("stops before onboarding when the portable inference descriptor cannot be resolved", async () => {
const env: NodeJS.ProcessEnv = {
S3_BUCKET: "portable-inference",
S3_KEY: "path/credential.b64",
NEMOCLAW_PROVIDER: "previous-provider",
};
const runOnboard = vi.fn();
const errors: string[] = [];

await expect(
runOnboardCommand({
flags: { "experimental-profile": "portable" },
env,
resolvePortableInferenceSource: () => {
throw new PortableInferenceSourceError(
"Portable hosted inference received an invalid descriptor.",
);
},
runOnboard,
error: (message = "") => errors.push(message),
exit: exitWithCode,
}),
).rejects.toThrow("exit:1");

expect(runOnboard).not.toHaveBeenCalled();
expect(errors).toEqual([" Portable hosted inference received an invalid descriptor."]);
expect(env).toEqual({
S3_BUCKET: "portable-inference",
S3_KEY: "path/credential.b64",
NEMOCLAW_PROVIDER: "previous-provider",
});
});

it("scopes an agents manifest to one onboarding run", async () => {
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-agents-manifest-"));
const manifestPath = path.join(tmpDir, "agents.yaml");
Expand Down
51 changes: 40 additions & 11 deletions src/lib/onboard/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ import {
type ExperimentalOnboardProfile,
PORTABLE_EXPERIMENTAL_PROFILE,
} from "./docker-driver-platform";
import {
type PortableInferenceSource,
PortableInferenceSourceError,
resolvePortableInferenceSource,
} from "./experimental/portable-inference-source";
import { GatewayManagementDeclarationError } from "./gateway-management";
import { GatewayAuthorityError, gatewayAuthorityFailureLines } from "./gateway-teardown-authority";
import { managedSandboxFeatureIssue } from "./managed-sandbox-feature";
Expand Down Expand Up @@ -76,6 +81,7 @@ export interface ResolveOnboardOptionsDeps {
export interface RunOnboardCommandDeps extends ResolveOnboardOptionsDeps {
flags: OnboardFlags;
runOnboard: (options: OnboardCommandOptions) => Promise<void>;
resolvePortableInferenceSource?: (env: NodeJS.ProcessEnv) => PortableInferenceSource | null;
}

function fail(deps: ResolveOnboardOptionsDeps, message: string): never {
Expand Down Expand Up @@ -340,6 +346,13 @@ function promptCancellationCode(error: unknown): "EOF" | "SIGINT" | null {
return code === "EOF" || code === "SIGINT" ? code : null;
}

function isOnboardInputError(error: unknown): error is Error {
return (
error instanceof GatewayManagementDeclarationError ||
error instanceof PortableInferenceSourceError
);
}

function handleOnboardCommandError(error: unknown, deps: RunOnboardCommandDeps): void {
const cancellationCode = promptCancellationCode(error);
if (cancellationCode === "SIGINT") {
Expand All @@ -349,11 +362,10 @@ function handleOnboardCommandError(error: unknown, deps: RunOnboardCommandDeps):
// oclif as a raw stack trace (#7439).
return;
}
// A rejected NEMOCLAW_GATEWAY_MANAGEMENT contract is operator input error,
// not a crash: print the validation reason as a clean single-line CLI error
// and exit nonzero instead of re-throwing it into a Node.js stack trace
// (#7627). `fail` sets exit code 1.
if (error instanceof GatewayManagementDeclarationError) {
// Operator-owned gateway declarations and portable inference descriptors are
// input errors, not crashes. Print one bounded validation reason instead of
// re-throwing either error into an oclif stack trace (#7627).
if (isOnboardInputError(error)) {
fail(deps, ` ${error.message}`);
}
// Gateway-authority refusals are reported, never rethrown. Recreation is not
Expand All @@ -376,17 +388,24 @@ function handleOnboardCommandError(error: unknown, deps: RunOnboardCommandDeps):
function applyPortableEnvironment(
options: OnboardCommandOptions,
env: NodeJS.ProcessEnv,
resolveInferenceSource: (env: NodeJS.ProcessEnv) => PortableInferenceSource | null,
): () => void {
if (!options.experimentalProfile) return () => {};
const portableEnvDefaults = {
[EXPERIMENTAL_PROFILE_ENV]: options.experimentalProfile ?? undefined,
const hostedInference = resolveInferenceSource(env);
const portableEnvDefaults: Record<string, string> = {
[EXPERIMENTAL_PROFILE_ENV]: options.experimentalProfile,
[TOOL_DISCLOSURE_ENV]: "direct",
NEMOCLAW_PROVIDER: "ollama",
NEMOCLAW_MODEL: "qwen3-vl:4b",
NEMOCLAW_PROVIDER: hostedInference ? "custom" : "ollama",
NEMOCLAW_MODEL: hostedInference?.model ?? "qwen3-vl:4b",
NEMOCLAW_OLLAMA_NO_AUTOSTART: "1",
NEMOCLAW_POLICY_MODE: "suggested",
NEMOCLAW_POLICY_TIER: "personal",
} as const;
};
if (hostedInference) {
portableEnvDefaults.COMPATIBLE_API_KEY = hostedInference.apiKey;
portableEnvDefaults.NEMOCLAW_ENDPOINT_URL = hostedInference.baseUrl;
portableEnvDefaults.NEMOCLAW_PREFERRED_API = "openai-completions";
}
const previousPortableEnv = new Map<string, string | undefined>();
const restore = () => {
for (const [key, value] of previousPortableEnv) {
Expand Down Expand Up @@ -428,14 +447,24 @@ function toolDisclosureEnvironmentOverride(
return flags["tool-disclosure"] !== undefined ? options.toolDisclosure : null;
}

function portableInferenceSourceResolver(
deps: RunOnboardCommandDeps,
): (env: NodeJS.ProcessEnv) => PortableInferenceSource | null {
return deps.resolvePortableInferenceSource ?? resolvePortableInferenceSource;
}

export async function runOnboardCommand(deps: RunOnboardCommandDeps): Promise<void> {
const options = resolveOnboardOptions(deps.flags, deps);
const env = deps.env ?? process.env;
let restorePortableEnvironment = () => {};
let restoreServingProfileEnvironment = () => {};
const previousAgentsManifest = env.NEMOCLAW_EXTRA_AGENTS_JSON;
try {
restorePortableEnvironment = applyPortableEnvironment(options, env);
restorePortableEnvironment = applyPortableEnvironment(
options,
env,
portableInferenceSourceResolver(deps),
);
restoreServingProfileEnvironment = applyServingProfileEnvironment(options, env);
if (options.noOllamaAutostart) env.NEMOCLAW_OLLAMA_NO_AUTOSTART = "1";
// Keep direct callers and the legacy monolithic onboard path on the same
Expand Down
Loading
Loading