





















@@ -1,3 +1,5 @@
1+import os from "node:os";
2+import path from "node:path";
13import { beforeEach, describe, expect, it } from "vitest";
24import {
35addSubagentRunForTests,
@@ -9,7 +11,25 @@ import { failTaskRunByRunId } from "../../tasks/task-executor.js";
911import { createTaskRecord, resetTaskRegistryForTests } from "../../tasks/task-registry.js";
1012import type { ReplyPayload } from "../types.js";
1113import { handleSubagentsInfoAction } from "./commands-subagents/action-info.js";
12-import { baseCommandTestConfig } from "./commands.test-harness.js";
14+import {
15+baseCommandTestConfig,
16+configureInMemoryTaskRegistryStoreForTests,
17+} from "./commands.test-harness.js";
18+19+const TEST_SESSION_STORE_PATH = path.join(
20+os.tmpdir(),
21+`openclaw-commands-subagents-info-${process.pid}.json`,
22+);
23+24+function buildCommandTestConfig(): OpenClawConfig {
25+return {
26+ ...baseCommandTestConfig,
27+session: {
28+ ...baseCommandTestConfig.session,
29+store: TEST_SESSION_STORE_PATH,
30+},
31+};
32+}
13331434function buildInfoContext(params: { cfg: OpenClawConfig; runs: object[]; restTokens: string[] }) {
1535return {
@@ -30,7 +50,8 @@ function requireReplyText(reply: ReplyPayload | undefined): string {
3050}
31513252beforeEach(() => {
33-resetTaskRegistryForTests();
53+resetTaskRegistryForTests({ persist: false });
54+configureInMemoryTaskRegistryStoreForTests();
3455resetSubagentRegistryForTests();
3556});
3657@@ -72,7 +93,7 @@ describe("subagents info", () => {
7293terminalSummary: "Completed the requested task",
7394deliveryStatus: "delivered",
7495});
75-const cfg = baseCommandTestConfig;
96+const cfg = buildCommandTestConfig();
7697const result = handleSubagentsInfoAction(
7798buildInfoContext({ cfg, runs: [run], restTokens: ["1"] }),
7899);
@@ -132,7 +153,7 @@ describe("subagents info", () => {
132153].join("\n"),
133154terminalSummary: "Needs manual follow-up.",
134155});
135-const cfg = baseCommandTestConfig;
156+const cfg = buildCommandTestConfig();
136157const result = handleSubagentsInfoAction(
137158buildInfoContext({ cfg, runs: [run], restTokens: ["1"] }),
138159);
@@ -176,7 +197,7 @@ describe("subagents info", () => {
176197const cfg = {
177198commands: { text: true },
178199channels: { quietchat: { allowFrom: ["*"] } },
179-session: { mainKey: "main", scope: "per-sender" },
200+session: { mainKey: "main", scope: "per-sender", store: TEST_SESSION_STORE_PATH },
180201} as OpenClawConfig;
181202const result = handleSubagentsInfoAction({
182203params: {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。