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

推荐订阅源

F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
罗磊的独立博客
爱范儿
爱范儿
J
Java Code Geeks
博客园 - 司徒正美
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
美团技术团队
小众软件
小众软件
Google DeepMind News
Google DeepMind News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
V2EX
博客园 - 聂微东
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Jina AI
Jina AI
Y
Y Combinator Blog
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
Vercel News
Vercel News

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(plugins): serialize binding approval saves (#88945) ·...
Alix-007 · 2026-06-16 · via Recent Commits to openclaw:main

@@ -93,6 +93,17 @@ const pluginRuntimeState = vi.hoisted(

9393

}) satisfies { registry: PluginRegistry },

9494

);

959596+

const jsonFileMockState = vi.hoisted(() => ({

97+

writeJsonOverride: null as

98+

| null

99+

| ((

100+

actualWriteJson: (filePath: string, value: unknown, options?: unknown) => Promise<void>,

101+

filePath: string,

102+

value: unknown,

103+

options?: unknown,

104+

) => Promise<void>),

105+

}));

106+96107

vi.mock("../infra/home-dir.js", async () => {

97108

const actual =

98109

await vi.importActual<typeof import("../infra/home-dir.js")>("../infra/home-dir.js");

@@ -107,6 +118,33 @@ vi.mock("../infra/home-dir.js", async () => {

107118

};

108119

});

109120121+

vi.mock("../infra/json-files.js", async () => {

122+

const actual =

123+

await vi.importActual<typeof import("../infra/json-files.js")>("../infra/json-files.js");

124+

return {

125+

...actual,

126+

writeJson: async (

127+

filePath: string,

128+

value: unknown,

129+

options?: Parameters<typeof actual.writeJson>[2],

130+

) => {

131+

if (jsonFileMockState.writeJsonOverride) {

132+

return await jsonFileMockState.writeJsonOverride(

133+

actual.writeJson as (

134+

filePath: string,

135+

value: unknown,

136+

options?: unknown,

137+

) => Promise<void>,

138+

filePath,

139+

value,

140+

options,

141+

);

142+

}

143+

return await actual.writeJson(filePath, value, options);

144+

},

145+

};

146+

});

147+110148

vi.mock("./runtime.js", async () => {

111149

const actual = await vi.importActual<typeof import("./runtime.js")>("./runtime.js");

112150

return {

@@ -485,6 +523,86 @@ describe("plugin conversation binding approvals", () => {

485523

expect(differentAccount.status).toBe("pending");

486524

});

487525526+

it("serializes overlapping always-allow approval writes", async () => {

527+

const firstWriteGate = createDeferredVoid();

528+

const firstWriteStarted = createDeferredVoid();

529+

let writeCount = 0;

530+

jsonFileMockState.writeJsonOverride = async (actualWriteJson, filePath, value, options) => {

531+

writeCount += 1;

532+

if (writeCount === 1) {

533+

firstWriteStarted.resolve();

534+

await firstWriteGate.promise;

535+

}

536+

await actualWriteJson(filePath, value, options);

537+

};

538+539+

try {

540+

const firstRequest = await requestPendingBinding(

541+

createDiscordCodexBindRequest(

542+

"channel:race-1",

543+

"Bind this conversation to Codex thread race-1.",

544+

"default",

545+

),

546+

);

547+

const firstApproval = resolvePluginConversationBindingApproval({

548+

approvalId: firstRequest.approvalId,

549+

decision: "allow-always",

550+

senderId: "user-1",

551+

});

552+

await firstWriteStarted.promise;

553+554+

const secondRequest = await requestPendingBinding(

555+

createDiscordCodexBindRequest(

556+

"channel:race-2",

557+

"Bind this conversation to Codex thread race-2.",

558+

"work",

559+

),

560+

);

561+

let secondSettled = false;

562+

const secondApproval = resolvePluginConversationBindingApproval({

563+

approvalId: secondRequest.approvalId,

564+

decision: "allow-always",

565+

senderId: "user-1",

566+

}).then((result) => {

567+

secondSettled = true;

568+

return result;

569+

});

570+571+

await flushMicrotasks();

572+

expect(secondSettled).toBe(false);

573+

expect(writeCount).toBe(1);

574+575+

firstWriteGate.resolve();

576+

const [firstResult, secondResult] = await Promise.all([firstApproval, secondApproval]);

577+578+

expect(firstResult.status).toBe("approved");

579+

expect(secondResult.status).toBe("approved");

580+

expect(writeCount).toBe(2);

581+582+

const persisted = JSON.parse(fs.readFileSync(approvalsPath, "utf8")) as {

583+

approvals: Array<{ accountId: string; channel: string; pluginRoot: string }>;

584+

};

585+

expect(persisted.approvals).toEqual(

586+

expect.arrayContaining([

587+

expect.objectContaining({

588+

accountId: "default",

589+

channel: "discord",

590+

pluginRoot: "/plugins/codex-a",

591+

}),

592+

expect.objectContaining({

593+

accountId: "work",

594+

channel: "discord",

595+

pluginRoot: "/plugins/codex-a",

596+

}),

597+

]),

598+

);

599+

expect(persisted.approvals).toHaveLength(2);

600+

} finally {

601+

firstWriteGate.resolve();

602+

jsonFileMockState.writeJsonOverride = null;

603+

}

604+

});

605+488606

it("shares pending bind approvals across duplicate module instances", async () => {

489607

const { first, second } = await importDuplicateConversationBindingModules();

490608

const request = await requestPendingBinding(