


























@@ -59,6 +59,7 @@ import type { ProviderThinkingModelCompat } from "../plugins/provider-thinking.t
5959import { DEFAULT_AGENT_ID } from "../routing/session-key.js";
6060import { stripAssistantInternalScaffolding } from "../shared/text/assistant-visible-text.js";
6161import { findFinalTagMatches, stripFinalTags } from "../shared/text/final-tags.js";
62+import { deleteTestEnvValue, setTestEnvValue } from "../test-utils/env.js";
6263import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
6364import { GatewayClient } from "./client.js";
6465import {
@@ -570,9 +571,9 @@ function restoreProductionEnvForLiveRun(previous: {
570571571572function restoreOptionalEnv(key: string, value: string | undefined): void {
572573if (value === undefined) {
573-delete process.env[key];
574+deleteTestEnvValue(key);
574575} else {
575-process.env[key] = value;
576+setTestEnvValue(key, value);
576577}
577578}
578579@@ -1083,9 +1084,9 @@ describe("resolveGatewayLiveMaxModels", () => {
10831084const originalSharedMax = process.env.OPENCLAW_LIVE_MAX_MODELS;
10841085function restoreEnvValue(name: string, value: string | undefined): void {
10851086if (value === undefined) {
1086-delete process.env[name];
1087+deleteTestEnvValue(name);
10871088} else {
1088-process.env[name] = value;
1089+setTestEnvValue(name, value);
10891090}
10901091}
10911092@@ -2881,7 +2882,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
28812882const tempStateDir: string | undefined = await fs.mkdtemp(
28822883path.join(os.tmpdir(), "openclaw-live-state-"),
28832884);
2884-process.env.OPENCLAW_STATE_DIR = tempStateDir;
2885+setTestEnvValue("OPENCLAW_STATE_DIR", tempStateDir);
28852886const tempAgentDir: string | undefined = path.join(
28862887tempStateDir,
28872888"agents",
@@ -2893,7 +2894,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
28932894if (tempSessionAgentDir !== tempAgentDir) {
28942895saveAuthProfileStore(sanitizedStore, tempSessionAgentDir);
28952896}
2896-process.env.OPENCLAW_AGENT_DIR = tempAgentDir;
2897+setTestEnvValue("OPENCLAW_AGENT_DIR", tempAgentDir);
2897289828982899const workspaceDir = resolveAgentWorkspaceDir(params.cfg, agentId);
28992900await fs.mkdir(workspaceDir, { recursive: true });
@@ -2928,7 +2929,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
29282929const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-live-"));
29292930const tempConfigPath = path.join(tempDir, "openclaw.json");
29302931await fs.writeFile(tempConfigPath, `${JSON.stringify(nextCfg, null, 2)}\n`);
2931-process.env.OPENCLAW_CONFIG_PATH = tempConfigPath;
2932+setTestEnvValue("OPENCLAW_CONFIG_PATH", tempConfigPath);
2932293329332934const liveProviders = nextCfg.models?.providers;
29342935if (liveProviders && Object.keys(liveProviders).length > 0) {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。