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

推荐订阅源

The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
月光博客
月光博客
博客园 - Franky
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
有赞技术团队
有赞技术团队
V
V2EX
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
腾讯CDC
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
Martin Fowler
Martin Fowler
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
WordPress大学
WordPress大学
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
Microsoft Security Blog
Microsoft Security 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: render authenticated control ui avatars · openclaw/o...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -104,9 +104,30 @@ describe("refreshChatAvatar", () => {

104104

});

105105106106

it("uses a route-relative avatar endpoint before basePath bootstrap finishes", async () => {

107-

const fetchMock = vi.fn().mockResolvedValue({

108-

ok: true,

109-

json: async () => ({ avatarUrl: "/avatar/main" }),

107+

const createObjectURL = vi.fn(() => "blob:local-avatar");

108+

const revokeObjectURL = vi.fn();

109+

vi.stubGlobal(

110+

"URL",

111+

class extends URL {

112+

static createObjectURL = createObjectURL;

113+

static revokeObjectURL = revokeObjectURL;

114+

},

115+

);

116+

const fetchMock = vi.fn((input: string | URL | Request) => {

117+

const url = requestUrl(input);

118+

if (url === "/avatar/main?meta=1") {

119+

return Promise.resolve({

120+

ok: true,

121+

json: async () => ({ avatarUrl: "/avatar/main" }),

122+

});

123+

}

124+

if (url === "/avatar/main") {

125+

return Promise.resolve({

126+

ok: true,

127+

blob: async () => new Blob(["avatar"]),

128+

});

129+

}

130+

throw new Error(`Unexpected avatar URL: ${url}`);

110131

});

111132

vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);

112133

@@ -117,7 +138,17 @@ describe("refreshChatAvatar", () => {

117138

"/avatar/main?meta=1",

118139

expect.objectContaining({ method: "GET" }),

119140

);

120-

expect(host.chatAvatarUrl).toBe("/avatar/main");

141+

expect(fetchMock).toHaveBeenCalledWith(

142+

"/avatar/main",

143+

expect.objectContaining({ method: "GET" }),

144+

);

145+

const avatarFetchInit = (

146+

fetchMock.mock.calls as Array<[string | URL | Request, RequestInit?]>

147+

)[1]?.[1];

148+

expect(avatarFetchInit).not.toHaveProperty("headers");

149+

expect(createObjectURL).toHaveBeenCalledTimes(1);

150+

expect(revokeObjectURL).not.toHaveBeenCalled();

151+

expect(host.chatAvatarUrl).toBe("blob:local-avatar");

121152

});

122153123154

it("prefers the paired device token for avatar metadata and local avatar URLs", async () => {

@@ -261,6 +292,15 @@ describe("refreshChatAvatar", () => {

261292

});

262293263294

it("ignores stale avatar responses after switching sessions", async () => {

295+

const createObjectURL = vi.fn(() => "blob:ops-avatar");

296+

const revokeObjectURL = vi.fn();

297+

vi.stubGlobal(

298+

"URL",

299+

class extends URL {

300+

static createObjectURL = createObjectURL;

301+

static revokeObjectURL = revokeObjectURL;

302+

},

303+

);

264304

const mainRequest = createDeferred<{ avatarUrl?: string }>();

265305

const opsRequest = createDeferred<{ avatarUrl?: string }>();

266306

const fetchMock = vi.fn((input: string | URL | Request) => {

@@ -277,6 +317,12 @@ describe("refreshChatAvatar", () => {

277317

json: async () => opsRequest.promise,

278318

});

279319

}

320+

if (url === "/avatar/ops") {

321+

return Promise.resolve({

322+

ok: true,

323+

blob: async () => new Blob(["avatar"]),

324+

});

325+

}

280326

throw new Error(`Unexpected avatar URL: ${url}`);

281327

});

282328

vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);

@@ -294,7 +340,8 @@ describe("refreshChatAvatar", () => {

294340

opsRequest.resolve({ avatarUrl: "/avatar/ops" });

295341

await secondRefresh;

296342297-

expect(host.chatAvatarUrl).toBe("/avatar/ops");

343+

expect(createObjectURL).toHaveBeenCalledTimes(1);

344+

expect(host.chatAvatarUrl).toBe("blob:ops-avatar");

298345

expect(fetchMock).toHaveBeenNthCalledWith(

299346

1,

300347

"/avatar/main?meta=1",

@@ -305,6 +352,11 @@ describe("refreshChatAvatar", () => {

305352

"/avatar/ops?meta=1",

306353

expect.objectContaining({ method: "GET" }),

307354

);

355+

expect(fetchMock).toHaveBeenNthCalledWith(

356+

3,

357+

"/avatar/ops",

358+

expect.objectContaining({ method: "GET" }),

359+

);

308360

});

309361

});

310362