惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Help Net Security
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
The Cloudflare Blog
I
InfoQ
美团技术团队
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
L
LangChain Blog
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: route config guard home env · openclaw/openclaw@5fd...
shakkernerd · 2026-06-20 · via Recent Commits to openclaw:main

@@ -4,6 +4,7 @@ import os from "node:os";

44

import path from "node:path";

55

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

66

import { note } from "../../../packages/terminal-core/src/note.js";

7+

import { captureEnv, deleteTestEnvValue, setTestEnvValue } from "../../test-utils/env.js";

78

import { formatCliCommand } from "../command-format.js";

89

import { ensureConfigReady, testApi } from "./config-guard.js";

910

@@ -72,10 +73,8 @@ async function withCapturedStdout(run: () => Promise<void>): Promise<string> {

72737374

describe("ensureConfigReady", () => {

7475

const resetConfigGuardStateForTests = testApi.resetConfigGuardStateForTests;

75-

const originalHome = process.env.HOME;

76-

const originalOpenClawHome = process.env.OPENCLAW_HOME;

77-

const originalOpenClawStateDir = process.env.OPENCLAW_STATE_DIR;

7876

const tempRoots: string[] = [];

77+

let envSnapshot: ReturnType<typeof captureEnv> | undefined;

79788079

async function runEnsureConfigReady(commandPath: string[], suppressDoctorStdout = false) {

8180

const runtime = makeRuntime();

@@ -101,8 +100,8 @@ describe("ensureConfigReady", () => {

101100

function useTempOpenClawHome(): string {

102101

const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-config-guard-"));

103102

tempRoots.push(root);

104-

process.env.OPENCLAW_HOME = root;

105-

delete process.env.OPENCLAW_STATE_DIR;

103+

setTestEnvValue("OPENCLAW_HOME", root);

104+

deleteTestEnvValue("OPENCLAW_STATE_DIR");

106105

return root;

107106

}

108107

@@ -126,13 +125,9 @@ describe("ensureConfigReady", () => {

126125

}

127126128127

beforeEach(() => {

128+

envSnapshot = captureEnv(["HOME", "OPENCLAW_HOME", "OPENCLAW_STATE_DIR"]);

129129

vi.clearAllMocks();

130130

resetConfigGuardStateForTests();

131-

if (originalHome === undefined) {

132-

delete process.env.HOME;

133-

} else {

134-

process.env.HOME = originalHome;

135-

}

136131

for (const root of tempRoots.splice(0)) {

137132

fs.rmSync(root, { recursive: true, force: true });

138133

}

@@ -145,21 +140,8 @@ describe("ensureConfigReady", () => {

145140

});

146141147142

afterEach(() => {

148-

if (originalHome === undefined) {

149-

delete process.env.HOME;

150-

} else {

151-

process.env.HOME = originalHome;

152-

}

153-

if (originalOpenClawHome === undefined) {

154-

delete process.env.OPENCLAW_HOME;

155-

} else {

156-

process.env.OPENCLAW_HOME = originalOpenClawHome;

157-

}

158-

if (originalOpenClawStateDir === undefined) {

159-

delete process.env.OPENCLAW_STATE_DIR;

160-

} else {

161-

process.env.OPENCLAW_STATE_DIR = originalOpenClawStateDir;

162-

}

143+

envSnapshot?.restore();

144+

envSnapshot = undefined;

163145

for (const root of tempRoots.splice(0)) {

164146

fs.rmSync(root, { recursive: true, force: true });

165147

}

@@ -250,7 +232,7 @@ describe("ensureConfigReady", () => {

250232

it("runs doctor flow before agent commands when default exec approvals must move to a custom state dir", async () => {

251233

const root = useTempOpenClawHome();

252234

const stateDir = path.join(root, "custom-state");

253-

process.env.OPENCLAW_STATE_DIR = stateDir;

235+

setTestEnvValue("OPENCLAW_STATE_DIR", stateDir);

254236

writeStateMarker(root, "exec-approvals.json");

255237256238

await runEnsureConfigReady(["agent"]);

@@ -288,9 +270,9 @@ describe("ensureConfigReady", () => {

288270

it("uses shared tilde expansion for OPENCLAW_HOME in the startup detector", async () => {

289271

const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-config-guard-home-"));

290272

tempRoots.push(root);

291-

process.env.HOME = root;

292-

process.env.OPENCLAW_HOME = "~/svc";

293-

delete process.env.OPENCLAW_STATE_DIR;

273+

setTestEnvValue("HOME", root);

274+

setTestEnvValue("OPENCLAW_HOME", "~/svc");

275+

deleteTestEnvValue("OPENCLAW_STATE_DIR");

294276

writeLegacyTaskSidecarMarker(path.join(root, "svc"));

295277296278

await runEnsureConfigReady(["status"]);