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
21 changes: 18 additions & 3 deletions src/lib/onboard/policy-resume-selection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ type Preset = { name: string; access?: string };
function policies(
options: { applied?: string[]; custom?: string[]; customOwnsObservability?: boolean } = {},
) {
const setupPresets = ["npm", "brave", "tavily", "observability-otlp-local"].map((name) => ({
name,
}));
const setupPresets = ["npm", "brave", "tavily", "slack", "observability-otlp-local"].map(
(name) => ({ name }),
);
const customPresets = (options.custom ?? []).map((name) => ({ name }));
return {
setupPolicyPresetSupported: () => true,
Expand Down Expand Up @@ -87,6 +87,21 @@ describe("preparePolicyPresetResumeSelection web search reconciliation", () => {
});
});

describe("preparePolicyPresetResumeSelection required preset reconciliation", () => {
it("marks an empty recording for reconciliation when Slack becomes required (#6042)", () => {
const result = preparePolicyPresetResumeSelection({ policies: policies() }, "alpha", {
recordedPolicyPresets: [],
enabledChannels: ["slack"],
agent: "openclaw",
webSearchConfig: null,
webSearchSupported: true,
});

expect(result.policyPresets).toEqual(["slack"]);
expect(result.recordedPolicyPresetsNeedReconcile).toBe(true);
});
});

describe("preparePolicyPresetResumeSelection tier-default preservation (#6844)", () => {
// These exercise the real tiers.yaml through classifyPresetProvenance (no tier
// stub): `brave` is a Balanced default, and Restricted lists no such default.
Expand Down
6 changes: 6 additions & 0 deletions test/onboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type OnboardTestInternals = {
session: T,
selectedAgentName: string,
) => T;
arePolicyPresetsApplied: (sandboxName: string, selectedPresets?: string[]) => boolean;
pullAndResolveBaseImageDigest: () => { digest: string | null; ref: string } | null;
createSetupInference: (overrides?: Partial<SetupInferenceDeps>) => SetupInference;
SANDBOX_BASE_IMAGE: string;
Expand Down Expand Up @@ -90,6 +91,7 @@ const {
getResumeConfigConflicts,
getResumeSandboxConflict,
clearAgentScopedResumeState,
arePolicyPresetsApplied,
createSetupInference,
SANDBOX_BASE_IMAGE,
} = onboardTestInternals;
Expand All @@ -98,6 +100,10 @@ const createDirectSetupInferenceHarness =
createDirectSetupInferenceHarnessFactory(createSetupInference);

describe("onboard helpers", () => {
it("does not treat an empty policy preset selection as already applied (#6042)", () => {
expect(arePolicyPresetsApplied("unused", [])).toBe(false);
});

it("adds host proxy variables to sandbox startup env args", () => {
const envArgs = ["CHAT_UI_URL=http://127.0.0.1:18789"];

Expand Down
Loading