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

推荐订阅源

月光博客
月光博客
D
Docker
腾讯CDC
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
IT之家
IT之家
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 【当耐特】

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: localize logger env overrides · openclaw/openclaw@9...
shakkernerd · 2026-06-05 · via Recent Commits to openclaw:main

@@ -8,6 +8,7 @@ import {

88

runWithDiagnosticTraceContext,

99

} from "../infra/diagnostic-trace-context.js";

1010

import { getChildLogger, getLogger, resetLogger, setLoggerOverride } from "../logging.js";

11+

import { withEnv } from "../test-utils/env.js";

1112

import { createSuiteLogPathTracker } from "./log-test-helpers.js";

1213

import { testApi as loggerTest } from "./logger.js";

1314

import { createDiagnosticLogRecordCapture } from "./test-helpers/diagnostic-log-capture.js";

@@ -16,9 +17,6 @@ const secret = "sk-testsecret1234567890abcd";

1617

const TRACE_ID = "4bf92f3577b34da6a3ce929d0e0e4736";

1718

const SPAN_ID = "00f067aa0ba902b7";

1819

const logPathTracker = createSuiteLogPathTracker("openclaw-log-redaction-");

19-

const originalConfigPath = process.env.OPENCLAW_CONFIG_PATH;

20-

const originalHome = process.env.HOME;

21-

const originalTestFileLog = process.env.OPENCLAW_TEST_FILE_LOG;

22202321

beforeAll(async () => {

2422

await logPathTracker.setup();

@@ -29,21 +27,6 @@ beforeEach(() => {

2927

});

30283129

afterEach(() => {

32-

if (originalConfigPath === undefined) {

33-

delete process.env.OPENCLAW_CONFIG_PATH;

34-

} else {

35-

process.env.OPENCLAW_CONFIG_PATH = originalConfigPath;

36-

}

37-

if (originalHome === undefined) {

38-

delete process.env.HOME;

39-

} else {

40-

process.env.HOME = originalHome;

41-

}

42-

if (originalTestFileLog === undefined) {

43-

delete process.env.OPENCLAW_TEST_FILE_LOG;

44-

} else {

45-

process.env.OPENCLAW_TEST_FILE_LOG = originalTestFileLog;

46-

}

4730

resetDiagnosticEventsForTest();

4831

resetDiagnosticTraceContextForTest();

4932

resetLogger();

@@ -113,14 +96,15 @@ describe("file log redaction", () => {

11396

},

11497

}),

11598

);

116-

process.env.OPENCLAW_CONFIG_PATH = configPath;

117-

setLoggerOverride({ level: "info", file: logPath });

118-119-

getLogger().info({

120-

token: "token-value-1234567890",

121-

access: "ya29.fake-access-token-with-enough-length",

122-

password: "abcd-efgh-ijkl-mnop",

123-

message: `Authorization: Bearer ${secret}`,

99+

withEnv({ OPENCLAW_CONFIG_PATH: configPath }, () => {

100+

setLoggerOverride({ level: "info", file: logPath });

101+102+

getLogger().info({

103+

token: "token-value-1234567890",

104+

access: "ya29.fake-access-token-with-enough-length",

105+

password: "abcd-efgh-ijkl-mnop",

106+

message: `Authorization: Bearer ${secret}`,

107+

});

124108

});

125109126110

const content = fs.readFileSync(logPath, "utf8");

@@ -142,22 +126,22 @@ describe("file log redaction", () => {

142126

},

143127

}),

144128

);

145-

process.env.OPENCLAW_CONFIG_PATH = configPath;

146-

process.env.OPENCLAW_TEST_FILE_LOG = "1";

147-148-

getLogger().info({ message: "configured log path works" });

129+

withEnv({ OPENCLAW_CONFIG_PATH: configPath, OPENCLAW_TEST_FILE_LOG: "1" }, () => {

130+

getLogger().info({ message: "configured log path works" });

131+

});

149132150133

const content = fs.readFileSync(logPath, "utf8");

151134

expect(content).toContain("configured log path works");

152135

});

153136154137

it("expands leading tilde in logging.file", () => {

155138

const home = path.join(path.dirname(logPathTracker.nextPath()), "home");

156-

process.env.HOME = home;

157139158-

expect(loggerTest.resolveActiveLogFile("~/custom-openclaw.log")).toBe(

159-

path.join(home, "custom-openclaw.log"),

160-

);

140+

withEnv({ HOME: home }, () => {

141+

expect(loggerTest.resolveActiveLogFile("~/custom-openclaw.log")).toBe(

142+

path.join(home, "custom-openclaw.log"),

143+

);

144+

});

161145

});

162146163147

it("writes trace context as top-level JSONL fields", () => {