Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e41fba1
fix: preserve messaging egress on reuse
yimoj Sep 1, 2026
4f93912
test(onboard): resolve messaging reuse review findings
prekshivyas Sep 2, 2026
de0b59b
Merge branch 'main' into fix/10667-preserve-channel-egress
prekshivyas Sep 2, 2026
e3da435
Merge branch 'main' into fix/10667-preserve-channel-egress
prekshivyas Sep 2, 2026
4c85269
docs(onboard): correct channel removal guidance
prekshivyas Sep 2, 2026
63e61a9
fix(onboard): abort unavailable provider inspection
prekshivyas Sep 2, 2026
d77d3ba
fix(onboard): preserve gateway-minted channel reuse
prekshivyas Sep 2, 2026
773a203
Merge remote-tracking branch 'origin/main' into fix/10667-preserve-ch…
prekshivyas Sep 2, 2026
16eb03e
fix(onboard): fail closed on invalid profile inspection
prekshivyas Sep 2, 2026
61b5ac3
Merge remote-tracking branch 'origin/main' into fix/10667-preserve-ch…
prekshivyas Sep 2, 2026
9b1d385
Merge remote-tracking branch 'origin/main' into pr10782-final
prekshivyas Sep 2, 2026
2f1001f
test(review): align conflict fixer inference expectation
prekshivyas Sep 2, 2026
6841c87
fix(onboard): validate reusable messaging profiles
prekshivyas Sep 2, 2026
57db67e
Merge remote-tracking branch 'origin/main' into pr10782-final
prekshivyas Sep 2, 2026
3933a4a
fix(onboard): reuse profile import adapter
prekshivyas Sep 2, 2026
ecb884b
Merge remote-tracking branch 'origin/main' into pr10782-final
prekshivyas Sep 2, 2026
55c99d3
test(onboard): satisfy behavior guardrails
prekshivyas Sep 2, 2026
f9aee48
refactor(onboard): use canonical messaging reconciler
prekshivyas Sep 2, 2026
1bb94ca
docs(onboard): use published messaging route
prekshivyas Sep 2, 2026
1aafd21
docs(onboard): name non-interactive trigger
prekshivyas Sep 2, 2026
ca3d933
merge: resolve conflicts with main
github-actions[bot] Sep 2, 2026
9f66158
merge: resolve conflicts with main
github-actions[bot] Sep 2, 2026
53d110e
merge: resolve conflicts with main
github-actions[bot] Sep 3, 2026
fb778dc
merge: resolve conflicts with main
github-actions[bot] Sep 3, 2026
a3dbcf0
merge: resolve conflicts with main
hunglp6d Sep 12, 2026
05a4a99
docs: correct messaging reuse failure guidance
hunglp6d Sep 12, 2026
41b80a0
Merge branch 'main' into fix/10667-preserve-channel-egress
hunglp6d Sep 13, 2026
2e10389
Merge branch 'main' into fix/10667-preserve-channel-egress
hunglp6d Sep 13, 2026
70ea761
Merge branch 'main' into fix/10667-preserve-channel-egress
hunglp6d Sep 14, 2026
04cf795
Merge branch 'main' into fix/10667-preserve-channel-egress
hunglp6d Sep 16, 2026
fd3081f
Merge branch 'main' into fix/10667-preserve-channel-egress
sandl99 Sep 16, 2026
4632cf4
Merge branch 'main' into fix/10667-preserve-channel-egress
sandl99 Sep 16, 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
4 changes: 0 additions & 4 deletions ci/env-var-doc-allowlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@
"name": "NEMOCLAW_E2E_USE_HOSTED_INFERENCE",
"reason": "Internal E2E-only sentinel that tells CI to route the repository NVIDIA_INFERENCE_API_KEY secret through the hosted inference-api.nvidia.com OpenAI-compatible endpoint. Not user-facing."
},
{
"name": "NEMOCLAW_RUN_LIVE_E2E",
"reason": "Internal Vitest/live-E2E sentinel that permits the exact sandbox-scoped Google Chat fake-mint provider override used by the destructive channel lifecycle fixture. Production users must not set it."
},
{
"name": "NEMOCLAW_COMPAT_MODEL",
"reason": "Internal E2E/test override for the model used by OpenAI-compatible endpoint scenarios. User-facing custom endpoint model selection is collected through onboard prompts or NEMOCLAW_MODEL."
Expand Down
30 changes: 13 additions & 17 deletions docs/manage-sandboxes/enable-channels-during-onboarding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
title: "Enable Channels During Onboarding"
sidebar-title: "Enable Channels During Onboarding"
description: "Select messaging channels and supply their credentials or pairing inputs during NemoClaw onboarding."
description-agent: "Explains the interactive and scripted onboarding flows for selecting messaging channels, creating OpenShell bridge providers, and removing a channel by clearing its host inputs. Use when enabling or disabling channels during onboarding."
description-agent: "Explains the interactive and scripted onboarding flows for selecting messaging channels, creating OpenShell bridge providers, preserving reusable channels, and explicitly removing a channel. Use when enabling or disabling channels during onboarding."
keywords: ["nemoclaw onboard messaging", "messaging channel picker", "channel environment variables", "disable messaging channel"]
content:
type: "how_to"
Expand Down Expand Up @@ -87,27 +87,23 @@ NemoClaw compiles the selected channel configuration into `NEMOCLAW_MESSAGING_PL
The build applies the selected agent configuration, writes reduced runtime metadata to `/usr/local/share/nemoclaw/messaging-runtime-plan.json`, and removes the full build plan from the runtime environment.
Credential bindings remain OpenShell credential placeholders, so raw messaging credentials do not enter the sandbox image or agent configuration.

## Stop Configuring a Channel
## Remove a Channel

Onboarding reads the host inputs on every run, so clearing a channel's inputs and re-onboarding removes it.
Unset the channel's environment variables.
Run onboarding again.
Clearing a channel's host environment variables and rerunning onboarding does not remove an active host-backed channel when every recorded credential binding still matches its OpenShell gateway provider or its gateway-minted bridge provider remains exact.
Onboarding preserves the channel selection and matching network policy preset because interactive inputs normally disappear between runs.
If a required gateway provider is missing or no longer matches the expected credential contract, onboarding disables the channel and drops the matching policy preset.

NemoClaw reports the removal and drops the channel's network policy preset with it, so the sandbox does not keep the wider egress of a channel it no longer serves.
Use `channels remove` for an explicit, durable removal:

Expected output:

```text
No host inputs configure discord; disabling the channel and its network egress.
[non-interactive] Applying policy presets: npm, pypi
```bash
$$nemoclaw my-assistant channels remove discord
```

Onboarding uses the current host inputs to determine whether a token-based channel remains configured.
`$$nemoclaw credentials reset` takes an OpenShell provider name and does not change those host inputs.

A QR-paired channel such as WhatsApp is exempt.
The host holds no value that reports whether the pairing is still live, so an absent host input is not evidence that you removed the channel.
Use [`channels remove`](manage-messaging-channels) for those.
The command removes the durable channel selection, stored credentials, gateway provider, and matching network policy preset.
Interactive use then prompts you to rebuild the sandbox.
Noninteractive use queues the rebuild; run `$$nemoclaw my-assistant rebuild` to apply it.
For an in-sandbox QR-paired channel, the command also clears its session state before teardown.
Refer to [Manage Messaging Channels](manage-messaging-channels) for channel-specific teardown effects and recovery guidance.

## Verify the Result

Expand Down
4 changes: 2 additions & 2 deletions src/lib/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3316,8 +3316,8 @@ async function runOnboard(opts: OnboardOptions = {}): Promise<void> {
loadSession: onboardSession.loadSession,
getActiveSandbox: (name) => registry.getSandbox(name),
mergePolicyMessagingChannels,
detectUnconfiguredMessagingChannels:
messagingChannelSetup.detectUnconfiguredMessagingChannels,
detectUnconfiguredMessagingChannels: messagingChannelSetup.detectUnconfiguredMessagingChannels,
providerMatchesGatewayCredential,
verifyCompatibleEndpointSandboxSmoke: (options) =>
verifyCompatibleEndpointSandboxSmoke({
...options,
Expand Down
97 changes: 47 additions & 50 deletions src/lib/onboard/credential-provider-registration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
credentialProviderRegistrationDependencies,
type CredentialProviderRegistrationDeps,
createCredentialProviderRegistration,
installLiveE2eCredentialProviderRegistrationOverride,
} from "./credential-provider-registration";
import type { MessagingTokenDef } from "./messaging-prep";

Expand Down Expand Up @@ -92,55 +91,6 @@ function sandboxInput(bindings: ReturnType<typeof requiredBindings>) {
}

describe("credential provider registration", () => {
it("restricts the process-global provider override to the destructive live E2E", () => {
vi.stubEnv("NEMOCLAW_RUN_LIVE_E2E", "0");
try {
expect(() =>
installLiveE2eCredentialProviderRegistrationOverride({
expectedName: "e2e-oc-ch-cycle-googlechat-bridge",
expectedType: "google-chat-bridge",
upsert: vi.fn(() => []),
}),
).toThrow("restricted to its destructive live E2E");
} finally {
vi.unstubAllEnvs();
}
});

it("routes one exact Google Chat live E2E plan through the process-global override", () => {
vi.stubEnv("NEMOCLAW_RUN_LIVE_E2E", "1");
const tokenDefs: MessagingTokenDef[] = [
{
name: "e2e-oc-ch-cycle-googlechat-bridge",
envKey: "GOOGLE_CHAT_ACCESS_TOKEN",
token: null,
providerType: "google-chat-bridge",
},
];
const runOpenshell = vi.fn();
const override = vi.fn(() => ["e2e-oc-ch-cycle-googlechat-bridge"]);
const restore = installLiveE2eCredentialProviderRegistrationOverride({
expectedName: "e2e-oc-ch-cycle-googlechat-bridge",
expectedType: "google-chat-bridge",
upsert: override,
});
try {
expect(
credentialProviderRegistrationDependencies.upsertMessagingProviders(
tokenDefs,
runOpenshell,
{ replaceExisting: true },
),
).toEqual(["e2e-oc-ch-cycle-googlechat-bridge"]);
expect(override).toHaveBeenCalledExactlyOnceWith(tokenDefs, runOpenshell, {
replaceExisting: true,
});
} finally {
restore();
vi.unstubAllEnvs();
}
});

it("resolves the provider upsert dependency when registration executes", () => {
const session = { stagedCredentialProviders: [] } as unknown as Session;
const runOpenshell = vi.fn();
Expand Down Expand Up @@ -257,6 +207,53 @@ describe("credential provider registration", () => {
]);
});

it("does not classify an unavailable provider inspection as a missing binding", () => {
const session = { stagedCredentialProviders: [] } as unknown as Session;
const runOpenshell = vi.fn((_args: string[]) => ({
status: 1,
stdout: "",
stderr: "gateway unavailable",
}));
const registration = createCredentialProviderRegistration(
registrationDeps(runOpenshell, session),
);

expect(() =>
registration.providerMatchesGatewayCredential(
"alpha-discord-bridge",
"generic",
"DISCORD_BOT_TOKEN",
),
).toThrow("Could not inspect credential provider 'alpha-discord-bridge'");
expect(runOpenshell).toHaveBeenCalledWith(
["provider", "get", "-g", "test-gateway", "alpha-discord-bridge"],
expect.objectContaining({ ignoreError: true, suppressOutput: true }),
);
});

it("does not classify an unavailable static profile inspection as profile drift", () => {
const session = { stagedCredentialProviders: [] } as unknown as Session;
const runOpenshell = vi.fn((_args: string[]) => ({
status: 1,
stdout: "",
stderr: "gateway unavailable",
}));
const deps = registrationDeps(runOpenshell, session);
deps.root = process.cwd();
const registration = createCredentialProviderRegistration(deps);

expect(() =>
registration.providerMatchesGatewayCredential(
"alpha-discord-bridge",
"discord-hermes-static-v1",
"DISCORD_BOT_TOKEN",
),
).toThrow("Could not inspect static provider profile 'discord-hermes-static-v1'");
expect(runOpenshell.mock.calls.map(([args]) => args.join(" "))).toEqual([
"provider profile -g test-gateway export discord-hermes-static-v1 --output json",
]);
});

it("rejects tokenless Hermes Discord profile drift before provider mutation", async () => {
const session = { stagedCredentialProviders: [] } as unknown as Session;
const runOpenshell = vi.fn((args: string[]) =>
Expand Down
86 changes: 16 additions & 70 deletions src/lib/onboard/credential-provider-registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,79 +12,13 @@ import { createGatewayScopedOpenshellRunner } from "./setup-inference";

const providers = require("./providers");

type CredentialProviderRegistrationUpsert = (
tokenDefs: MessagingTokenDef[],
runOpenshell: OpenshellCliHelpers["runOpenshell"],
options: MessagingProviderRegistrationOptions,
) => string[];

type LiveE2eCredentialProviderOverride = {
readonly expectedName: string;
readonly expectedType: string;
readonly upsert: CredentialProviderRegistrationUpsert;
};

const LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY =
"__nemoclawLiveE2eCredentialProviderRegistrationOverride" as const;

function liveE2eCredentialProviderOverride(): LiveE2eCredentialProviderOverride | null {
const state = globalThis as typeof globalThis & {
[LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY]?: LiveE2eCredentialProviderOverride;
};
return state[LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY] ?? null;
}

/** Install the exact Google Chat fake-mint boundary used by the destructive live E2E. */
export function installLiveE2eCredentialProviderRegistrationOverride(input: {
readonly expectedName: string;
readonly expectedType: "google-chat-bridge" | "google-chat-hermes-bridge";
readonly upsert: CredentialProviderRegistrationUpsert;
}): () => void {
if (
process.env.NEMOCLAW_RUN_LIVE_E2E !== "1" ||
!/^e2e-(?:oc|hm)-ch-[a-z0-9-]+-googlechat-bridge$/u.test(input.expectedName)
) {
throw new Error("Google Chat provider override is restricted to its destructive live E2E.");
}
const state = globalThis as typeof globalThis & {
[LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY]?: LiveE2eCredentialProviderOverride;
};
if (state[LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY]) {
throw new Error("A live E2E credential provider override is already installed.");
}
const installed = { ...input };
state[LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY] = installed;
let restored = false;
return () => {
if (restored) return;
if (state[LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY] !== installed) {
throw new Error("The live E2E credential provider override changed before cleanup.");
}
delete state[LIVE_E2E_CREDENTIAL_PROVIDER_OVERRIDE_KEY];
restored = true;
};
}

/** Late-bound provider upsert seam used by live credential fixtures. */
export const credentialProviderRegistrationDependencies = {
upsertMessagingProviders(
tokenDefs: MessagingTokenDef[],
runOpenshell: OpenshellCliHelpers["runOpenshell"],
options: MessagingProviderRegistrationOptions,
): string[] {
const override = liveE2eCredentialProviderOverride();
if (override) {
const expected = tokenDefs.filter(
({ envKey, name, providerType }) =>
envKey === "GOOGLE_CHAT_ACCESS_TOKEN" &&
name === override.expectedName &&
providerType === override.expectedType,
);
if (expected.length !== 1) {
throw new Error("Google Chat live E2E provider override received an unexpected plan.");
}
return override.upsert(tokenDefs, runOpenshell, options);
}
return providers.upsertMessagingProviders(tokenDefs, runOpenshell, options) as string[];
},
};
Expand Down Expand Up @@ -275,19 +209,31 @@ export function createCredentialProviderRegistration(deps: CredentialProviderReg
binding: CheckpointProviderBinding,
runOpenshell: OpenshellCliHelpers["runOpenshell"],
): boolean {
const staticProfileMatches = messagingBridgeProvider.matchesRegisteredStaticMessagingProfile(
const staticProfile = messagingBridgeProvider.inspectRegisteredStaticMessagingProfile(
binding.type,
{ root: deps.root, runOpenshell },
);
if (staticProfileMatches === false) return false;
return gatewayProviderMetadata.matchesGatewayCredentialFamilyProviderBinding(
providers.readGatewayProviderMetadata(binding.name, runOpenshell, deps.getGatewayName()),
if (staticProfile.kind === "indeterminate") {
throw new Error(
`Could not inspect static provider profile '${binding.type}' on OpenShell gateway '${deps.getGatewayName()}'. Verify the gateway is reachable, then retry the command.`,
);
}
if (staticProfile.kind === "collision") return false;

const provider = gatewayProviderMetadata.inspectGatewayCredentialFamilyProviderBinding(
{
name: binding.name,
type: binding.type,
credentialKey: binding.credentialEnv,
},
runOpenshell,
);
if (provider.kind === "indeterminate") {
throw new Error(
`Could not inspect credential provider '${binding.name}' on OpenShell gateway '${deps.getGatewayName()}'. Verify the gateway is reachable, then retry the command.`,
);
}
return provider.kind === "exact";
}

function providerMatchesGatewayCredential(
Expand Down
8 changes: 4 additions & 4 deletions src/lib/onboard/machine/handlers/policies-test-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { vi } from "vitest";

import { makeMessagingPlan } from "../../../../../test/helpers/messaging-plan-fixtures";
import { mergePolicyMessagingChannels } from "../../messaging-policy-presets";
import { createSession, type Session, type SessionUpdates } from "../../../state/onboard-session";
import type { PoliciesStateOptions } from "./policies";

Expand All @@ -19,13 +20,11 @@ export function createPolicyHandlerDeps(
activeSandbox: vi.fn(() => ({
messaging: { plan: makeMessagingPlan({ channels: ["telegram"] }) },
})),
mergeChannels: vi.fn(
(selected: string[], recorded: string[], active: string[] | null | undefined) =>
selected.length > 0 ? selected : (active ?? recorded),
),
mergeChannels: vi.fn(mergePolicyMessagingChannels),
unconfiguredChannels: vi.fn(
(_planChannels: readonly string[], _selectedChannels: readonly string[]) => [] as string[],
),
providerMatchesGatewayCredential: vi.fn(() => false),
smoke: vi.fn(),
prepareResume: vi.fn(
(
Expand Down Expand Up @@ -61,6 +60,7 @@ export function createPolicyHandlerDeps(
getActiveSandbox: calls.activeSandbox,
mergePolicyMessagingChannels: calls.mergeChannels,
detectUnconfiguredMessagingChannels: calls.unconfiguredChannels,
providerMatchesGatewayCredential: calls.providerMatchesGatewayCredential,
verifyCompatibleEndpointSandboxSmoke: calls.smoke,
preparePolicyPresetResumeSelection: calls.prepareResume,
arePolicyPresetsApplied: calls.appliedCheck,
Expand Down
Loading
Loading