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

推荐订阅源

WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
D
DataBreaches.Net
月光博客
月光博客
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
U
Unit 42
腾讯CDC
爱范儿
爱范儿
J
Java Code Geeks
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
B
Blog
Stack Overflow Blog
Stack Overflow Blog
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
T
Tailwind CSS 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
refactor: share preview resolve alias fixtures · openclaw...
vincentkoc · 2026-06-01 · via Recent Commits to openclaw:main

@@ -12,6 +12,42 @@ import {

12121313

const { createSessionStoreDir, openClient } = setupGatewaySessionsTestHarness();

141415+

async function writeTranscriptMessage(

16+

dir: string,

17+

sessionId: string,

18+

content: string,

19+

): Promise<void> {

20+

await fs.writeFile(

21+

path.join(dir, `${sessionId}.jsonl`),

22+

[

23+

JSON.stringify({ type: "session", version: 1, id: sessionId }),

24+

JSON.stringify({ message: { role: "assistant", content } }),

25+

].join("\n"),

26+

"utf-8",

27+

);

28+

}

29+30+

async function previewMainAliasFromStore(params: {

31+

transcripts: Record<string, string>;

32+

store: Record<string, { sessionId: string; updatedAt: number }>;

33+

}): Promise<Awaited<ReturnType<typeof getMainPreviewEntry>>> {

34+

const { dir, storePath } = await createSessionStoreDir();

35+

testState.agentsConfig = { list: [{ id: "ops", default: true }] };

36+

testState.sessionConfig = { mainKey: "work" };

37+38+

for (const [sessionId, content] of Object.entries(params.transcripts)) {

39+

await writeTranscriptMessage(dir, sessionId, content);

40+

}

41+

await fs.writeFile(storePath, JSON.stringify(params.store, null, 2), "utf-8");

42+43+

const { ws } = await openClient();

44+

try {

45+

return await getMainPreviewEntry(ws);

46+

} finally {

47+

ws.close();

48+

}

49+

}

50+1551

test("sessions.preview returns transcript previews", async () => {

1652

const { dir } = await createSessionStoreDir();

1753

const sessionId = "sess-preview";

@@ -41,85 +77,40 @@ test("sessions.preview returns transcript previews", async () => {

4177

});

42784379

test("sessions.preview resolves legacy mixed-case main alias with custom mainKey", async () => {

44-

const { dir, storePath } = await createSessionStoreDir();

45-

testState.agentsConfig = { list: [{ id: "ops", default: true }] };

46-

testState.sessionConfig = { mainKey: "work" };

4780

const sessionId = "sess-legacy-main";

48-

const transcriptPath = path.join(dir, `${sessionId}.jsonl`);

49-

const lines = [

50-

JSON.stringify({ type: "session", version: 1, id: sessionId }),

51-

JSON.stringify({ message: { role: "assistant", content: "Legacy alias transcript" } }),

52-

];

53-

await fs.writeFile(transcriptPath, lines.join("\n"), "utf-8");

54-

await fs.writeFile(

55-

storePath,

56-

JSON.stringify(

57-

{

58-

"agent:ops:MAIN": {

59-

sessionId,

60-

updatedAt: Date.now(),

61-

},

62-

},

63-

null,

64-

2,

65-

),

66-

"utf-8",

67-

);

688169-

const { ws } = await openClient();

70-

const entry = await getMainPreviewEntry(ws);

82+

const entry = await previewMainAliasFromStore({

83+

transcripts: {

84+

[sessionId]: "Legacy alias transcript",

85+

},

86+

store: {

87+

"agent:ops:MAIN": {

88+

sessionId,

89+

updatedAt: Date.now(),

90+

},

91+

},

92+

});

7193

expect(entry?.items[0]?.text).toContain("Legacy alias transcript");

72-73-

ws.close();

7494

});

75957696

test("sessions.preview prefers the freshest duplicate row for a legacy mixed-case main alias", async () => {

77-

const { dir, storePath } = await createSessionStoreDir();

78-

testState.agentsConfig = { list: [{ id: "ops", default: true }] };

79-

testState.sessionConfig = { mainKey: "work" };

80-81-

const staleTranscriptPath = path.join(dir, "sess-stale-main.jsonl");

82-

const freshTranscriptPath = path.join(dir, "sess-fresh-main.jsonl");

83-

await fs.writeFile(

84-

staleTranscriptPath,

85-

[

86-

JSON.stringify({ type: "session", version: 1, id: "sess-stale-main" }),

87-

JSON.stringify({ message: { role: "assistant", content: "stale preview" } }),

88-

].join("\n"),

89-

"utf-8",

90-

);

91-

await fs.writeFile(

92-

freshTranscriptPath,

93-

[

94-

JSON.stringify({ type: "session", version: 1, id: "sess-fresh-main" }),

95-

JSON.stringify({ message: { role: "assistant", content: "fresh preview" } }),

96-

].join("\n"),

97-

"utf-8",

98-

);

99-

await fs.writeFile(

100-

storePath,

101-

JSON.stringify(

102-

{

103-

"agent:ops:work": {

104-

sessionId: "sess-stale-main",

105-

updatedAt: 1,

106-

},

107-

"agent:ops:WORK": {

108-

sessionId: "sess-fresh-main",

109-

updatedAt: 2,

110-

},

97+

const entry = await previewMainAliasFromStore({

98+

transcripts: {

99+

"sess-stale-main": "stale preview",

100+

"sess-fresh-main": "fresh preview",

101+

},

102+

store: {

103+

"agent:ops:work": {

104+

sessionId: "sess-stale-main",

105+

updatedAt: 1,

111106

},

112-

null,

113-

2,

114-

),

115-

"utf-8",

116-

);

117-118-

const { ws } = await openClient();

119-

const entry = await getMainPreviewEntry(ws);

107+

"agent:ops:WORK": {

108+

sessionId: "sess-fresh-main",

109+

updatedAt: 2,

110+

},

111+

},

112+

});

120113

expect(entry?.items[0]?.text).toContain("fresh preview");

121-122-

ws.close();

123114

});

124115125116

test("sessions.resolve and mutators clean legacy main-alias ghost keys", async () => {