Skip to content

Commit 54cb2a4

Browse files
authored
fix(onboard): pass messaging dependencies during reuse (#9366)
## Summary Restore the recorded messaging resume path after the lifecycle reconciliation update. Recorded channels now pass the required persistence and notification dependencies into host-channel filtering, and the affected reuse fixtures model that contract. ## Related Issue Fixes #9359 ## Changes - Pass onboarding messaging dependencies through recorded-channel reconciliation. - Update the existing reuse fixtures to provide the dependency contract required when channels are filtered and persisted. ## 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) - [ ] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: - [ ] 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: Not applicable - Station profile/scenario: Not applicable - Result: Not applicable - Supporting evidence: Not applicable ## 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 — `npx vitest run --project cli src/lib/onboard/machine/handlers/sandbox-messaging.test.ts` (32 passed) - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: - [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) Additional validation: `npm run build:cli`, `npm run typecheck:cli`, and `npm run lint`. --- Signed-off-by: Deepak Jain <deepujain@gmail.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved reconciliation when resuming recorded sandbox messaging sessions. * Missing host configuration is now clearly noted, while outdated saved plans are removed without being rewritten. * Improved filtering of unavailable messaging channels and handling of related plan updates and notifications. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Deepak Jain <deepujain@gmail.com>
1 parent cb018f0 commit 54cb2a4

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/lib/onboard/machine/handlers/sandbox-messaging.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ describe("reconcileReusedSandboxMessaging", () => {
396396
const result = reconcileReusedSandboxMessaging(
397397
structuredClone(plan),
398398
{ name: "openclaw" },
399-
{ clearPlanEnv },
399+
{ clearPlanEnv, note: vi.fn(), writePlanToEnv: vi.fn() },
400400
plan,
401401
);
402402

@@ -417,7 +417,7 @@ describe("reconcileReusedSandboxMessaging", () => {
417417
const result = reconcileReusedSandboxMessaging(
418418
structuredClone(plan),
419419
{ name: "openclaw" },
420-
{ clearPlanEnv: vi.fn() },
420+
{ clearPlanEnv: vi.fn(), note: vi.fn(), writePlanToEnv: vi.fn() },
421421
plan,
422422
);
423423

@@ -432,7 +432,7 @@ describe("reconcileReusedSandboxMessaging", () => {
432432
const result = reconcileReusedSandboxMessaging(
433433
structuredClone(plan),
434434
{ name: "openclaw" },
435-
{ clearPlanEnv: vi.fn() },
435+
{ clearPlanEnv: vi.fn(), note: vi.fn(), writePlanToEnv: vi.fn() },
436436
plan,
437437
);
438438

@@ -693,6 +693,9 @@ describe("reconcileSandboxMessaging plan authority", () => {
693693
// input; a channel the environment no longer configures must not re-enter
694694
// the selection, or its egress preset is re-applied.
695695
expect(deps.setupMessagingChannels).not.toHaveBeenCalled();
696+
expect(deps.note).toHaveBeenCalledWith(expect.stringContaining("No host inputs configure discord"));
697+
expect(deps.clearPlanEnv).toHaveBeenCalledOnce();
698+
expect(deps.writePlanToEnv).not.toHaveBeenCalled();
696699
expect(result).toEqual({ plan: null, selectedChannels: [] });
697700
});
698701

src/lib/onboard/machine/handlers/sandbox-messaging.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ async function selectionFromMessagingSetup<Agent>(
373373
);
374374
}
375375

376+
/** Reconcile checkpoint channels against current host inputs before reuse. */
376377
function selectionFromRecordedChannels<Agent>(
377378
recordedChannels: string[],
378379
envPlan: SandboxMessagingPlan | null,
@@ -386,7 +387,7 @@ function selectionFromRecordedChannels<Agent>(
386387
if (envPlan) selection = selectionFromReusablePlan(envPlan, options.agent, false, options.deps);
387388
else if (registryPlan)
388389
selection = selectionFromReusablePlan(registryPlan, options.agent, true, options.deps);
389-
selection = filterUnconfiguredHostChannelsFromSelection(selection, options.agent);
390+
selection = filterUnconfiguredHostChannelsFromSelection(selection, options.agent, options.deps);
390391
if (selection.selectedChannels.length > 0) {
391392
options.deps.note(
392393
` [non-interactive] Reusing messaging channel configuration: ${selection.selectedChannels.join(", ")}`,

0 commit comments

Comments
 (0)