Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions ci/test-file-size-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"nemoclaw/src/commands/migration-state.test.ts": 1566,
"src/lib/inference/nim.test.ts": 2068,
"src/lib/onboard/preflight.test.ts": 1905,
"test/channels-add-preset.test.ts": 1872,
"test/channels-add-preset.test.ts": 1871,
"test/generate-openclaw-config.test.ts": 1990,
"test/install-preflight.test.ts": 4207,
"test/nemoclaw-start.test.ts": 5231,
"test/onboard-messaging.test.ts": 2094,
"test/onboard-messaging.test.ts": 2063,
"test/onboard-selection.test.ts": 6891,
"test/onboard.test.ts": 4775,
"test/onboard.test.ts": 4774,
"test/policies.test.ts": 2763
}
}
4 changes: 1 addition & 3 deletions src/lib/actions/inference-route-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ function session(overrides: Partial<Session> = {}): Session {
routerCredentialHash: null,
webSearchConfig: null,
policyPresets: null,
messagingChannels: null,
messagingChannelConfig: null,
disabledChannels: null,
messagingPlan: null,
migratedLegacyValueHashes: null,
hermesToolGateways: null,
gpuPassthrough: false,
Expand Down
4 changes: 1 addition & 3 deletions src/lib/actions/inference-set.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ function baseSession(overrides: Partial<Session> = {}): Session {
routerCredentialHash: null,
webSearchConfig: null,
policyPresets: null,
messagingChannels: null,
messagingChannelConfig: null,
disabledChannels: null,
messagingPlan: null,
migratedLegacyValueHashes: null,
hermesToolGateways: null,
gpuPassthrough: false,
Expand Down
42 changes: 40 additions & 2 deletions src/lib/actions/sandbox/channel-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ vi.mock("../../policy", () => ({

vi.mock("../../state/registry", () => ({
getSandbox: vi.fn(),
getConfiguredMessagingChannelsFromEntry: vi.fn((entry) => {
const channels = entry?.messaging?.plan?.channels;
return Array.isArray(channels)
? channels
.filter((channel) => channel?.configured === true)
.map((channel) => channel.channelId)
: [];
}),
getDisabledMessagingChannelsFromEntry: vi.fn((entry) => {
const disabled = entry?.messaging?.plan?.disabledChannels;
return Array.isArray(disabled) ? [...disabled] : [];
}),
}));

vi.mock("../../agent/defs", () => ({
Expand Down Expand Up @@ -108,11 +120,37 @@ function entry(
messagingChannels: string[] = ["whatsapp"],
disabledChannels: string[] = [],
): SandboxEntry {
const disabled = new Set(disabledChannels);
return {
name: "alpha",
agent: "openclaw",
messagingChannels,
disabledChannels,
messaging: {
schemaVersion: 1,
plan: {
schemaVersion: 1,
sandboxName: "alpha",
agent: "openclaw",
workflow: "onboard",
channels: messagingChannels.map((channelId) => ({
channelId,
displayName: channelId,
authMode: channelId === "whatsapp" ? "in-sandbox-qr" : "token-paste",
active: !disabled.has(channelId),
selected: true,
configured: true,
disabled: disabled.has(channelId),
inputs: [],
hooks: [],
})),
disabledChannels,
credentialBindings: [],
networkPolicy: { presets: [], entries: [] },
agentRender: [],
buildSteps: [],
stateUpdates: [],
healthChecks: [],
},
},
} as SandboxEntry;
}

Expand Down
17 changes: 10 additions & 7 deletions src/lib/actions/sandbox/channel-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ function buildWhatsappProbeInput(
}

const entry = deps.getSandbox(sandboxName);
const channelEnabledInRegistry = (entry?.messagingChannels ?? []).includes("whatsapp");
const channelEnabledInRegistry = registry
.getConfiguredMessagingChannelsFromEntry(entry)
.includes("whatsapp");

const appliedPresets = deps.getAppliedPresets(sandboxName);
const presetInRegistry = appliedPresets.includes("whatsapp");
Expand Down Expand Up @@ -440,8 +442,8 @@ function buildBasicChannelReport(
deps: Required<StatusDeps>,
): ChannelStatusReport {
const entry = deps.getSandbox(sandboxName);
const enabled = (entry?.messagingChannels ?? []).includes(channelName);
const disabled = (entry?.disabledChannels ?? []).includes(channelName);
const enabled = registry.getConfiguredMessagingChannelsFromEntry(entry).includes(channelName);
const disabled = registry.getDisabledMessagingChannelsFromEntry(entry).includes(channelName);
const appliedPresets = deps.getAppliedPresets(sandboxName);
const presetInRegistry = appliedPresets.includes(channelName);
const signals: DiagnosticSignal[] = [];
Expand Down Expand Up @@ -523,11 +525,12 @@ export async function showSandboxChannelStatus(

let channelName = channelArg;
if (!channelName) {
const enabled = (entry.messagingChannels ?? []).filter((name: string) => name === "whatsapp");
const configuredChannels = registry.getConfiguredMessagingChannelsFromEntry(entry);
const enabled = configuredChannels.filter((name: string) => name === "whatsapp");
if (enabled.length > 0) {
channelName = "whatsapp";
} else if ((entry.messagingChannels ?? []).length > 0) {
channelName = entry.messagingChannels?.[0];
} else if (configuredChannels.length > 0) {
channelName = configuredChannels[0];
} else {
channelName = "whatsapp";
}
Expand All @@ -551,7 +554,7 @@ export async function showSandboxChannelStatus(

const agent = deps.loadAgent(entry.agent || "openclaw");

const disabledChannels = new Set(entry.disabledChannels ?? []);
const disabledChannels = new Set(registry.getDisabledMessagingChannelsFromEntry(entry));
const channelIsPaused = disabledChannels.has(channelName);

let report: ChannelStatusReport;
Expand Down
10 changes: 4 additions & 6 deletions src/lib/actions/sandbox/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ function channelRuntimeDoctorCheck(
}

function messagingDoctorCheck(sandboxName: string, sb: SandboxEntry): DoctorCheck {
const registeredChannels = Array.isArray(sb.messagingChannels) ? sb.messagingChannels : [];
const disabledChannels = new Set(Array.isArray(sb.disabledChannels) ? sb.disabledChannels : []);
const registeredChannels = registry.getConfiguredMessagingChannelsFromEntry(sb);
const disabledChannels = new Set(registry.getDisabledMessagingChannelsFromEntry(sb));
const channels = registeredChannels.filter((channel: string) => !disabledChannels.has(channel));
const pausedChannels = registeredChannels.filter((channel: string) =>
disabledChannels.has(channel),
Expand Down Expand Up @@ -783,10 +783,8 @@ export async function runSandboxDoctor(
// #4156: bridge the gap between "configured" and "runtime-visible" — the
// existing messaging check above probes provider attachment, not whether
// OpenClaw's runtime config actually surfaces each enabled channel.
const registeredChannels = Array.isArray(sb.messagingChannels) ? sb.messagingChannels : [];
const disabledChannelsSet = new Set(
Array.isArray(sb.disabledChannels) ? sb.disabledChannels : [],
);
const registeredChannels = registry.getConfiguredMessagingChannelsFromEntry(sb);
const disabledChannelsSet = new Set(registry.getDisabledMessagingChannelsFromEntry(sb));
const enabledChannels = registeredChannels.filter(
(channel: string) => !disabledChannelsSet.has(channel),
);
Expand Down
Loading
Loading