diff --git a/src/gateway/gateway-cli-backend.live.test.ts b/src/gateway/gateway-cli-backend.live.test.ts index d1cb3eb1b9f7..b9639db67b50 100644 --- a/src/gateway/gateway-cli-backend.live.test.ts +++ b/src/gateway/gateway-cli-backend.live.test.ts @@ -10,6 +10,7 @@ import { shouldSkipLiveProviderDrift } from "../agents/live-test-provider-drift. import { parseModelRef } from "../agents/model-selection.js"; import { clearRuntimeConfigSnapshot, type OpenClawConfig } from "../config/config.js"; import { isTruthyEnvValue } from "../infra/env.js"; +import { setTestEnvValue } from "../test-utils/env.js"; import { applyCliBackendLiveEnv, createBootstrapWorkspace, @@ -285,7 +286,7 @@ describeLive("gateway live (cli backend)", () => { applyCliBackendLiveEnv(preservedEnv); const token = `test-${randomUUID()}`; - process.env.OPENCLAW_GATEWAY_TOKEN = token; + setTestEnvValue("OPENCLAW_GATEWAY_TOKEN", token); const port = await getFreeGatewayPort(); logCliBackendLiveStep("env-ready", { port }); @@ -369,7 +370,7 @@ describeLive("gateway live (cli backend)", () => { ? await createMcpSchemaProbePlugin(tempDir) : undefined; const useMinimalToolsProfile = providerId === "codex-cli" && !schemaProbePluginPath; - process.env.OPENCLAW_STATE_DIR = stateDir; + setTestEnvValue("OPENCLAW_STATE_DIR", stateDir); const bundleMcp = backendResolved?.bundleMcp === true; const bootstrapWorkspace = await createBootstrapWorkspace(tempDir); const disableMcpConfig = process.env.OPENCLAW_LIVE_CLI_BACKEND_DISABLE_MCP_CONFIG !== "0"; @@ -473,7 +474,7 @@ describeLive("gateway live (cli backend)", () => { }; const tempConfigPath = path.join(tempDir, "openclaw.json"); await fs.writeFile(tempConfigPath, `${JSON.stringify(nextCfg, null, 2)}\n`); - process.env.OPENCLAW_CONFIG_PATH = tempConfigPath; + setTestEnvValue("OPENCLAW_CONFIG_PATH", tempConfigPath); const deviceIdentity = await ensurePairedTestGatewayClientIdentity(); let server: Awaited> | undefined; let client: Awaited> | undefined;