diff --git a/extensions/active-memory/index.test.ts b/extensions/active-memory/index.test.ts index db134ced46e..5257dc56155 100644 --- a/extensions/active-memory/index.test.ts +++ b/extensions/active-memory/index.test.ts @@ -1602,6 +1602,7 @@ describe("active-memory plugin", () => { it("returns partial transcript text on timeout when the subagent has already written assistant output", async () => { __testing.setMinimumTimeoutMsForTests(1); + __testing.setSetupGraceTimeoutMsForTests(0); api.pluginConfig = { agents: ["main"], timeoutMs: 20, @@ -1664,6 +1665,7 @@ describe("active-memory plugin", () => { it("returns partial transcript text on timeout when transcripts are temporary by default", async () => { __testing.setMinimumTimeoutMsForTests(1); + __testing.setSetupGraceTimeoutMsForTests(0); api.pluginConfig = { agents: ["main"], timeoutMs: 20, @@ -1719,6 +1721,7 @@ describe("active-memory plugin", () => { it("keeps timeout status when the timeout transcript is empty", async () => { __testing.setMinimumTimeoutMsForTests(1); + __testing.setSetupGraceTimeoutMsForTests(0); api.pluginConfig = { agents: ["main"], timeoutMs: 1, @@ -1749,6 +1752,7 @@ describe("active-memory plugin", () => { it("keeps timeout status when the timeout transcript path does not exist", async () => { __testing.setMinimumTimeoutMsForTests(1); + __testing.setSetupGraceTimeoutMsForTests(0); api.pluginConfig = { agents: ["main"], timeoutMs: 1, diff --git a/extensions/slack/src/monitor.tool-result.test.ts b/extensions/slack/src/monitor.tool-result.test.ts index 0b29ed7474d..1cfbc5a4067 100644 --- a/extensions/slack/src/monitor.tool-result.test.ts +++ b/extensions/slack/src/monitor.tool-result.test.ts @@ -270,8 +270,15 @@ describe("monitorSlackProvider tool results", () => { await flush(); } - function expectReactionNames(names: string[]) { - expect(reactMock.mock.calls.map(([args]) => (args as { name: string }).name)).toEqual(names); + function expectReactionFlow(expected: { + startsWith: string[]; + endsWith: string; + includes: string; + }) { + const names = reactMock.mock.calls.map(([args]) => (args as { name: string }).name); + expect(names.slice(0, expected.startsWith.length)).toEqual(expected.startsWith); + expect(names).toContain(expected.includes); + expect(names.at(-1)).toBe(expected.endsWith); } async function runDefaultMessageAndExpectSentText(expectedText: string) { @@ -694,7 +701,11 @@ describe("monitorSlackProvider tool results", () => { await runMentionGatedChannelMessageAndFlush(); expect(sendMock).not.toHaveBeenCalled(); - expectReactionNames(["eyes", "scream", "scream"]); + expectReactionFlow({ + startsWith: ["eyes", "scream"], + includes: "scream", + endsWith: "scream", + }); }); it("replies with pairing code when dmPolicy is pairing and no allowFrom is set", async () => { diff --git a/src/agents/model-auth.ts b/src/agents/model-auth.ts index 233d748d8de..1f7882bb6fd 100644 --- a/src/agents/model-auth.ts +++ b/src/agents/model-auth.ts @@ -325,6 +325,9 @@ export function hasRuntimeAvailableProviderAuth(params: { if (authOverride === "aws-sdk") { return true; } + if (authOverride === undefined && provider === "amazon-bedrock") { + return true; + } if ( resolveEnvApiKey(provider, params.env, { config: params.cfg, @@ -336,10 +339,10 @@ export function hasRuntimeAvailableProviderAuth(params: { if (resolveUsableCustomProviderApiKey({ cfg: params.cfg, provider, env: params.env })) { return true; } - if (resolveSyntheticLocalProviderAuth({ cfg: params.cfg, provider })) { + if (hasSyntheticLocalProviderAuthConfig({ cfg: params.cfg, provider })) { return true; } - if (authOverride === undefined && provider === "amazon-bedrock") { + if (resolveSyntheticLocalProviderAuth({ cfg: params.cfg, provider })) { return true; } return false; diff --git a/src/config/doc-baseline.integration.test.ts b/src/config/doc-baseline.integration.test.ts index 7bade183ea1..f945f363d1e 100644 --- a/src/config/doc-baseline.integration.test.ts +++ b/src/config/doc-baseline.integration.test.ts @@ -29,8 +29,8 @@ describe("config doc baseline integration", () => { } it("is deterministic across repeated runs", async () => { - const { baseline } = await getSharedRendered(); - const first = await renderConfigDocBaselineArtifacts(baseline); + const first = await getSharedRendered(); + const { baseline } = first; const second = await renderConfigDocBaselineArtifacts(baseline); expect(second.json.combined).toBe(first.json.combined); diff --git a/src/gateway/server.models-voicewake-misc.test.ts b/src/gateway/server.models-voicewake-misc.test.ts index 8569fba4c79..f20c22121a4 100644 --- a/src/gateway/server.models-voicewake-misc.test.ts +++ b/src/gateway/server.models-voicewake-misc.test.ts @@ -850,43 +850,62 @@ describe("gateway server misc", () => { if (!configPath) { throw new Error("Missing OPENCLAW_CONFIG_PATH"); } - await fs.mkdir(path.dirname(configPath), { recursive: true }); - await fs.writeFile( - configPath, - JSON.stringify( - { - channels: { - discord: { - token: "token-123", + let previousConfig: string | undefined; + try { + previousConfig = await fs.readFile(configPath, "utf-8"); + } catch (err) { + if ((err as NodeJS.ErrnoException).code !== "ENOENT") { + throw err; + } + } + + try { + await fs.mkdir(path.dirname(configPath), { recursive: true }); + await fs.writeFile( + configPath, + JSON.stringify( + { + channels: { + discord: { + token: "token-123", + }, }, }, + null, + 2, + ), + "utf-8", + ); + + await withEnvAsync( + { + OPENCLAW_TEST_MINIMAL_GATEWAY: undefined, + OPENCLAW_DISABLE_BUNDLED_PLUGINS: undefined, + OPENCLAW_BUNDLED_PLUGINS_DIR: path.resolve("extensions"), }, - null, - 2, - ), - "utf-8", - ); + async () => { + const autoPort = await getFreePort(); + const autoServer = await startGatewayServer(autoPort); + await autoServer.close(); + }, + ); - await withEnvAsync( - { - OPENCLAW_TEST_MINIMAL_GATEWAY: undefined, - OPENCLAW_DISABLE_BUNDLED_PLUGINS: undefined, - OPENCLAW_BUNDLED_PLUGINS_DIR: path.resolve("extensions"), - }, - async () => { - const autoPort = await getFreePort(); - const autoServer = await startGatewayServer(autoPort); - await autoServer.close(); - }, - ); - - const updated = JSON.parse(await fs.readFile(configPath, "utf-8")) as Record; - const channels = updated.channels as Record | undefined; - const discord = channels?.discord as Record | undefined; - expect(discord).toMatchObject({ - token: "token-123", - enabled: true, - }); + const updated = JSON.parse(await fs.readFile(configPath, "utf-8")) as Record; + const channels = updated.channels as Record | undefined; + const discord = channels?.discord as Record | undefined; + expect(discord).toMatchObject({ + token: "token-123", + enabled: true, + }); + } finally { + if (previousConfig === undefined) { + await fs.rm(configPath, { force: true }); + } else { + await fs.writeFile(configPath, previousConfig, "utf-8"); + } + clearRuntimeConfigSnapshot(); + clearConfigCache(); + } }); test("releases port after close", async () => {