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

推荐订阅源

美团技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Martin Fowler
Martin Fowler
雷峰网
雷峰网
IT之家
IT之家
小众软件
小众软件
M
MIT News - Artificial intelligence
博客园 - 聂微东
J
Java Code Geeks
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
C
Check Point Blog
云风的 BLOG
云风的 BLOG
腾讯CDC
H
Help Net Security
Y
Y Combinator Blog
I
InfoQ

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(infra): share diagnostic event state across loaders ·...
steipete · 2026-04-26 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -147,7 +147,24 @@ describe("diagnostic-events", () => {

147147

]);

148148

});

149149
150-

it("does not expose mutable diagnostic state on a global symbol", async () => {

150+

it("shares diagnostic state across duplicate module instances", async () => {

151+

const events: string[] = [];

152+

onDiagnosticEvent((event) => {

153+

events.push(event.type);

154+

});

155+
156+

vi.resetModules();

157+

const specifier = "./diagnostic-events.js";

158+

const duplicateModule = (await import(specifier)) as typeof import("./diagnostic-events.js");

159+

duplicateModule.emitDiagnosticEvent({

160+

type: "message.queued",

161+

source: "plugin",

162+

});

163+
164+

expect(events).toEqual(["message.queued"]);

165+

});

166+
167+

it("does not expose mutable diagnostic state on the obsolete global symbol", async () => {

151168

const globalStore = globalThis as Record<PropertyKey, unknown>;

152169

const events: boolean[] = [];

153170

globalStore[Symbol.for("openclaw.diagnosticEventsState")] = {

Original file line numberDiff line numberDiff line change

@@ -404,14 +404,49 @@ const ASYNC_DIAGNOSTIC_EVENT_TYPES = new Set<DiagnosticEventPayload["type"]>([

404404

"log.record",

405405

]);

406406
407-

const diagnosticEventsState: DiagnosticEventsGlobalState = {

408-

enabled: true,

409-

seq: 0,

410-

listeners: new Set<DiagnosticEventListener>(),

411-

dispatchDepth: 0,

412-

asyncQueue: [],

413-

asyncDrainScheduled: false,

414-

};

407+

const DIAGNOSTIC_EVENTS_STATE_KEY = Symbol.for("openclaw.diagnosticEvents.state.v1");

408+
409+

function createDiagnosticEventsState(): DiagnosticEventsGlobalState {

410+

return {

411+

enabled: true,

412+

seq: 0,

413+

listeners: new Set<DiagnosticEventListener>(),

414+

dispatchDepth: 0,

415+

asyncQueue: [],

416+

asyncDrainScheduled: false,

417+

};

418+

}

419+
420+

function isDiagnosticEventsState(value: unknown): value is DiagnosticEventsGlobalState {

421+

if (!value || typeof value !== "object") {

422+

return false;

423+

}

424+

const candidate = value as Partial<DiagnosticEventsGlobalState>;

425+

return (

426+

typeof candidate.enabled === "boolean" &&

427+

typeof candidate.seq === "number" &&

428+

candidate.listeners instanceof Set &&

429+

typeof candidate.dispatchDepth === "number" &&

430+

Array.isArray(candidate.asyncQueue) &&

431+

typeof candidate.asyncDrainScheduled === "boolean"

432+

);

433+

}

434+
435+

const diagnosticEventsState: DiagnosticEventsGlobalState = (() => {

436+

const globalStore = globalThis as Record<PropertyKey, unknown>;

437+

const existing = globalStore[DIAGNOSTIC_EVENTS_STATE_KEY];

438+

if (isDiagnosticEventsState(existing)) {

439+

return existing;

440+

}

441+

const created = createDiagnosticEventsState();

442+

Object.defineProperty(globalStore, DIAGNOSTIC_EVENTS_STATE_KEY, {

443+

configurable: true,

444+

enumerable: false,

445+

value: created,

446+

writable: false,

447+

});

448+

return created;

449+

})();

415450
416451

function getDiagnosticEventsState(): DiagnosticEventsGlobalState {

417452

return diagnosticEventsState;