Skip to content

Commit f1781ac

Browse files
committed
fix(ci): align repairs with latest main
1 parent 87c1874 commit f1781ac

3 files changed

Lines changed: 35 additions & 64 deletions

File tree

‎src/infra/approval-handler-runtime.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ function makeNativeApprovalCapability(
6161
} & ApprovalNativeRuntimeAdapterStubParams = {},
6262
): ApprovalCapability {
6363
const preferredSurface = params.preferredSurface ?? "origin";
64-
const nativeRuntime = createApprovalNativeRuntimeAdapterStubs(params);
6564
return {
6665
native: {
6766
describeDeliveryCapabilities: vi.fn().mockReturnValue({
@@ -76,7 +75,7 @@ function makeNativeApprovalCapability(
7675
? { resolveApproverDmTargets: params.resolveApproverDmTargets }
7776
: {}),
7877
},
79-
nativeRuntime: { ...nativeRuntime, eventKinds: ["exec", "plugin"] },
78+
nativeRuntime: createApprovalNativeRuntimeAdapterStubs(params),
8079
};
8180
}
8281

‎src/skills/workshop/collection-review.test.ts‎

Lines changed: 33 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
isSkillCollectionReviewDue,
1313
recordSkillCollectionReviewSuccess,
1414
} from "./collection-review-state.js";
15-
import { runScheduledSkillCollectionReviews } from "./collection-review.js";
15+
import {
16+
runScheduledSkillCollectionReviews,
17+
runSkillCollectionReview,
18+
} from "./collection-review.js";
1619

1720
const runEmbeddedAgent = vi.hoisted(() => vi.fn());
1821
const authStoresByAgentDir = vi.hoisted(() => new Map<string, unknown>());
@@ -49,7 +52,6 @@ afterEach(async () => {
4952
describe("skill collection review", () => {
5053
it("runs an incognito session with only collection read and reconcile", async () => {
5154
const workspaceDir = await tempDirs.make("openclaw-collection-review-workspace-");
52-
let reconcileResult: unknown;
5355
await writeWorkspaceSkills(workspaceDir, [
5456
{ name: "useful", description: "Useful reusable procedure" },
5557
]);
@@ -63,36 +65,26 @@ describe("skill collection review", () => {
6365
collectionReconcile: params.skillWorkshopCollectionReconcile,
6466
});
6567
await tool.execute("read", { action: "read", skill_name: "useful" });
66-
reconcileResult = await tool.execute("reconcile", {
68+
await tool.execute("reconcile", {
6769
action: "reconcile",
6870
collection: [{ action: "keep", name: "useful" }],
6971
});
7072
return {};
7173
});
7274

73-
const onError = vi.fn();
74-
await runScheduledSkillCollectionReviews({
75-
config: {
76-
agents: {
77-
list: [
78-
{
79-
id: "main",
80-
default: true,
81-
model: "openai/gpt-5.6-sol@openai:work",
82-
workspace: workspaceDir,
83-
},
84-
],
75+
await expect(
76+
runSkillCollectionReview({
77+
agentId: "main",
78+
config: {
79+
agents: {
80+
list: [{ id: "main", default: true, model: "openai/gpt-5.6-sol@openai:work" }],
81+
},
82+
skills: { workshop: { autonomous: { mode: "auto" } } },
8583
},
86-
skills: { workshop: { autonomous: { mode: "auto" } } },
87-
},
88-
env: testState.env,
89-
onError,
90-
});
91-
92-
expect(onError).not.toHaveBeenCalled();
93-
expect(reconcileResult).toMatchObject({
94-
details: { kept: ["useful"], written: [], dropped: [] },
95-
});
84+
workspaceDir,
85+
env: testState.env,
86+
}),
87+
).resolves.toMatchObject({ kept: ["useful"], written: [], dropped: [] });
9688
expect(runEmbeddedAgent).toHaveBeenCalledWith(
9789
expect.objectContaining({
9890
trigger: "cron",
@@ -139,16 +131,12 @@ describe("skill collection review", () => {
139131
return {};
140132
});
141133

142-
const onError = vi.fn();
143-
await runScheduledSkillCollectionReviews({
144-
config: {
145-
agents: { list: [{ id: "main", default: true, workspace: workspaceDir }] },
146-
skills: { workshop: { autonomous: { mode: "auto" } } },
147-
},
134+
await runSkillCollectionReview({
135+
agentId: "main",
136+
config: { skills: { workshop: { autonomous: { mode: "auto" } } } },
137+
workspaceDir,
148138
env: testState.env,
149-
onError,
150139
});
151-
expect(onError).not.toHaveBeenCalled();
152140
});
153141

154142
it("persists the daily boundary per workspace", async () => {
@@ -201,29 +189,19 @@ describe("skill collection review", () => {
201189
return {};
202190
});
203191

204-
const onError = vi.fn();
205-
await runScheduledSkillCollectionReviews({
192+
await runSkillCollectionReview({
193+
agentId: "main",
206194
config: {
207-
agents: {
208-
list: [
209-
{
210-
id: "main",
211-
default: true,
212-
workspace: workspaceDir,
213-
skills: ["enabled", "disabled"],
214-
},
215-
],
216-
},
195+
agents: { list: [{ id: "main", skills: ["enabled", "disabled"] }] },
217196
skills: {
218197
entries: { disabled: { enabled: false } },
219198
workshop: { autonomous: { mode: "auto" } },
220199
},
221200
},
201+
workspaceDir,
222202
env: testState.env,
223-
onError,
224203
});
225204

226-
expect(onError).not.toHaveBeenCalled();
227205
expect((await fs.readdir(path.join(workspaceDir, "skills"))).toSorted()).toEqual([
228206
"agent-filtered",
229207
"disabled",
@@ -519,7 +497,6 @@ describe("skill collection review", () => {
519497

520498
it("rejects an oversized collection before model dispatch", async () => {
521499
const workspaceDir = await tempDirs.make("openclaw-collection-review-oversized-");
522-
const canonicalWorkspaceDir = await fs.realpath(workspaceDir);
523500
await writeWorkspaceSkills(workspaceDir, [
524501
{
525502
name: "oversized",
@@ -528,19 +505,14 @@ describe("skill collection review", () => {
528505
},
529506
]);
530507

531-
const onError = vi.fn();
532-
await runScheduledSkillCollectionReviews({
533-
config: {
534-
agents: { list: [{ id: "main", default: true, workspace: workspaceDir }] },
535-
skills: { workshop: { autonomous: { mode: "auto" } } },
536-
},
537-
env: testState.env,
538-
onError,
539-
});
540-
541-
expect(onError).toHaveBeenCalledOnce();
542-
expect(String(onError.mock.calls[0]?.[0])).toContain("review limit");
543-
expect(onError.mock.calls[0]?.[1]).toBe(canonicalWorkspaceDir);
508+
await expect(
509+
runSkillCollectionReview({
510+
agentId: "main",
511+
config: { skills: { workshop: { autonomous: { mode: "auto" } } } },
512+
workspaceDir,
513+
env: testState.env,
514+
}),
515+
).rejects.toThrow("review limit");
544516
expect(runEmbeddedAgent).not.toHaveBeenCalled();
545517
});
546518
});

‎src/skills/workshop/collection-review.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function startSkillCollectionMaintenance(options: {
6464
};
6565
}
6666

67-
async function runSkillCollectionReview(params: {
67+
export async function runSkillCollectionReview(params: {
6868
agentId: string;
6969
agentIds?: readonly string[];
7070
config: OpenClawConfig;

0 commit comments

Comments
 (0)