Skip to content

Commit 39e7926

Browse files
fix(onboard): complete Discord managed bootstrap (NVIDIA#9474)
## Summary Make the current managed OpenClaw Discord startup profile consumable by the reused `8cdc3c41` image. NemoClaw continues to hydrate and validate the complete messaging plan, then omits only the valid boolean package-install `pin` from the derived managed startup profile because that field controls image construction rather than runtime startup. ## Related Issue Fixes NVIDIA#9399 ## Changes - Validate and hydrate the complete messaging plan before producing the managed startup profile. - Omit only a valid boolean `messaging.plan.buildSteps[0].value.pin` from the derived runtime profile. - Preserve malformed and misplaced pin rejection so credential-shaped input continues to fail closed. - Add positive and negative profile-builder regressions for the projection boundary. ## Acceptance Criteria - [x] Complete managed OpenClaw Discord startup against reused image source revision `8cdc3c41eadf51cd817df9a0f738656d8c940be5`, without rebuilding or publishing an image or changing managed-image dependencies. - [x] Keep the replacement stable through bootstrap completion and OpenShell supervisor reconnect. - [x] Reach and pass configuration inspection, fake Discord Gateway routing, pairing-request, connect-shell approval, and cleanup phases. - [x] Preserve full-plan validation: malformed or misplaced pins still fail closed. - [x] Pass the issue-reported failing `openclaw-discord-pairing` target on an exact candidate containing PR head `2f865a9d65d672fb14b1995b6659d8ff1c4d1eda`: [run 32164856423, job 95802476184](https://github.com/NVIDIA/NemoClaw/actions/runs/32164856423/job/95802476184). Candidate `17b18b962ed64b913f240f9fcd2040b69c8fb163`; evidence manifest reports 80 product files, all 7 phases passed, and cleanup passed 4/4 with no failures. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — exact-head approval: [jyaunches review](NVIDIA#9474 (review)) - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run validate:pr` passed after refreshing `origin/main` when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — `vitest run --project cli src/lib/onboard/managed-startup-profile-builder.test.ts src/lib/onboard/managed-startup-profile.test.ts src/lib/onboard/managed-startup-agent-environment.test.ts src/lib/onboard/managed-bootstrap/docker.test.ts` (244 passed); `tsc -p nemoclaw/tsconfig.json --noEmit` and `tsc -p nemoclaw/tsconfig.test.json --noEmit` passed - [x] Applicable broad gate passed — exact-head GitHub CI is the applicable broad gate and is required green before merge - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Aaron Erickson <aerickson@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Managed startup profiles now omit internal pin details from valid package-install steps. * Invalid or misplaced pin values continue to be rejected during profile validation. * **Tests** * Added coverage for removing derived pin fields and rejecting malformed credential-shaped values. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Aaron Erickson <aerickson@nvidia.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c7e96ec commit 39e7926

2 files changed

Lines changed: 106 additions & 1 deletion

File tree

src/lib/onboard/managed-startup-profile-builder.test.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,91 @@ describe("buildManagedStartupProfile", () => {
243243
});
244244
});
245245

246+
it("omits a derived package pin from the managed startup profile (#9399)", () => {
247+
const built = buildManagedStartupProfile(
248+
openClawInput({
249+
messagingPlan: {
250+
...messagingPlan("openclaw"),
251+
channels: [
252+
{
253+
channelId: "discord",
254+
displayName: "Discord",
255+
authMode: "token-paste",
256+
active: true,
257+
selected: true,
258+
configured: true,
259+
disabled: false,
260+
inputs: [],
261+
hooks: [],
262+
},
263+
],
264+
buildSteps: [
265+
{
266+
channelId: "discord",
267+
kind: "package-install",
268+
outputId: "openclawPluginPackage",
269+
required: true,
270+
value: {
271+
manager: "openclaw-plugin",
272+
spec: "npm:@openclaw/discord@2026.7.1",
273+
pin: true,
274+
},
275+
},
276+
],
277+
},
278+
}),
279+
);
280+
281+
const plan = built.profile.messaging.plan as {
282+
buildSteps: Array<{ value?: Record<string, unknown> }>;
283+
};
284+
expect(plan.buildSteps[0]?.value).toEqual({
285+
manager: "openclaw-plugin",
286+
spec: "npm:@openclaw/discord@2026.7.1",
287+
});
288+
expect(JSON.stringify(decodeManagedStartupProfile(built.encodedProfile))).not.toContain(
289+
'"pin"',
290+
);
291+
});
292+
293+
it("does not project a malformed package pin past profile validation (#9399)", () => {
294+
expect(() =>
295+
buildManagedStartupProfile(
296+
openClawInput({
297+
messagingPlan: {
298+
...messagingPlan("openclaw"),
299+
channels: [
300+
{
301+
channelId: "discord",
302+
displayName: "Discord",
303+
authMode: "token-paste",
304+
active: true,
305+
selected: true,
306+
configured: true,
307+
disabled: false,
308+
inputs: [],
309+
hooks: [],
310+
},
311+
],
312+
buildSteps: [
313+
{
314+
channelId: "discord",
315+
kind: "package-install",
316+
outputId: "openclawPluginPackage",
317+
required: true,
318+
value: {
319+
manager: "openclaw-plugin",
320+
spec: "npm:@openclaw/discord@2026.7.1",
321+
pin: "true",
322+
},
323+
},
324+
],
325+
},
326+
}),
327+
),
328+
).toThrow(/buildSteps\[0\]\.value\.pin has a credential-shaped field name/u);
329+
});
330+
246331
it.each([
247332
["wrong-agent discriminator", { ...messagingPlan("hermes"), sandboxName: "portable-agent" }],
248333
[

src/lib/onboard/managed-startup/profile-builder.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,27 @@ function normalizeMessagingPlan(
398398
const hydrated = hydrateDerivedSandboxMessagingPlanFields(plan);
399399
const reparsed = parseSandboxMessagingPlan(hydrated, { agent });
400400
if (!reparsed) fail(`messagingPlan hydration produced an invalid ${agent} plan`);
401-
return JSON.parse(JSON.stringify(reparsed)) as ManagedStartupJsonObject;
401+
const projected = JSON.parse(JSON.stringify(reparsed)) as ManagedStartupJsonObject;
402+
const buildSteps = projected.buildSteps;
403+
if (Array.isArray(buildSteps)) {
404+
for (const step of buildSteps) {
405+
if (
406+
!isPlainObject(step) ||
407+
step.kind !== "package-install" ||
408+
!isPlainObject(step.value) ||
409+
typeof step.value.pin !== "boolean"
410+
) {
411+
continue;
412+
}
413+
// Package pins govern image construction. A managed image already owns
414+
// the exact installed package, so this derived build-only flag does not
415+
// belong in the managed startup profile consumed at runtime. Validate
416+
// and hydrate the full plan before this projection so malformed or
417+
// misplaced pins still fail closed (#9399).
418+
delete step.value.pin;
419+
}
420+
}
421+
return projected;
402422
}
403423

404424
function resolveAliasedEnvironmentValue(

0 commit comments

Comments
 (0)