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

推荐订阅源

J
Java Code Geeks
腾讯CDC
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
L
LangChain Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
IT之家
IT之家
A
About on SuperTechFans
H
Help Net Security

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(auth): avoid structuredClone for auth profile stores ...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -0,0 +1,80 @@

1+

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

2+

import {

3+

clearRuntimeAuthProfileStoreSnapshots,

4+

getRuntimeAuthProfileStoreSnapshot,

5+

replaceRuntimeAuthProfileStoreSnapshots,

6+

setRuntimeAuthProfileStoreSnapshot,

7+

} from "./runtime-snapshots.js";

8+

import type { AuthProfileStore } from "./types.js";

9+10+

function createStore(access: string): AuthProfileStore {

11+

return {

12+

version: 1,

13+

profiles: {

14+

"openai-codex:default": {

15+

type: "oauth",

16+

provider: "openai-codex",

17+

access,

18+

refresh: `refresh-${access}`,

19+

expires: Date.now() + 60_000,

20+

accountId: "acct-1",

21+

},

22+

},

23+

order: {

24+

"openai-codex": ["openai-codex:default"],

25+

},

26+

usageStats: {

27+

"openai-codex:default": {

28+

lastUsed: 1,

29+

},

30+

},

31+

};

32+

}

33+34+

describe("runtime auth profile snapshots", () => {

35+

it("isolates set/get/replace snapshot mutations without structuredClone", () => {

36+

const structuredCloneSpy = vi.spyOn(globalThis, "structuredClone");

37+

const agentDir = "/tmp/openclaw-auth-runtime-snapshot-agent";

38+

try {

39+

const stored = createStore("access-1");

40+

setRuntimeAuthProfileStoreSnapshot(stored, agentDir);

41+

stored.profiles["openai-codex:default"].provider = "mutated";

42+

stored.order!["openai-codex"].push("mutated");

43+44+

const first = getRuntimeAuthProfileStoreSnapshot(agentDir);

45+

expect(first?.profiles["openai-codex:default"]).toMatchObject({

46+

provider: "openai-codex",

47+

access: "access-1",

48+

});

49+

expect(first?.order?.["openai-codex"]).toEqual(["openai-codex:default"]);

50+51+

first!.profiles["openai-codex:default"].provider = "mutated-again";

52+

first!.usageStats!["openai-codex:default"].lastUsed = 99;

53+54+

const second = getRuntimeAuthProfileStoreSnapshot(agentDir);

55+

expect(second?.profiles["openai-codex:default"]).toMatchObject({

56+

provider: "openai-codex",

57+

access: "access-1",

58+

});

59+

expect(second?.usageStats?.["openai-codex:default"]?.lastUsed).toBe(1);

60+61+

const replacement = createStore("access-2");

62+

replaceRuntimeAuthProfileStoreSnapshots([{ agentDir, store: replacement }]);

63+

const replacementCredential = replacement.profiles["openai-codex:default"];

64+

expect(replacementCredential?.type).toBe("oauth");

65+

if (replacementCredential?.type === "oauth") {

66+

replacementCredential.access = "mutated-replacement";

67+

}

68+69+

const replaced = getRuntimeAuthProfileStoreSnapshot(agentDir);

70+

expect(replaced?.profiles["openai-codex:default"]).toMatchObject({

71+

access: "access-2",

72+

refresh: "refresh-access-2",

73+

});

74+

expect(structuredCloneSpy).not.toHaveBeenCalled();

75+

} finally {

76+

structuredCloneSpy.mockRestore();

77+

clearRuntimeAuthProfileStoreSnapshots();

78+

}

79+

});

80+

});