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

推荐订阅源

雷峰网
雷峰网
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
L
LangChain Blog
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
量子位
The GitHub Blog
The GitHub 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(auth): lock cli provider auth writes · openclaw/openc...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -46,6 +46,7 @@ const mocks = vi.hoisted(() => ({

4646

resolveAgentWorkspaceDir: vi.fn(),

4747

resolveDefaultAgentWorkspaceDir: vi.fn(),

4848

upsertAuthProfile: vi.fn(),

49+

upsertAuthProfileWithLock: vi.fn(),

4950

resolvePluginProviders: vi.fn(),

5051

createClackPrompter: vi.fn(),

5152

loadValidConfigOrThrow: vi.fn(),

@@ -65,6 +66,7 @@ vi.mock("../../agents/auth-profiles/profiles.js", () => ({

6566

listProfilesForProvider: mocks.listProfilesForProvider,

6667

promoteAuthProfileInOrder: mocks.promoteAuthProfileInOrder,

6768

upsertAuthProfile: mocks.upsertAuthProfile,

69+

upsertAuthProfileWithLock: mocks.upsertAuthProfileWithLock,

6870

}));

69717072

vi.mock("../../agents/auth-profiles/store.js", () => ({

@@ -322,7 +324,8 @@ describe("modelsAuthLoginCommand", () => {

322324

);

323325

mocks.clackSelect.mockReset();

324326

mocks.clackText.mockReset();

325-

mocks.upsertAuthProfile.mockReset();

327+

mocks.upsertAuthProfileWithLock.mockReset();

328+

mocks.upsertAuthProfileWithLock.mockResolvedValue({ version: 1, profiles: {} });

326329

mocks.promoteAuthProfileInOrder.mockReset();

327330328331

mocks.resolveDefaultAgentId.mockReturnValue("main");

@@ -437,7 +440,7 @@ describe("modelsAuthLoginCommand", () => {

437440

runProviderAuth.mock.invocationCallOrder[0],

438441

);

439442

expect(runProviderAuth).toHaveBeenCalledOnce();

440-

const upsertCall = readMockCallArg(mocks.upsertAuthProfile) as UpsertAuthProfileCall;

443+

const upsertCall = readMockCallArg(mocks.upsertAuthProfileWithLock) as UpsertAuthProfileCall;

441444

expect(upsertCall.profileId).toBe("openai-codex:user@example.com");

442445

expect(upsertCall.credential?.type).toBe("oauth");

443446

expect(upsertCall.credential?.provider).toBe("openai-codex");

@@ -735,9 +738,9 @@ describe("modelsAuthLoginCommand", () => {

735738

const authRunCall = readMockCallArg(runProviderAuth) as AuthRunCall;

736739

expect(authRunCall.agentDir).toBe("/tmp/openclaw/agents/coder");

737740

expect(authRunCall.workspaceDir).toBe("/tmp/openclaw/workspaces/coder");

738-

expect((readMockCallArg(mocks.upsertAuthProfile) as UpsertAuthProfileCall).agentDir).toBe(

739-

"/tmp/openclaw/agents/coder",

740-

);

741+

expect(

742+

(readMockCallArg(mocks.upsertAuthProfileWithLock) as UpsertAuthProfileCall).agentDir,

743+

).toBe("/tmp/openclaw/agents/coder");

741744

});

742745743746

it("loads the owning plugin for an explicit provider even in a clean config", async () => {

@@ -791,7 +794,7 @@ describe("modelsAuthLoginCommand", () => {

791794

expect(providerResolutionCall.providerRefs).toEqual(["anthropic"]);

792795

expect(providerResolutionCall.activate).toBe(true);

793796

expect(runClaudeCliMigration).toHaveBeenCalledOnce();

794-

expect(mocks.upsertAuthProfile).not.toHaveBeenCalled();

797+

expect(mocks.upsertAuthProfileWithLock).not.toHaveBeenCalled();

795798

expect(lastUpdatedConfig?.agents?.defaults?.model).toEqual({

796799

primary: "claude-cli/claude-sonnet-4-6",

797800

});

@@ -928,7 +931,7 @@ describe("modelsAuthLoginCommand", () => {

928931

(order) => order < runClaudeCliMigration.mock.invocationCallOrder[0],

929932

),

930933

).toBe(true);

931-

expect(mocks.upsertAuthProfile).not.toHaveBeenCalled();

934+

expect(mocks.upsertAuthProfileWithLock).not.toHaveBeenCalled();

932935

expect(lastUpdatedConfig?.agents?.defaults?.model).toEqual({

933936

primary: "claude-cli/claude-sonnet-4-6",

934937

fallbacks: ["claude-cli/claude-opus-4-6", "openai/gpt-5.2"],

@@ -1125,7 +1128,7 @@ describe("modelsAuthLoginCommand", () => {

11251128

"exit:0",

11261129

);

112711301128-

expect(mocks.upsertAuthProfile).not.toHaveBeenCalled();

1131+

expect(mocks.upsertAuthProfileWithLock).not.toHaveBeenCalled();

11291132

expect(mocks.updateConfig).not.toHaveBeenCalled();

11301133

expect(mocks.logConfigUpdated).not.toHaveBeenCalled();

11311134

} finally {

@@ -1139,7 +1142,7 @@ describe("modelsAuthLoginCommand", () => {

1139114211401143

await modelsAuthPasteTokenCommand({ provider: "anthropic" }, runtime);

114111441142-

expect(mocks.upsertAuthProfile).toHaveBeenCalledWith({

1145+

expect(mocks.upsertAuthProfileWithLock).toHaveBeenCalledWith({

11431146

profileId: "anthropic:manual",

11441147

credential: {

11451148

type: "token",

@@ -1167,7 +1170,7 @@ describe("modelsAuthLoginCommand", () => {

11671170

await modelsAuthPasteTokenCommand({ provider: "openai", agent: "coder" }, runtime);

1168117111691172

expect(mocks.resolveDefaultAgentId).not.toHaveBeenCalled();

1170-

expect(mocks.upsertAuthProfile).toHaveBeenCalledWith({

1173+

expect(mocks.upsertAuthProfileWithLock).toHaveBeenCalledWith({

11711174

profileId: "openai:manual",

11721175

credential: {

11731176

type: "token",

@@ -1189,7 +1192,7 @@ describe("modelsAuthLoginCommand", () => {

11891192

);

1190119311911194

expect(mocks.clackText).not.toHaveBeenCalled();

1192-

expect(mocks.upsertAuthProfile).not.toHaveBeenCalled();

1195+

expect(mocks.upsertAuthProfileWithLock).not.toHaveBeenCalled();

11931196

expect(mocks.updateConfig).not.toHaveBeenCalled();

11941197

});

11951198

@@ -1225,7 +1228,7 @@ describe("modelsAuthLoginCommand", () => {

12251228

await modelsAuthSetupTokenCommand({ provider: "moonshot", yes: true }, runtime);

1226122912271230

expect(runTokenAuth).toHaveBeenCalledOnce();

1228-

expect(mocks.upsertAuthProfile).toHaveBeenCalledWith({

1231+

expect(mocks.upsertAuthProfileWithLock).toHaveBeenCalledWith({

12291232

profileId: "moonshot:token",

12301233

credential: {

12311234

type: "token",

@@ -1272,9 +1275,9 @@ describe("modelsAuthLoginCommand", () => {

12721275

const tokenAuthCall = readMockCallArg(runTokenAuth) as AuthRunCall;

12731276

expect(tokenAuthCall.agentDir).toBe("/tmp/openclaw/agents/coder");

12741277

expect(tokenAuthCall.workspaceDir).toBe("/tmp/openclaw/workspaces/coder");

1275-

expect((readMockCallArg(mocks.upsertAuthProfile) as UpsertAuthProfileCall).agentDir).toBe(

1276-

"/tmp/openclaw/agents/coder",

1277-

);

1278+

expect(

1279+

(readMockCallArg(mocks.upsertAuthProfileWithLock) as UpsertAuthProfileCall).agentDir,

1280+

).toBe("/tmp/openclaw/agents/coder");

12781281

});

1279128212801283

it("uses the requested agent store for interactive token auth add", async () => {

@@ -1314,9 +1317,9 @@ describe("modelsAuthLoginCommand", () => {

13141317

const tokenAuthCall = readMockCallArg(runTokenAuth) as AuthRunCall;

13151318

expect(tokenAuthCall.agentDir).toBe("/tmp/openclaw/agents/coder");

13161319

expect(tokenAuthCall.workspaceDir).toBe("/tmp/openclaw/workspaces/coder");

1317-

expect((readMockCallArg(mocks.upsertAuthProfile) as UpsertAuthProfileCall).agentDir).toBe(

1318-

"/tmp/openclaw/agents/coder",

1319-

);

1320+

expect(

1321+

(readMockCallArg(mocks.upsertAuthProfileWithLock) as UpsertAuthProfileCall).agentDir,

1322+

).toBe("/tmp/openclaw/agents/coder");

13201323

});

1321132413221325

it("keeps the requested agent store when interactive auth add falls back to paste-token", async () => {

@@ -1333,7 +1336,7 @@ describe("modelsAuthLoginCommand", () => {

13331336

await modelsAuthAddCommand({ agent: "coder" }, runtime);

1334133713351338

expect(mocks.resolveDefaultAgentId).not.toHaveBeenCalled();

1336-

expect(mocks.upsertAuthProfile).toHaveBeenCalledWith({

1339+

expect(mocks.upsertAuthProfileWithLock).toHaveBeenCalledWith({

13371340

profileId: "openai:manual",

13381341

credential: {

13391342

type: "token",