From 5f04dfa4441eb19d8fceb85c4c4b19300e8d2f11 Mon Sep 17 00:00:00 2001 From: Rebecca Sliter <571084+rsliter@users.noreply.github.com> Date: Tue, 25 Aug 2026 20:07:47 -0700 Subject: [PATCH 1/3] test(onboard): cover inactive OpenClaw messaging preset --- .../onboard/policy-selection-application.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/onboard/policy-selection-application.test.ts b/src/lib/onboard/policy-selection-application.test.ts index 76709b67fb7..311bca5eb0b 100644 --- a/src/lib/onboard/policy-selection-application.test.ts +++ b/src/lib/onboard/policy-selection-application.test.ts @@ -3,7 +3,9 @@ import { describe, expect, it, vi } from "vitest"; import * as policies from "../policy"; +import * as tiers from "../policy/tiers"; import { + computeSetupPresetSuggestions, createOnboardPolicyApplication, type OnboardPolicyApplicationDeps, } from "./policy-selection"; @@ -28,6 +30,17 @@ vi.mock("./policy-context-seed", () => ({ seedInitialPolicyContext })); vi.mock("./policy-preset-sync", () => ({ syncPresetSelection })); describe("onboarding policy application", () => { + it("suggests only enabled OpenClaw messaging presets for the open tier (#10153)", () => { + const suggestions = computeSetupPresetSuggestions( + { policies, tiers, localInferenceProviders: [] }, + "open", + { agent: "openclaw", enabledChannels: ["slack"] }, + ); + + expect(suggestions).toContain("slack"); + expect(suggestions).not.toContain("discord"); + }); + it("runs policy application while holding the sandbox mutation lock", async () => { const events: string[] = []; const withSandboxMutationLock: OnboardPolicyApplicationDeps["withSandboxMutationLock"] = vi.fn( From 432db612d931096007fca41a56a0e7f9cda5162c Mon Sep 17 00:00:00 2001 From: Rebecca Sliter <571084+rsliter@users.noreply.github.com> Date: Tue, 25 Aug 2026 20:17:00 -0700 Subject: [PATCH 2/3] fix(onboard): exclude inactive OpenClaw Discord egress --- .../policy-selection-application.test.ts | 13 ------------- src/lib/onboard/policy-selection.ts | 8 +++----- .../onboard-policy-suggestions.test.ts | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/lib/onboard/policy-selection-application.test.ts b/src/lib/onboard/policy-selection-application.test.ts index 311bca5eb0b..76709b67fb7 100644 --- a/src/lib/onboard/policy-selection-application.test.ts +++ b/src/lib/onboard/policy-selection-application.test.ts @@ -3,9 +3,7 @@ import { describe, expect, it, vi } from "vitest"; import * as policies from "../policy"; -import * as tiers from "../policy/tiers"; import { - computeSetupPresetSuggestions, createOnboardPolicyApplication, type OnboardPolicyApplicationDeps, } from "./policy-selection"; @@ -30,17 +28,6 @@ vi.mock("./policy-context-seed", () => ({ seedInitialPolicyContext })); vi.mock("./policy-preset-sync", () => ({ syncPresetSelection })); describe("onboarding policy application", () => { - it("suggests only enabled OpenClaw messaging presets for the open tier (#10153)", () => { - const suggestions = computeSetupPresetSuggestions( - { policies, tiers, localInferenceProviders: [] }, - "open", - { agent: "openclaw", enabledChannels: ["slack"] }, - ); - - expect(suggestions).toContain("slack"); - expect(suggestions).not.toContain("discord"); - }); - it("runs policy application while holding the sandbox mutation lock", async () => { const events: string[] = []; const withSandboxMutationLock: OnboardPolicyApplicationDeps["withSandboxMutationLock"] = vi.fn( diff --git a/src/lib/onboard/policy-selection.ts b/src/lib/onboard/policy-selection.ts index 1e20b20625e..1a6708f689d 100644 --- a/src/lib/onboard/policy-selection.ts +++ b/src/lib/onboard/policy-selection.ts @@ -254,18 +254,16 @@ export function computeSetupPresetSuggestions( const activeMessagingPresets = Array.isArray(enabledChannels) ? new Set(allMessagingChannelPolicyPresets(enabledChannels)) : null; - const hermesAgent = typeof agent === "string" && agent.trim().toLowerCase() === "hermes"; const supportOptions = { webSearchSupported: options.webSearchSupported }; const suggestions = deps.tiers .resolveTierPresets(tierName) .map((preset) => preset.name) .filter((name) => setupPolicyPresetAppliesToAgent(name, agent)) - // Hermes Discord egress names a sandbox-scoped credential provider. An - // open tier may contain the preset, but OpenShell rejects it unless the - // channel is active and its provider is attached to the sandbox. + // Discord egress names a sandbox-scoped credential provider. An open tier + // may contain the preset, but OpenShell rejects it unless the channel is + // active and its provider is attached to the sandbox. .filter( (name) => - !hermesAgent || name !== "discord" || activeMessagingPresets === null || activeMessagingPresets.has(name), diff --git a/test/onboarding/onboard-policy-suggestions.test.ts b/test/onboarding/onboard-policy-suggestions.test.ts index f7ac5261b85..04476d298b6 100644 --- a/test/onboarding/onboard-policy-suggestions.test.ts +++ b/test/onboarding/onboard-policy-suggestions.test.ts @@ -599,6 +599,23 @@ describe("onboard policy preset suggestions", () => { expect(active).toContain("discord"); }); + it("omits credential-bound OpenClaw Discord egress until the channel is active (#10153)", () => { + const slackOnly = computeSetupPresetSuggestions("open", { + agent: "openclaw", + enabledChannels: ["slack"], + knownPresetNames: known, + }); + const discord = computeSetupPresetSuggestions("open", { + agent: "openclaw", + enabledChannels: ["discord"], + knownPresetNames: known, + }); + + expect(slackOnly).toContain("slack"); + expect(slackOnly).not.toContain("discord"); + expect(discord).toContain("discord"); + }); + it("drops channel names that are not known presets", () => { const suggestions = computeSetupPresetSuggestions("balanced", { enabledChannels: ["telegram", "not-a-real-preset"], From fdc2a25d0a31c77b17e042805e9f9aa92b76c5be Mon Sep 17 00:00:00 2001 From: Rebecca Sliter <571084+rsliter@users.noreply.github.com> Date: Tue, 25 Aug 2026 20:33:43 -0700 Subject: [PATCH 3/3] test(onboard): consolidate Discord egress coverage --- .../onboard-policy-suggestions.test.ts | 49 +++++++------------ 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/test/onboarding/onboard-policy-suggestions.test.ts b/test/onboarding/onboard-policy-suggestions.test.ts index 04476d298b6..70acb23dbf4 100644 --- a/test/onboarding/onboard-policy-suggestions.test.ts +++ b/test/onboarding/onboard-policy-suggestions.test.ts @@ -583,38 +583,25 @@ describe("onboard policy preset suggestions", () => { expect(suggestions.filter((name: string) => name === "slack")).toHaveLength(1); }); - it("omits credential-bound Hermes Discord egress until the channel is active", () => { - const inactive = computeSetupPresetSuggestions("open", { - agent: "hermes", - enabledChannels: [], - knownPresetNames: known, - }); - const active = computeSetupPresetSuggestions("open", { - agent: "hermes", - enabledChannels: ["discord"], - knownPresetNames: known, - }); - - expect(inactive).not.toContain("discord"); - expect(active).toContain("discord"); - }); - - it("omits credential-bound OpenClaw Discord egress until the channel is active (#10153)", () => { - const slackOnly = computeSetupPresetSuggestions("open", { - agent: "openclaw", - enabledChannels: ["slack"], - knownPresetNames: known, - }); - const discord = computeSetupPresetSuggestions("open", { - agent: "openclaw", - enabledChannels: ["discord"], - knownPresetNames: known, - }); + it.each(["hermes", "openclaw"] as const)( + "omits credential-bound Discord egress for %s until the channel is active (#10153)", + (agent) => { + const slackOnly = computeSetupPresetSuggestions("open", { + agent, + enabledChannels: ["slack"], + knownPresetNames: known, + }); + const discord = computeSetupPresetSuggestions("open", { + agent, + enabledChannels: ["discord"], + knownPresetNames: known, + }); - expect(slackOnly).toContain("slack"); - expect(slackOnly).not.toContain("discord"); - expect(discord).toContain("discord"); - }); + expect(slackOnly).toContain("slack"); + expect(slackOnly).not.toContain("discord"); + expect(discord).toContain("discord"); + }, + ); it("drops channel names that are not known presets", () => { const suggestions = computeSetupPresetSuggestions("balanced", {