fix: restore acp task env scope · openclaw/openclaw@b8ed2c3
shakkernerd
·
2026-06-15
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,6 +3,7 @@ import { resetTaskFlowRegistryForTests } from "../../src/tasks/task-flow-registr
|
3 | 3 | import { configureTaskFlowRegistryRuntime } from "../../src/tasks/task-flow-registry.store.js"; |
4 | 4 | import { findTaskByRunId, resetTaskRegistryForTests } from "../../src/tasks/task-registry.js"; |
5 | 5 | import { withTempDir } from "../../src/test-helpers/temp-dir.js"; |
| 6 | +import { captureEnv, setTestEnvValue } from "../../src/test-utils/env.js"; |
6 | 7 | import { installInMemoryTaskRegistryRuntime } from "../../src/test-utils/task-registry-runtime.js"; |
7 | 8 | |
8 | 9 | // Shared ACP manager task registry setup for tests. |
@@ -20,7 +21,8 @@ export async function withAcpManagerTaskStateDir(
|
20 | 21 | run: (root: string) => Promise<void>, |
21 | 22 | ): Promise<void> { |
22 | 23 | await withTempDir({ prefix: "openclaw-acp-manager-task-" }, async (root) => { |
23 | | -process.env.OPENCLAW_STATE_DIR = root; |
| 24 | +const envSnapshot = captureEnv(["OPENCLAW_STATE_DIR"]); |
| 25 | +setTestEnvValue("OPENCLAW_STATE_DIR", root); |
24 | 26 | resetAcpManagerTaskStateForTests(); |
25 | 27 | installInMemoryTaskRegistryRuntime(); |
26 | 28 | configureTaskFlowRegistryRuntime({ |
@@ -38,6 +40,7 @@ export async function withAcpManagerTaskStateDir(
|
38 | 40 | await run(root); |
39 | 41 | } finally { |
40 | 42 | resetAcpManagerTaskStateForTests(); |
| 43 | +envSnapshot.restore(); |
41 | 44 | } |
42 | 45 | }); |
43 | 46 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。