Skip to content

Commit 41e41ee

Browse files
committed
test: fix current-main CI regressions
1 parent d85c2c6 commit 41e41ee

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/commands/daemon-install-helpers.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import os from "node:os";
44
import path from "node:path";
55
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
66
import { writeStateDirDotEnv } from "../config/test-helpers.js";
7+
import type { OpenClawConfig } from "../config/types.js";
78
import { collectPreservedExistingServiceEnvVars } from "./daemon-install-helpers.js";
89

910
const mocks = vi.hoisted(() => ({
@@ -485,6 +486,7 @@ describe("buildGatewayInstallPlan", () => {
485486
models: {
486487
providers: {
487488
openai: {
489+
baseUrl: "https://api.openai.com/v1",
488490
apiKey: { source: "env", provider: "default", id: "OPENAI_API_KEY" },
489491
models: [],
490492
},
@@ -1287,7 +1289,7 @@ describe("buildGatewayInstallPlan — dotenv merge", () => {
12871289
},
12881290
},
12891291
},
1290-
},
1292+
} as unknown as OpenClawConfig,
12911293
});
12921294

12931295
expect(plan.environment.TELEGRAM_DEFAULT_BOTTOKEN).toBe("telegram-shell-token");

src/cron/isolated-agent/run-session-state.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,16 @@ describe("createPersistCronSessionEntry", () => {
144144
});
145145
});
146146

147-
it("persists cron state under the supplied execution session key", async () => {
147+
it("persists non-resumable cron state under the supplied execution session key", async () => {
148148
const cronSession = makeCronSession();
149149
const updateSessionStore = vi.fn(
150150
async (_storePath, update: (store: Record<string, SessionEntry>) => void) => {
151151
const store: Record<string, SessionEntry> = {};
152152
update(store);
153-
expect(store["agent:main:cron:job"]).toBe(cronSession.sessionEntry);
153+
expect(store["agent:main:cron:job"]).toEqual({
154+
updatedAt: 1000,
155+
systemSent: true,
156+
});
154157
},
155158
);
156159

@@ -163,7 +166,10 @@ describe("createPersistCronSessionEntry", () => {
163166

164167
await persist();
165168

166-
expect(cronSession.store["agent:main:cron:job"]).toBe(cronSession.sessionEntry);
169+
expect(cronSession.store["agent:main:cron:job"]).toEqual({
170+
updatedAt: 1000,
171+
systemSent: true,
172+
});
167173
});
168174

169175
it("adopts rotated run transcript metadata before persisting session-bound cron state", async () => {

src/cron/isolated-agent/run.message-tool-policy.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -996,12 +996,12 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
996996
expect(getAgentRunContext("test-session-id")).toBeUndefined();
997997
});
998998

999-
it("keeps shared cron run context references active after completion", async () => {
999+
it("releases preexisting run context after detached current-session completion", async () => {
10001000
const cronSession = makeCronSession({
10011001
store: { "agent:default:cron:message-tool-policy": { retained: true } },
10021002
});
10031003
resolveCronSessionMock.mockReturnValue(cronSession);
1004-
const { clearAgentRunContext, getAgentRunContext, registerAgentRunContext } =
1004+
const { getAgentRunContext, registerAgentRunContext } =
10051005
await import("../../infra/agent-events.js");
10061006
registerAgentRunContext("test-session-id", {
10071007
sessionKey: "agent:default:cron:message-tool-policy",
@@ -1015,11 +1015,8 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
10151015
job: currentSessionJob as never,
10161016
});
10171017

1018-
expect(getAgentRunContext("test-session-id")).toMatchObject({
1019-
sessionKey: "agent:default:cron:message-tool-policy",
1020-
});
1018+
expect(getAgentRunContext("test-session-id")).toBeUndefined();
10211019
expect(cronSession.store).toBeUndefined();
1022-
clearAgentRunContext("test-session-id");
10231020
});
10241021

10251022
it("releases a shared cron run context created by this invocation", async () => {

0 commit comments

Comments
 (0)