Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
38329e8
feat(onboard): add managed startup profile schema
ericksoa Jul 30, 2026
7f3859a
docs(onboard): clarify startup profile transport encoding
ericksoa Jul 30, 2026
32561a9
fix(onboard): harden managed startup profile
ericksoa Jul 30, 2026
087a9a5
chore(stack): sync PR3.2 with current main
ericksoa Jul 30, 2026
e1845dd
fix(onboard): close startup profile contract gaps
ericksoa Jul 30, 2026
244e3e6
chore(stack): sync PR3.2 with current main
ericksoa Jul 30, 2026
2403316
chore(stack): sync PR3.2 with current main
ericksoa Jul 30, 2026
ea5bd8a
chore(stack): sync PR3.2 with current main
ericksoa Jul 31, 2026
357081a
feat(onboard): construct managed startup profiles
ericksoa Jul 31, 2026
25d32e0
feat(onboard): map and coordinate startup profiles
ericksoa Jul 31, 2026
094d177
feat(onboard): apply startup profiles in managed images
ericksoa Jul 31, 2026
06f67e5
feat(onboard): add managed shared-state transactions
ericksoa Jul 31, 2026
2a048ae
chore(stack): restack PR3.3 on merged PR3.2
ericksoa Jul 31, 2026
498e521
chore(stack): restack PR3.4a on PR3.3
ericksoa Jul 31, 2026
3206926
chore(stack): restack PR3.4b on PR3.4a
ericksoa Jul 31, 2026
f3081cc
chore(stack): restack PR3.5 on PR3.4b
ericksoa Jul 31, 2026
6da5eb2
test(onboard): keep managed startup tests branchless
ericksoa Jul 31, 2026
51126c4
chore(stack): carry PR3.4b guardrail fix into PR3.5
ericksoa Jul 31, 2026
bb7a260
chore(stack): restack PR3.4a after PR3.3 merge
ericksoa Jul 31, 2026
fafdbd1
chore(stack): restack PR3.4b after PR3.3 merge
ericksoa Jul 31, 2026
0edd158
chore(stack): restack PR3.5 after PR3.3 merge
ericksoa Jul 31, 2026
b14013f
test(onboard): cover managed startup fixture CLI
ericksoa Jul 31, 2026
46fbe19
feat(onboard): apply startup profiles in managed images
ericksoa Jul 31, 2026
b2027a9
feat(onboard): add managed shared-state transactions
ericksoa Jul 31, 2026
c95bdf7
fix(onboard): serialize managed startup transactions
ericksoa Jul 31, 2026
3f3bdbb
feat(onboard): apply startup profiles in managed images
ericksoa Jul 31, 2026
8ff8094
feat(onboard): add managed shared-state transactions
ericksoa Jul 31, 2026
7d1668b
test(onboard): keep transaction races branchless
ericksoa Jul 31, 2026
540494c
chore(stack): inherit PR3.4a guardrail fix
ericksoa Jul 31, 2026
1463687
chore(stack): inherit PR3.4b restack
ericksoa Jul 31, 2026
3a03eeb
merge: resolve conflicts with main
github-actions[bot] Jul 31, 2026
d97b259
chore(stack): restack PR3.5 after PR3.4a merge
ericksoa Jul 31, 2026
deb1581
chore(stack): refresh PR3.4b validation
ericksoa Jul 31, 2026
0ad91a5
chore(stack): inherit PR3.4b validation refresh
ericksoa Jul 31, 2026
a0f12f1
fix(onboard): harden managed startup inputs
ericksoa Jul 31, 2026
27c72f5
fix(runtime): close prior review debt
ericksoa Jul 31, 2026
1c824cc
test(runtime): keep env cleanup branchless
ericksoa Jul 31, 2026
5c6b3f7
fix(runtime): preserve direct image execution
ericksoa Jul 31, 2026
611fdb6
fix(messaging): reject ambiguous channel identities
ericksoa Jul 31, 2026
76c54d4
fix(messaging): require canonical persisted channel ids
ericksoa Jul 31, 2026
e41521b
chore(stack): refresh PR3.4b on current main
ericksoa Jul 31, 2026
bebfc6c
chore(stack): refresh PR3.5 on current PR3.4b
ericksoa Jul 31, 2026
864e249
chore(stack): refresh PR3.5a on current PR3.5
ericksoa Jul 31, 2026
7cf2a8d
chore(stack): refresh PR3.5b on current PR3.5a
ericksoa Jul 31, 2026
5f9d97d
test(e2e): add cross-runtime foundation
ericksoa Jul 31, 2026
abf45b3
test(e2e): keep runtime foundation branchless
ericksoa Jul 31, 2026
ed479ae
refactor(runtime): unify provider bundle registry
ericksoa Jul 31, 2026
005b3a7
fix(runtime): harden provider contract boundaries
ericksoa Jul 31, 2026
05cf2a5
fix(runtime): fail closed on managed image cleanup
ericksoa Jul 31, 2026
5c29046
fix(messaging): reject unresolved build hooks
ericksoa Jul 31, 2026
534773b
fix(runtime): close provider lifecycle authority gaps
ericksoa Jul 31, 2026
847e827
chore(stack): refresh PR3.5c on current PR3.5b
ericksoa Jul 31, 2026
77559f7
test(runtime): keep provider parity branchless
ericksoa Jul 31, 2026
a2afe77
fix(e2e): harden runtime foundation contracts
ericksoa Jul 31, 2026
13932b9
chore(stack): refresh PR3.4b on current main
ericksoa Jul 31, 2026
5111410
chore(stack): refresh PR3.5 on current PR3.4b
ericksoa Jul 31, 2026
7d51947
chore(stack): refresh PR3.5a on current PR3.5
ericksoa Jul 31, 2026
004b060
test(e2e): verify fixture profiles stay unregistered
ericksoa Jul 31, 2026
771f48c
chore(stack): refresh PR3.5b on current PR3.5a
ericksoa Jul 31, 2026
c67afd3
chore(stack): refresh PR3.5c on current PR3.5b
ericksoa Jul 31, 2026
4788d28
test(e2e): expose runtime profile registration state
ericksoa Jul 31, 2026
64f562f
fix(runtime): preserve unproven cleanup authority
ericksoa Jul 31, 2026
15eef1b
chore(stack): refresh PR3.6 on repaired base
ericksoa Jul 31, 2026
d73f13a
test(runtime): cover unknown provider doctor result
ericksoa Jul 31, 2026
8f8bcd5
test(runtime): prove provider recovery boundaries
ericksoa Jul 31, 2026
f77bff8
fix(runtime): fail closed on retained cleanup ownership
ericksoa Jul 31, 2026
bf2fd19
test(rebuild): type cleanup ownership receipt
ericksoa Jul 31, 2026
4316a18
fix(runtime): prove cleanup authority before deletion
ericksoa Jul 31, 2026
062d66b
test(snapshot): mock destructive cleanup authority
ericksoa Jul 31, 2026
75730cf
test(runtime): prove cleanup planning is inert
ericksoa Jul 31, 2026
0b21b79
feat(rebuild): add atomic managed workload replacement
ericksoa Jul 31, 2026
438f79f
fix(rebuild): fail closed across authority cutover
ericksoa Jul 31, 2026
412d69d
docs(rebuild): define deferred recovery ownership
ericksoa Jul 31, 2026
cfe84cd
fix(rebuild): bind retained workload authority
ericksoa Jul 31, 2026
827f545
test(rebuild): keep failure matrices linear
ericksoa Jul 31, 2026
add3965
test(rebuild): cover invalid provider artifacts
ericksoa Jul 31, 2026
9bbf75d
fix(rebuild): address review feedback
ericksoa Jul 31, 2026
8212bf9
merge: resolve conflicts with main
github-actions[bot] Aug 1, 2026
4960f4d
chore(stack): refresh managed rebuild on current main
ericksoa Aug 1, 2026
bf94633
feat(snapshot): preserve managed runtime authority
ericksoa Jul 31, 2026
3a4321d
fix(snapshot): enforce managed authority boundaries
ericksoa Jul 31, 2026
8b19581
feat(snapshot): prepare immutable managed clone handoff
ericksoa Aug 1, 2026
1a91ef2
test(snapshot): keep provider authority cases linear
ericksoa Aug 1, 2026
410d4c9
chore(stack): refresh clone contract on PR3.8
ericksoa Aug 1, 2026
fabad32
test(snapshot): keep clone authority cases linear
ericksoa Aug 1, 2026
25aa304
feat(snapshot): add managed clone provider transaction
ericksoa Aug 1, 2026
6d4d858
test(snapshot): satisfy provider transaction CLI typings
ericksoa Aug 1, 2026
94cb164
chore(stack): refresh provider transaction on PR3.9A
ericksoa Aug 1, 2026
cbecf7b
feat(snapshot): stage Hermes clone broker activation
ericksoa Jul 31, 2026
888e2f9
test(snapshot): satisfy Hermes broker CLI typings
ericksoa Jul 31, 2026
c176a4f
fix(snapshot): use shared immutable boundary
ericksoa Aug 1, 2026
8bc9ea1
feat(onboard): define dormant transactional managed bootstrap
ericksoa Aug 1, 2026
69bcdc4
feat(onboard): add transactional Docker bootstrap adapter
ericksoa Jul 31, 2026
22c198a
test(onboard): satisfy strict Docker bootstrap fixture typing
ericksoa Jul 31, 2026
ff836ad
test(snapshot): complete dependency adapter mocks
ericksoa Jul 31, 2026
88ff07b
fix(snapshot): keep clone transaction dormant
ericksoa Aug 1, 2026
5429f52
chore(stack): refresh Hermes clone broker on PR3.9B
ericksoa Aug 1, 2026
101e408
test(snapshot): satisfy Hermes broker growth guard
ericksoa Aug 1, 2026
0c4440c
chore(stack): refresh bootstrap protocol on PR3.9C
ericksoa Aug 1, 2026
f251a72
test(onboard): satisfy bootstrap protocol growth guard
ericksoa Aug 1, 2026
17843c3
chore(stack): refresh Docker bootstrap adapter on protocol
ericksoa Aug 1, 2026
01a554d
test(onboard): linearize Docker bootstrap fixtures
ericksoa Aug 1, 2026
844bfb6
fix(snapshot): pin files during authority hashing
ericksoa Aug 1, 2026
aeddd24
chore(stack): refresh clone handoff on snapshot security fix
ericksoa Aug 1, 2026
f7068d0
chore(stack): refresh provider transaction on clone handoff
ericksoa Aug 1, 2026
0711807
chore(stack): refresh Hermes broker on provider transaction
ericksoa Aug 1, 2026
a396904
chore(stack): refresh bootstrap protocol on Hermes broker
ericksoa Aug 1, 2026
8faa1b4
chore(stack): refresh Docker adapter on bootstrap protocol
ericksoa Aug 1, 2026
ed60882
fix(snapshot): address restore review findings
ericksoa Aug 1, 2026
7c823d4
fix(snapshot): address clone handoff review findings
ericksoa Aug 1, 2026
e962454
merge: update PR3.8 review fixes
ericksoa Aug 1, 2026
c2e6f06
fix(snapshot): address provider transaction review
ericksoa Aug 1, 2026
9e64898
docs(snapshot): clarify legacy restore retention
ericksoa Aug 1, 2026
738e680
merge: refresh PR3.8 documentation
ericksoa Aug 1, 2026
d7d4adc
merge: refresh clone handoff contract
ericksoa Aug 1, 2026
380925a
fix(hermes): address broker transaction review
ericksoa Aug 1, 2026
ffacfb3
merge: refresh Hermes broker on provider transaction
ericksoa Aug 1, 2026
c3f9fdc
fix(onboard): harden bootstrap dormancy contract
ericksoa Aug 1, 2026
d69a390
merge: refresh bootstrap protocol on Hermes broker
ericksoa Aug 1, 2026
1fb671d
fix(bootstrap): harden Docker transaction review contracts
ericksoa Aug 1, 2026
93fe6d8
merge: refresh Docker bootstrap adapter on protocol hardening
ericksoa Aug 1, 2026
0cf5aac
test(onboard): inventory Docker bootstrap sources
ericksoa Aug 1, 2026
b79f034
test(cli): exclude source fixtures from distribution
ericksoa Aug 1, 2026
0013772
test(messaging): keep staged channel fixture canonical
ericksoa Aug 1, 2026
61aa6d6
merge(stack): refresh clone handoff fixture
ericksoa Aug 1, 2026
4bb2b58
merge(stack): refresh managed clone provider
ericksoa Aug 1, 2026
b596445
merge(stack): refresh Hermes clone broker
ericksoa Aug 1, 2026
e11da6b
merge(stack): refresh bootstrap protocol
ericksoa Aug 1, 2026
e97ecce
merge(stack): refresh managed workload rebuild parity
ericksoa Aug 1, 2026
6b2c464
merge(stack): refresh managed snapshot parity
ericksoa Aug 1, 2026
91c807c
merge(stack): refresh managed clone handoff contract
ericksoa Aug 1, 2026
8ca5867
merge(stack): refresh managed clone provider transaction
ericksoa Aug 1, 2026
2faa95d
merge(stack): refresh Hermes managed clone broker
ericksoa Aug 1, 2026
fc9ff91
merge(stack): refresh managed bootstrap protocol
ericksoa Aug 1, 2026
0d3442e
merge(stack): refresh Docker managed bootstrap adapter
ericksoa Aug 1, 2026
362a70c
chore(stack): refresh managed workload rebuild parity on current main
ericksoa Aug 1, 2026
b2374ee
chore(stack): refresh managed snapshot parity parent
ericksoa Aug 1, 2026
e09ce8a
chore(stack): refresh managed clone handoff parent
ericksoa Aug 1, 2026
aeeb6dd
chore(stack): refresh managed clone provider parent
ericksoa Aug 1, 2026
968c795
chore(stack): refresh Hermes clone broker parent
ericksoa Aug 1, 2026
fb0d7aa
chore(stack): refresh managed bootstrap protocol parent
ericksoa Aug 1, 2026
976771e
chore(stack): refresh Docker bootstrap adapter parent
ericksoa Aug 1, 2026
ca85ca7
fix(hermes): preserve broker write ownership
ericksoa Aug 1, 2026
8db756d
chore(stack): incorporate Hermes broker review repairs
ericksoa Aug 1, 2026
3e25313
chore(stack): incorporate Hermes broker review repairs
ericksoa Aug 1, 2026
b349b98
merge: resolve conflicts with main
github-actions[bot] Aug 1, 2026
33d1756
merge(stack): restack #8031 onto current main
ericksoa Aug 2, 2026
65f4d68
merge(stack): restack #8032 onto #8031
ericksoa Aug 2, 2026
380d885
merge(stack): restack #8034 onto #8032
ericksoa Aug 2, 2026
6c7f81d
merge(stack): restack #8035 onto #8034
ericksoa Aug 2, 2026
7097017
test(hermes): assert clone cleanup writes no state
ericksoa Aug 2, 2026
c1fd385
chore(stack): refresh Hermes review fix on current parent
ericksoa Aug 2, 2026
c5db5df
merge(stack): restack #8036 onto repaired #8035
ericksoa Aug 2, 2026
9a7fc82
merge(stack): restack #8037 onto #8036
ericksoa Aug 2, 2026
8628b8a
fix(hermes): harden broker control recovery
ericksoa Aug 2, 2026
bd43818
merge(stack): restack #8036 onto repaired #8035
ericksoa Aug 2, 2026
f4a28b9
merge(stack): restack #8037 onto #8036
ericksoa Aug 2, 2026
d7cb7f7
test(hermes): rely on owned child cleanup
ericksoa Aug 2, 2026
53b3404
merge(stack): restack #8036 onto #8035
ericksoa Aug 2, 2026
db8e1cd
merge(stack): restack #8037 onto #8036
ericksoa Aug 2, 2026
a41d7e3
merge: resolve conflicts with main
github-actions[bot] Aug 2, 2026
4699ab7
merge(stack): append final #8032 ancestry
ericksoa Aug 2, 2026
4824fce
merge(stack): append final #8034 ancestry
ericksoa Aug 2, 2026
82a4877
merge(stack): append final #8035 ancestry
ericksoa Aug 2, 2026
ad5397a
merge(stack): append final #8036 ancestry
ericksoa Aug 2, 2026
c05a422
feat(onboard): add Docker bootstrap transaction primitives
ericksoa Aug 3, 2026
345efce
refactor(stack): extract Docker bootstrap primitives
ericksoa Aug 3, 2026
a252bae
feat(onboard): add transactional Docker bootstrap adapter
ericksoa Aug 3, 2026
4be7221
fix(onboard): validate managed bootstrap clone inputs
ericksoa Aug 3, 2026
e42b09e
fix(onboard): freeze canonical Docker launch specs
ericksoa Aug 3, 2026
1275cf3
feat(onboard): add Docker bootstrap transaction primitives
ericksoa Aug 3, 2026
149b3a2
fix(onboard): freeze canonical Docker launch specs
ericksoa Aug 3, 2026
a352b71
refactor(stack): restack Docker bootstrap primitives
ericksoa Aug 3, 2026
500656e
feat(onboard): add transactional Docker bootstrap adapter
ericksoa Aug 3, 2026
88adfe1
fix(onboard): validate managed bootstrap clone inputs
ericksoa Aug 3, 2026
28dcd55
refactor(stack): restack transactional Docker bootstrap
ericksoa Aug 3, 2026
2c64343
refactor(stack): restack transactional Docker bootstrap
ericksoa Aug 3, 2026
7bcc852
fix(onboard): address Docker bootstrap review feedback
ericksoa Aug 3, 2026
c874abc
test(onboard): harden Docker bootstrap assertions
ericksoa Aug 3, 2026
d3f532e
test(onboard): scope bootstrap fixture switch state
ericksoa Aug 3, 2026
633e0dc
test(onboard): guard Docker agent argument lookup
ericksoa Aug 3, 2026
908c2dc
feat(onboard): add Docker managed bootstrap lifecycle
ericksoa Aug 3, 2026
503fdd8
refactor(stack): restack Docker bootstrap on current main
ericksoa Aug 3, 2026
2062283
test(onboard): linearize helper environment assertions
ericksoa Aug 3, 2026
875eab3
feat(onboard): add Docker managed bootstrap lifecycle
ericksoa Aug 3, 2026
eb8ee81
refactor(stack): restack Docker bootstrap on current main
ericksoa Aug 3, 2026
0015438
test(onboard): harden bootstrap qualification
ericksoa Aug 3, 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
18 changes: 16 additions & 2 deletions src/lib/actions/sandbox/snapshot-auto-create-failure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ const streamSandboxCreateMock = vi.fn<SnapshotStreamSandboxCreateMock>(async ()
forcedReady: false,
}));

vi.mock("../../adapters/docker", () => ({ dockerCapture: vi.fn(() => "") }));
vi.mock("../../adapters/docker", () => ({
dockerCapture: vi.fn(() => ""),
dockerForceRm: vi.fn(),
dockerRunDetached: vi.fn(),
}));
vi.mock("../../adapters/openshell/runtime", () => ({
captureOpenshell: captureOpenshellMock,
getOpenshellBinary: vi.fn(() => "openshell"),
runOpenshell: vi.fn(() => ({ status: 0, output: "" })),
}));
vi.mock("../../credentials/store", () => ({ prompt: vi.fn() }));
vi.mock("../../credentials/store", () => ({
deleteCredential: vi.fn(),
getCredential: vi.fn(() => null),
prompt: vi.fn(),
saveCredential: vi.fn(),
}));
vi.mock("../../domain/sandbox/destroy", () => ({
getSandboxDeleteOutcome: vi.fn(() => ({ alreadyGone: false, gatewayUnreachable: false })),
}));
Expand All @@ -50,6 +59,11 @@ vi.mock("../../inference/nim", () => ({
stopNimContainerByName: vi.fn(),
}));
vi.mock("../../messaging/channels", () => ({
BUILT_IN_CHANNEL_MANIFESTS: [],
getMessagingConfigEnvAliases: vi.fn(() => ({})),
getMessagingCredentialEnvKeysByChannel: vi.fn(() => ({})),
getMessagingProviderSuffixesByChannel: vi.fn(() => ({})),
listBuiltInMessagingChannelManifests: vi.fn(() => []),
listMessagingProviderSuffixes: vi.fn(() => []),
listMessagingCredentialMetadata: vi.fn(() => []),
}));
Expand Down
5 changes: 5 additions & 0 deletions src/lib/actions/sandbox/snapshot-restore-test-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ export { lifecycleMock, shieldsMock };

vi.mock("../../adapters/docker", () => ({
dockerCapture: vi.fn(() => ""),
dockerForceRm: vi.fn(),
dockerInspect: dockerInspectMock,
dockerRunDetached: vi.fn(),
}));

vi.mock("../../agent/defs", () => ({
Expand All @@ -227,7 +229,10 @@ vi.mock("../../adapters/openshell/runtime", () => ({
}));

vi.mock("../../credentials/store", () => ({
deleteCredential: vi.fn(),
getCredential: vi.fn(() => null),
prompt: vi.fn(),
saveCredential: vi.fn(),
}));

vi.mock("../../domain/sandbox/destroy", () => ({
Expand Down
10 changes: 5 additions & 5 deletions src/lib/actions/sandbox/snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,21 @@ const latestBackupFixture = {

vi.mock("../../adapters/docker", () => ({
dockerCapture: vi.fn(() => ""),
dockerForceRm: vi.fn(),
dockerInspect: dockerInspectMock,
dockerRunDetached: vi.fn(),
}));

vi.mock("../../adapters/openshell/runtime", () => ({
captureOpenshell: captureOpenshellMock,
getOpenshellBinary: vi.fn(() => "openshell"),
runOpenshell: runOpenshellMock,
}));

vi.mock("../../credentials/store", () => ({
deleteCredential: vi.fn(),
getCredential: vi.fn(() => null),
prompt: vi.fn(),
saveCredential: vi.fn(),
}));

vi.mock("../../domain/sandbox/destroy", () => ({
getSandboxDeleteOutcome: vi.fn(() => ({ alreadyGone: false, gatewayUnreachable: false })),
}));
Expand All @@ -165,7 +167,6 @@ vi.mock("../../inference/nim", () => ({
stopNimContainer: vi.fn(),
stopNimContainerByName: vi.fn(),
}));

vi.mock("../../policy", async (importOriginal) => ({
...(await importOriginal<typeof import("../../policy")>()),
applyPreset: applyPresetMock,
Expand All @@ -176,7 +177,6 @@ vi.mock("../../policy", async (importOriginal) => ({
removePreset: removePresetMock,
resolveAgentBaselinePolicy: resolveTestAgentBaselinePolicy,
}));

vi.mock("../../runner", () => ({
ROOT: "/repo",
run: vi.fn(() => ({ status: 0 })),
Expand Down
21 changes: 21 additions & 0 deletions src/lib/adapters/openshell/sandbox-identity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { describe, expect, it } from "vitest";

import { parseOpenShellSandboxId } from "./sandbox-identity";

describe("OpenShell sandbox identity parsing", () => {
it("accepts one exact durable ID with optional terminal color", () => {
expect(parseOpenShellSandboxId("Name: alpha\nID: sandbox-alpha\n")).toBe("sandbox-alpha");
expect(parseOpenShellSandboxId("\u001b[32mId: sandbox.alpha_2\u001b[0m\n")).toBe(
"sandbox.alpha_2",
);
});

it("rejects ambiguous or non-canonical IDs", () => {
expect(parseOpenShellSandboxId("ID: first\nID: second\n")).toBeNull();
expect(parseOpenShellSandboxId("ID: sandbox/alpha\n")).toBeNull();
expect(parseOpenShellSandboxId("id: sandbox-alpha\n")).toBeNull();
});
});
16 changes: 16 additions & 0 deletions src/lib/adapters/openshell/sandbox-identity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

const ANSI_RE = /\x1b\[[0-9;]*m/gu;
const SANDBOX_ID_RE = /^[A-Za-z0-9._-]+$/u;

export function parseOpenShellSandboxId(output: string): string | null {
const matches = [
...String(output)
.replace(ANSI_RE, "")
.matchAll(/^\s*(?:Id|ID):\s*(\S+)\s*$/gm),
].map((match) => match[1] ?? "");
return matches.length === 1 && SANDBOX_ID_RE.test(matches[0] as string)
? (matches[0] as string)
: null;
}
35 changes: 35 additions & 0 deletions src/lib/onboard/docker-gpu-patch-clone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,41 @@ describe("Docker GPU clone envelope", () => {
expect(args).not.toContain("nofile=1024:1024");
});

it("uses exact managed-bootstrap container, entrypoint, and command overrides", () => {
const args = buildDockerGpuCloneRunArgs(
inspectFixture(),
buildDockerGpuMode("startup-command"),
{
containerName: "openshell-alpha-bootstrap-stage",
containerEntrypoint: "/usr/local/bin/nemoclaw-managed-bootstrap",
containerCommand: ["--request", "/run/nemoclaw/bootstrap-request.json"],
},
);

expect(args.slice(0, 2)).toEqual(["--name", "openshell-alpha-bootstrap-stage"]);
expect(args).toEqual(
expect.arrayContaining(["--entrypoint", "/usr/local/bin/nemoclaw-managed-bootstrap"]),
);
expect(args.slice(args.indexOf("openshell/sandbox:abc"))).toEqual([
"openshell/sandbox:abc",
"--request",
"/run/nemoclaw/bootstrap-request.json",
]);
});

it.each([
"",
"-starts-with-dash",
"contains/slash",
"a".repeat(254),
])("rejects invalid managed-bootstrap container name %j", (containerName) => {
expect(() =>
buildDockerGpuCloneRunArgs(inspectFixture(), buildDockerGpuMode("startup-command"), {
containerName,
}),
).toThrow("Docker clone container name is invalid.");
});

it("adds SYS_PTRACE to the GPU clone when the baseline container lacks it", () => {
const inspect = inspectFixture();
inspect.HostConfig!.CapAdd = ["SYS_ADMIN", "NET_ADMIN"];
Expand Down
23 changes: 20 additions & 3 deletions src/lib/onboard/docker-gpu-patch-clone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,15 @@ export function buildDockerGpuCloneRunArgs(
const image = String(options.image || config.Image || "").trim();
if (!image) throw new Error("Docker inspect output did not include Config.Image.");

const args: string[] = ["--name", dockerContainerName(inspect), ...mode.args];
const containerName = String(options.containerName ?? dockerContainerName(inspect)).trim();
if (
containerName.length === 0 ||
containerName.length > 253 ||
!/^[A-Za-z0-9][A-Za-z0-9_.-]*$/u.test(containerName)
) {
throw new Error("Docker clone container name is invalid.");
}
const args: string[] = ["--name", containerName, ...mode.args];
const gpuAugment = mode.kind !== "startup-command";

// Startup-command recreation must retain OpenShell's native CDI attachment.
Expand Down Expand Up @@ -435,8 +443,17 @@ export function buildDockerGpuCloneRunArgs(
if (host.Init) args.push("--init");

const entrypoint = stringArray(config.Entrypoint);
if (entrypoint.length > 0) args.push("--entrypoint", entrypoint[0]);
const commandArgs = sandboxCommand ? [] : [...entrypoint.slice(1), ...stringArray(config.Cmd)];
const replacementEntrypoint = String(options.containerEntrypoint ?? "").trim();
if (replacementEntrypoint) {
args.push("--entrypoint", replacementEntrypoint);
} else if (entrypoint.length > 0) {
args.push("--entrypoint", entrypoint[0]);
}
const commandArgs = options.containerCommand
? [...options.containerCommand]
: sandboxCommand
? []
: [...entrypoint.slice(1), ...stringArray(config.Cmd)];
args.push(image, ...commandArgs);
return args;
}
Expand Down
17 changes: 17 additions & 0 deletions src/lib/onboard/docker-gpu-patch-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ export type DockerGpuCloneRunOptions = {
sandboxFallbackDns?: string | null;
openshellSandboxCommand?: readonly string[] | null;
requiredUlimits?: readonly DockerUlimit[] | null;
/**
* Exact replacement process boundary used only by dormant managed bootstrap.
* Ordinary recreation leaves both fields unset.
*/
containerEntrypoint?: string | null;
containerCommand?: readonly string[] | null;
/** Stopped staging name used before exact-name cutover. */
containerName?: string | null;
/**
* Extra supplementary group IDs to add to the recreated container via
* `--group-add`. On Jetson these are the host group(s) owning the Tegra GPU
Expand Down Expand Up @@ -190,6 +198,14 @@ export type DockerContainerInspect = {
Hostname?: string;
Tty?: boolean;
OpenStdin?: boolean;
StopTimeout?: number | null;
Volumes?: Record<string, unknown> | null;
} | null;
State?: {
Running?: boolean;
Paused?: boolean;
Restarting?: boolean;
Dead?: boolean;
} | null;
HostConfig?: {
Binds?: string[] | null;
Expand Down Expand Up @@ -244,6 +260,7 @@ export type DockerContainerInspect = {
DeviceIDs?: string[] | null;
}> | null;
ShmSize?: number;
ReadonlyRootfs?: boolean;
ReadonlyPaths?: string[] | null;
MaskedPaths?: string[] | null;
} | null;
Expand Down
56 changes: 36 additions & 20 deletions src/lib/onboard/managed-bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# Managed bootstrap protocol

This directory defines a dormant, driver-neutral transaction contract. It does
not register a runtime provider or change sandbox creation, onboarding,
snapshot, clone, or restore behavior.
This directory defines a dormant, driver-neutral transaction contract and its
first driver adapter. It does not register a runtime provider, activate managed
bootstrap, or change the current user-visible lifecycle paths.

The protocol binds one random bootstrap identity to:

Expand Down Expand Up @@ -71,6 +71,22 @@ journal and a canonical launch-spec normalizer. Each surface is independently
validated and remains dormant: no registered runtime provider imports either
module, and neither changes sandbox creation or lifecycle behavior.

The Docker adapter creates and validates a stopped replacement under an
identity-derived staging name while the original remains running. It stages the
0400 envelope and returns exact cleanup authority without quiescing, renaming,
or otherwise mutating the original. Only after the coordinator durably records
that complete prepared authority may activation journal both full runtime IDs,
all three names, both launch-spec hashes, image identity, profile fingerprint,
and sandbox ID and then enter the destructive cutover. Post-cutover rollback
publishes `rollback-authorized` before exact replacement deletion; pre-cutover
staged cleanup removes only the exact prepared replacement without that journal
transition. Commit publishes `shared-state-committed` before exact backup
deletion. Cleanup is bound to full runtime IDs. Mutable OpenShell names are read
only to detect ownership reuse, and unsafe name-only deletion returns a typed
retention error. The dormant adapter assumes the protocol's single coordinator;
multi-process lease/arbitration remains an explicit production-activation gate.
Activation must also inject the selected gateway's canonical state root.

## Architectural disposition

The coordinator deliberately lands as a dormant trust-boundary slice before a
Expand All @@ -86,22 +102,22 @@ This is executable, bounded groundwork rather than an untested placeholder.
failure rollback for OpenClaw, Hermes, and LangChain Deep Agents Code through an
MXC-named fake driver. `runtime-provider-source-shape.test.ts` separately
inventories the protocol, provider, and image-packaging surfaces and proves that
production activation cannot import or package the protocol yet. The later
activation slice must add a registered-provider contract test for the same
transaction before removing those dormancy assertions.
production activation does not import or install the protocol into a runtime
image yet. The later activation slice must add a registered-provider contract
test for the same transaction before removing those dormancy assertions.

The native entrypoint source is intentionally not compiled into production
artifacts, and neither source is packaged or selected yet. No production
TypeScript module imports this protocol. The current image definitions do not
package `nemoclaw-managed-startup-hold` or
`managed-startup-image-runtime.cjs`. A later
provider integration must compile and verify the freestanding entrypoint
natively for amd64 and arm64 in every agent image. It must add those
prerequisites together with their image-runtime bootstrap modes, implement
driver-specific prepare, durable-record, activate, exact cleanup, and rollback,
and only then wire the coordinator into create. The same contract is exercised
for OpenClaw, Hermes, and Deep Agents Code without a provider-specific central
switch. The remaining integration and qualification work is tracked in
[epic #7744](https://github.com/NVIDIA/NemoClaw/issues/7744) and its linked
implementation stack. Until that complete boundary lands, every registered
runtime provider keeps its bootstrap surface unsupported.
artifacts, and neither image-owned source is installed or selected in a runtime
image yet. No production activation or provider module outside this dormant
directory imports the protocol or Docker adapter. The current image definitions
do not package `nemoclaw-managed-startup-hold`,
`managed-startup-image-runtime.cjs`, or the shared-state bootstrap modes consumed
by the adapter. A later provider integration must compile and verify the
freestanding entrypoint natively for amd64 and arm64 in every agent image. It
must add those prerequisites together with their image-runtime bootstrap modes
and wire the coordinator and Docker adapter into create as one boundary. The
same contract is exercised for OpenClaw, Hermes, and Deep Agents Code without a
provider-specific central switch. The remaining integration and qualification
work is tracked in [epic #7744](https://github.com/NVIDIA/NemoClaw/issues/7744)
and its linked implementation stack. Until that complete boundary lands, every
registered runtime provider keeps its bootstrap surface unsupported.
7 changes: 5 additions & 2 deletions src/lib/onboard/managed-bootstrap/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,13 +909,16 @@ describe("managed bootstrap adapter contract", () => {
});

it.each([
"BASHOPTS=extdebug",
"BASH_ENV=/sandbox/attacker",
"ENV=/sandbox/attacker",
"LD_PRELOAD=/sandbox/attacker.so",
"LD_AUDIT=/sandbox/attacker.so",
"LD_LIBRARY_PATH=/sandbox/lib",
"SHELLOPTS=xtrace",
"LD_PRELOAD=/sandbox/attacker.so",
"NODE_OPTIONS=--require=/sandbox/attacker.cjs",
"NODE_PATH=/sandbox/attacker-modules",
"PS4=$(touch /sandbox/bypass)",
"SHELLOPTS=xtrace",
"BASH_FUNC_attacker%%=() { touch /sandbox/bypass; }",
])("rejects a process-control assignment before rendering the held command: %s", (assignment) => {
const request = requestFor("hermes");
Expand Down
6 changes: 4 additions & 2 deletions src/lib/onboard/managed-bootstrap/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const PROCESS_INJECTION_ENV_KEYS = new Set([
"LD_AUDIT",
"LD_LIBRARY_PATH",
"LD_PRELOAD",
"NODE_OPTIONS",
"NODE_PATH",
"PS4",
"SHELLOPTS",
]);
Expand Down Expand Up @@ -931,7 +933,7 @@ function normalizePreparedReplacement(
});
}

function createPreparedAuthority(
export function createManagedBootstrapPreparedAuthority(
transaction: ManagedBootstrapPreparedTransaction,
): ManagedBootstrapPreparedAuthority {
const { handle, snapshot, prepared } = transaction;
Expand Down Expand Up @@ -1358,7 +1360,7 @@ export async function activateManagedBootstrapSequence(
let durablePreparation: ManagedBootstrapDurablePreparationReceipt | null = null;
let replacement: ManagedBootstrapReplacementHandle | null = null;
try {
const authority = createPreparedAuthority(input.transaction);
const authority = createManagedBootstrapPreparedAuthority(input.transaction);
durablePreparation = normalizeDurablePreparationReceipt(
await input.authorityStore.recordPreparedAuthority(authority),
authority,
Expand Down
Loading
Loading