Skip to content

Commit 799e85c

Browse files
committed
test(agents): remove aggregate-lane noise from src/agents suites
Supervisor-capture tests asserted real telegram/slack channel ids, so their pass/fail depended on which channel plugins the selected vitest lane loads (stubs when focused, real normalizers under unit-fast); switch to a neutral synthetic channel. Two embedded-runner tests carried a shared literal /tmp/openclaw.sqlite storePath — one actually opened it, colliding with stale artifacts across parallel runs; both now use realpath'd auto-cleaned per-test temp dirs. Evidence in PR #122164 body; pre-fix aggregates failed 12/1202 (cli) and 4/4750 (embedded), post-fix green in default and shuffled order.
1 parent 722e20b commit 799e85c

3 files changed

Lines changed: 53 additions & 33 deletions

File tree

‎src/agents/cli-runner/execute.supervisor-capture.test.ts‎

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ vi.mock("../../gateway/mcp-http.loopback-runtime.js", async (importOriginal) =>
4646
type ProcessSupervisor = ReturnType<typeof getProcessSupervisor>;
4747
type SupervisorSpawnInput = Parameters<ProcessSupervisor["spawn"]>[0];
4848

49+
const TEST_MESSAGE_CHANNEL = "test-channel";
50+
4951
function recordMcpLoopbackToolCallResult(params: {
5052
captureKey: string;
5153
toolName: string;
@@ -1680,7 +1682,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
16801682
name: "mcp__openclaw__message",
16811683
input: {
16821684
action: "send",
1683-
channel: "telegram",
1685+
channel: TEST_MESSAGE_CHANNEL,
16841686
target: "chat123",
16851687
message: "done",
16861688
},
@@ -1702,7 +1704,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17021704
toolName: "message",
17031705
args: {
17041706
action: "send",
1705-
channel: "telegram",
1707+
channel: TEST_MESSAGE_CHANNEL,
17061708
target: "chat123",
17071709
message: "done",
17081710
},
@@ -1732,7 +1734,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17321734
expect(result.messagingToolSentTargets).toEqual([
17331735
expect.objectContaining({
17341736
tool: "message",
1735-
provider: "telegram",
1737+
provider: TEST_MESSAGE_CHANNEL,
17361738
to: "chat123",
17371739
text: "done",
17381740
}),
@@ -1752,7 +1754,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17521754
name: "mcp__openclaw__message",
17531755
input: {
17541756
action: "send",
1755-
channel: "telegram",
1757+
channel: TEST_MESSAGE_CHANNEL,
17561758
target: "chat123",
17571759
text: "done",
17581760
},
@@ -1792,7 +1794,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17921794
expect(result.messagingToolSentTargets).toEqual([
17931795
expect.objectContaining({
17941796
tool: "message",
1795-
provider: "telegram",
1797+
provider: TEST_MESSAGE_CHANNEL,
17961798
to: "chat123",
17971799
text: "done",
17981800
}),
@@ -1806,7 +1808,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
18061808
name: "mcp__openclaw__message",
18071809
input: {
18081810
action: "send",
1809-
channel: "telegram",
1811+
channel: TEST_MESSAGE_CHANNEL,
18101812
target: `chat${index}`,
18111813
message: "done",
18121814
},
@@ -1856,7 +1858,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
18561858
name: "mcp__openclaw__message",
18571859
input: {
18581860
action: "send",
1859-
channel: "telegram",
1861+
channel: TEST_MESSAGE_CHANNEL,
18601862
target: `chat${index}`,
18611863
message: "done",
18621864
},
@@ -1918,7 +1920,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
19181920
name: "mcp__openclaw__message",
19191921
input: {
19201922
action: "send",
1921-
channel: "telegram",
1923+
channel: TEST_MESSAGE_CHANNEL,
19221924
target: "chat123",
19231925
message: "done",
19241926
},
@@ -1965,7 +1967,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
19651967
name: "mcp__openclaw__message",
19661968
input: {
19671969
action: "send",
1968-
channel: "telegram",
1970+
channel: TEST_MESSAGE_CHANNEL,
19691971
target: "chat123",
19701972
message: "done",
19711973
dryRun: true,
@@ -2011,7 +2013,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
20112013
toolName: "message",
20122014
args: {
20132015
action: "send",
2014-
channel: "telegram",
2016+
channel: TEST_MESSAGE_CHANNEL,
20152017
target: "chat123",
20162018
message: "done",
20172019
},
@@ -2073,7 +2075,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
20732075
toolName: "message",
20742076
args: {
20752077
action: "edit",
2076-
channel: "telegram",
2078+
channel: TEST_MESSAGE_CHANNEL,
20772079
target: "chat123",
20782080
message: "done",
20792081
},
@@ -2103,7 +2105,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21032105
it("preserves the current provider for implicit message send targets", async () => {
21042106
const context = buildPreparedCliRunContext({ output: "text", provider: "google-gemini-cli" });
21052107
context.mcpDeliveryCapture = true;
2106-
context.params.messageChannel = "slack";
2108+
context.params.messageChannel = TEST_MESSAGE_CHANNEL;
21072109
context.params.currentChannelId = "C123";
21082110
context.params.currentThreadTs = "1700000000.000100";
21092111
supervisorSpawnMock.mockImplementationOnce(async (...args: unknown[]) => {
@@ -2136,7 +2138,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21362138

21372139
expect(result.messagingToolSentTargets).toEqual([
21382140
expect.objectContaining({
2139-
provider: "slack",
2141+
provider: TEST_MESSAGE_CHANNEL,
21402142
to: "C123",
21412143
}),
21422144
]);
@@ -2152,7 +2154,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21522154
toolName: "message",
21532155
args: {
21542156
action: "send",
2155-
channel: "telegram",
2157+
channel: TEST_MESSAGE_CHANNEL,
21562158
target: "chat123",
21572159
message: "done",
21582160
mediaUrl: "https://example.com/photo.png",
@@ -2180,7 +2182,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21802182
expect(result.messagingToolSentTargets).toEqual([
21812183
expect.objectContaining({
21822184
tool: "message",
2183-
provider: "telegram",
2185+
provider: TEST_MESSAGE_CHANNEL,
21842186
to: "chat123",
21852187
text: "done",
21862188
mediaUrls: ["https://example.com/photo.png"],
@@ -2198,7 +2200,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21982200
toolName: "message",
21992201
args: {
22002202
action: "send",
2201-
channel: "telegram",
2203+
channel: TEST_MESSAGE_CHANNEL,
22022204
target: "chat123",
22032205
message: "done",
22042206
},
@@ -2224,7 +2226,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22242226
expect(result.messagingToolSentTargets).toEqual([
22252227
expect.objectContaining({
22262228
tool: "message",
2227-
provider: "telegram",
2229+
provider: TEST_MESSAGE_CHANNEL,
22282230
to: "chat123",
22292231
text: "done",
22302232
}),
@@ -2241,7 +2243,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22412243
toolName: "message",
22422244
args: {
22432245
action: "poll",
2244-
channel: "telegram",
2246+
channel: TEST_MESSAGE_CHANNEL,
22452247
target: "chat123",
22462248
pollQuestion: "Lunch?",
22472249
pollOption: ["Pizza", "Sushi"],
@@ -2268,7 +2270,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22682270
expect(result.messagingToolSentTargets).toEqual([
22692271
expect.objectContaining({
22702272
tool: "message",
2271-
provider: "telegram",
2273+
provider: TEST_MESSAGE_CHANNEL,
22722274
to: "chat123",
22732275
}),
22742276
]);
@@ -2279,7 +2281,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22792281
action: "reply",
22802282
args: {
22812283
action: "reply",
2282-
channel: "telegram",
2284+
channel: TEST_MESSAGE_CHANNEL,
22832285
target: "chat123",
22842286
message: "done",
22852287
},
@@ -2288,7 +2290,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22882290
action: "sticker",
22892291
args: {
22902292
action: "sticker",
2291-
channel: "telegram",
2293+
channel: TEST_MESSAGE_CHANNEL,
22922294
target: "chat123",
22932295
stickerId: "sticker-1",
22942296
},
@@ -2326,7 +2328,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23262328
expect(result.messagingToolSentTargets).toEqual([
23272329
expect.objectContaining({
23282330
tool: "message",
2329-
provider: "telegram",
2331+
provider: TEST_MESSAGE_CHANNEL,
23302332
to: "chat123",
23312333
}),
23322334
]);
@@ -2342,7 +2344,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23422344
toolName: "message",
23432345
args: {
23442346
action: "thread-create",
2345-
channel: "telegram",
2347+
channel: TEST_MESSAGE_CHANNEL,
23462348
target: "chat123",
23472349
message: "new thread",
23482350
},
@@ -2368,7 +2370,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23682370
expect(result.messagingToolSentTargets).toEqual([
23692371
expect.objectContaining({
23702372
tool: "message",
2371-
provider: "telegram",
2373+
provider: TEST_MESSAGE_CHANNEL,
23722374
to: "chat123",
23732375
}),
23742376
]);
@@ -2377,7 +2379,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23772379
it("records current-target evidence for confirmed implicit reply delivery", async () => {
23782380
const context = buildPreparedCliRunContext({ output: "text", provider: "google-gemini-cli" });
23792381
context.mcpDeliveryCapture = true;
2380-
context.params.messageChannel = "telegram";
2382+
context.params.messageChannel = TEST_MESSAGE_CHANNEL;
23812383
context.params.currentChannelId = "chat123";
23822384
supervisorSpawnMock.mockImplementationOnce(async (...spawnArgs: unknown[]) => {
23832385
const input = spawnArgs[0] as SupervisorSpawnInput;
@@ -2410,7 +2412,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
24102412
expect(result.messagingToolSentTargets).toEqual([
24112413
expect.objectContaining({
24122414
tool: "message",
2413-
provider: "telegram",
2415+
provider: TEST_MESSAGE_CHANNEL,
24142416
to: "chat123",
24152417
}),
24162418
]);
@@ -2508,7 +2510,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
25082510
toolName: "message",
25092511
args: {
25102512
action: "send",
2511-
channel: "telegram",
2513+
channel: TEST_MESSAGE_CHANNEL,
25122514
target: "chat123",
25132515
message: "x".repeat(20 * 1024),
25142516
},
@@ -2532,7 +2534,11 @@ describe("executePreparedCliRun supervisor output capture", () => {
25322534

25332535
expect(result.didSendViaMessagingTool).toBe(true);
25342536
expect(result.messagingToolSentTargets).toEqual([
2535-
expect.objectContaining({ tool: "message", provider: "telegram", to: "chat123" }),
2537+
expect.objectContaining({
2538+
tool: "message",
2539+
provider: TEST_MESSAGE_CHANNEL,
2540+
to: "chat123",
2541+
}),
25362542
]);
25372543
});
25382544

@@ -2583,7 +2589,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
25832589
toolName: "message",
25842590
args: {
25852591
action: "send",
2586-
channel: "telegram",
2592+
channel: TEST_MESSAGE_CHANNEL,
25872593
target: "chat123",
25882594
message: "done",
25892595
},

‎src/agents/embedded-agent-runner/run.overflow-compaction.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { describe, expect, it, vi } from "vitest";
1+
import path from "node:path";
2+
import { afterEach, describe, expect, it, vi } from "vitest";
3+
import { useAutoCleanupTempDirTracker } from "../../../test/helpers/temp-dir.js";
24
import { OPENCLAW_EMBEDDED_CONTEXT_ENGINE_HOST } from "../../context-engine/host-compat.js";
35
import { buildContextEngineRuntimeSettings } from "../../context-engine/runtime-settings.js";
46
import type { ContextEngine } from "../../context-engine/types.js";
@@ -12,6 +14,8 @@ import { createEmbeddedRunContextRecoveryState } from "./run/context-recovery-st
1214
import type { PreparedEmbeddedRunInput } from "./run/execution-context.js";
1315
import type { EmbeddedRunAttemptResult } from "./run/types.js";
1416

17+
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
18+
1519
// Keep this dedicated leaf on the compaction composition boundary. Runtime/auth/lane policy is
1620
// covered at its direct owners so this shard never reloads the complete public runner graph.
1721
const baseRunParams = {
@@ -167,7 +171,10 @@ describe("createEmbeddedRunCompactionRuntime", () => {
167171
agentId: "main",
168172
sessionId: "session-1",
169173
sessionKey: "agent:main:session-1",
170-
storePath: "/tmp/openclaw.sqlite",
174+
storePath: path.join(
175+
tempDirs.make("openclaw-overflow-compaction-session-"),
176+
"openclaw.sqlite",
177+
),
171178
},
172179
adoptSessionId: vi.fn((sessionId?: string) => {
173180
if (sessionId) {

‎src/agents/embedded-agent-runner/run/attempt-transcript-lifecycle-prepare.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { describe, expect, it, vi } from "vitest";
1+
import path from "node:path";
2+
import { afterEach, describe, expect, it, vi } from "vitest";
3+
import { useAutoCleanupTempDirTracker } from "../../../../test/helpers/temp-dir.js";
24
import { prepareEmbeddedAttemptTranscriptLifecycle } from "./attempt-transcript-lifecycle-prepare.js";
35

6+
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
7+
48
describe("prepareEmbeddedAttemptTranscriptLifecycle", () => {
59
it("carries the admitted writer fence into nested transcript writes", async () => {
610
const externalAbortController = {
@@ -20,7 +24,10 @@ describe("prepareEmbeddedAttemptTranscriptLifecycle", () => {
2024
expectedWriterRunId: "run-a",
2125
sessionId: "session-a",
2226
sessionKey: "agent:main:test",
23-
storePath: "/tmp/openclaw.sqlite",
27+
storePath: path.join(
28+
tempDirs.make("openclaw-attempt-transcript-lifecycle-"),
29+
"openclaw.sqlite",
30+
),
2431
},
2532
},
2633
externalAbortController,

0 commit comments

Comments
 (0)