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

推荐订阅源

有赞技术团队
有赞技术团队
B
Blog
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
量子位
博客园 - 叶小钗
T
Tailwind CSS Blog
小众软件
小众软件
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
V
V2EX
博客园_首页
I
InfoQ
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure 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
fix(logging): keep log transport internals private (#7132...
vincentkoc · 2026-04-25 · via Recent Commits to openclaw:main

@@ -106,8 +106,8 @@ const installRunEmbeddedMocks = () => {

106106

};

107107108108

let runEmbeddedPiAgent: typeof import("./pi-embedded-runner/run.js").runEmbeddedPiAgent;

109-

let unregisterLogTransport: (() => void) | undefined;

110-

let registerLogTransportFn: typeof import("../logging/logger.js").registerLogTransport;

109+

let createDiagnosticLogRecordCaptureFn: typeof import("../logging/test-helpers/diagnostic-log-capture.js").createDiagnosticLogRecordCapture;

110+

let cleanupLogCapture: (() => void) | undefined;

111111

let resetLoggerFn: typeof import("../logging/logger.js").resetLogger;

112112

let setLoggerOverrideFn: typeof import("../logging/logger.js").setLoggerOverride;

113113

const originalFetch = globalThis.fetch;

@@ -116,11 +116,10 @@ beforeAll(async () => {

116116

vi.resetModules();

117117

installRunEmbeddedMocks();

118118

({ runEmbeddedPiAgent } = await import("./pi-embedded-runner/run.js"));

119-

({

120-

registerLogTransport: registerLogTransportFn,

121-

resetLogger: resetLoggerFn,

122-

setLoggerOverride: setLoggerOverrideFn,

123-

} = await import("../logging/logger.js"));

119+

({ createDiagnosticLogRecordCapture: createDiagnosticLogRecordCaptureFn } =

120+

await import("../logging/test-helpers/diagnostic-log-capture.js"));

121+

({ resetLogger: resetLoggerFn, setLoggerOverride: setLoggerOverrideFn } =

122+

await import("../logging/logger.js"));

124123

});

125124126125

async function runEmbeddedPiAgentInline(

@@ -152,8 +151,8 @@ beforeEach(() => {

152151153152

afterEach(() => {

154153

globalThis.fetch = originalFetch;

155-

unregisterLogTransport?.();

156-

unregisterLogTransport = undefined;

154+

cleanupLogCapture?.();

155+

cleanupLogCapture = undefined;

157156

setLoggerOverrideFn(null);

158157

resetLoggerFn();

159158

});

@@ -864,34 +863,31 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {

864863

});

865864866865

it("logs structured failover decision metadata for overloaded assistant rotation", async () => {

867-

const records: Array<Record<string, unknown>> = [];

866+

const logCapture = createDiagnosticLogRecordCaptureFn();

867+

cleanupLogCapture = logCapture.cleanup;

868868

setLoggerOverrideFn({

869869

level: "trace",

870870

consoleLevel: "silent",

871871

file: path.join(os.tmpdir(), `openclaw-auth-rotation-${Date.now()}.log`),

872872

});

873-

unregisterLogTransport = registerLogTransportFn((record) => {

874-

records.push(record);

875-

});

876873877874

await runAutoPinnedRotationCase({

878875

errorMessage:

879876

'{"type":"error","error":{"type":"overloaded_error","message":"Overloaded"},"request_id":"req_overload"}',

880877

sessionKey: "agent:test:overloaded-logging",

881878

runId: "run:overloaded-logging",

882879

});

880+

await logCapture.flush();

883881884-

const decisionRecord = records.find(

882+

const decisionRecord = logCapture.records.find(

885883

(record) =>

886-

record["2"] === "embedded run failover decision" &&

887-

record["1"] &&

888-

typeof record["1"] === "object" &&

889-

(record["1"] as Record<string, unknown>).decision === "rotate_profile",

884+

record.message === "embedded run failover decision" &&

885+

record.attributes?.decision === "rotate_profile",

890886

);

891887892888

expect(decisionRecord).toBeDefined();

893889

const safeProfileId = redactIdentifier("openai:p1", { len: 12 });

894-

expect((decisionRecord as Record<string, unknown>)["1"]).toMatchObject({

890+

expect(decisionRecord?.attributes).toMatchObject({

895891

event: "embedded_run_failover_decision",

896892

runId: "run:overloaded-logging",

897893

decision: "rotate_profile",

@@ -903,16 +899,14 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {

903899

rawErrorPreview: expect.stringContaining('"request_id":"sha256:'),

904900

});

905901906-

const stateRecord = records.find(

902+

const stateRecord = logCapture.records.find(

907903

(record) =>

908-

record["2"] === "auth profile failure state updated" &&

909-

record["1"] &&

910-

typeof record["1"] === "object" &&

911-

(record["1"] as Record<string, unknown>).profileId === safeProfileId,

904+

record.message === "auth profile failure state updated" &&

905+

record.attributes?.profileId === safeProfileId,

912906

);

913907914908

expect(stateRecord).toBeDefined();

915-

expect((stateRecord as Record<string, unknown>)["1"]).toMatchObject({

909+

expect(stateRecord?.attributes).toMatchObject({

916910

event: "auth_profile_failure_state_updated",

917911

runId: "run:overloaded-logging",

918912

profileId: safeProfileId,