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

推荐订阅源

Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
IT之家
IT之家
Vercel News
Vercel News
C
Check Point Blog
Google DeepMind News
Google DeepMind News
月光博客
月光博客
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - 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: address successor transcript review follow-ups · ope...
pashpashpash · 2026-04-27 · via Recent Commits to openclaw:main

@@ -102,6 +102,57 @@ describe("rotateTranscriptAfterCompaction", () => {

102102

expect(successor.getLabel(oldUserId)).toBeUndefined();

103103

});

104104105+

it("deduplicates stale pre-compaction session state", async () => {

106+

const dir = await createTmpDir();

107+

const manager = SessionManager.create(dir, dir);

108+109+

const staleModelId = manager.appendModelChange("anthropic", "claude-sonnet-4-5");

110+

const staleThinkingId = manager.appendThinkingLevelChange("low");

111+

const staleSessionInfoId = manager.appendSessionInfo("stale title");

112+

manager.appendCustomEntry("test-extension", { cursor: "preserved" });

113+

manager.appendMessage({ role: "user", content: "old user", timestamp: 1 });

114+

manager.appendMessage(makeAssistant("old assistant", 2));

115+116+

manager.appendModelChange("openai", "gpt-5.2");

117+

manager.appendThinkingLevelChange("high");

118+

manager.appendSessionInfo("current title");

119+

const firstKeptId = manager.appendMessage({ role: "user", content: "kept user", timestamp: 3 });

120+

manager.appendMessage(makeAssistant("kept assistant", 4));

121+

manager.appendCompaction("Summary of old user and old assistant.", firstKeptId, 5000);

122+

manager.appendMessage({ role: "user", content: "post user", timestamp: 5 });

123+124+

const result = await rotateTranscriptAfterCompaction({

125+

sessionManager: manager,

126+

sessionFile: manager.getSessionFile()!,

127+

now: () => new Date("2026-04-27T12:05:00.000Z"),

128+

});

129+130+

expect(result.rotated).toBe(true);

131+

const successor = SessionManager.open(result.sessionFile!);

132+

const entries = successor.getEntries();

133+

expect(entries.find((entry) => entry.id === staleModelId)).toBeUndefined();

134+

expect(entries.find((entry) => entry.id === staleThinkingId)).toBeUndefined();

135+

expect(entries.find((entry) => entry.id === staleSessionInfoId)).toBeUndefined();

136+

expect(entries.filter((entry) => entry.type === "model_change")).toHaveLength(1);

137+

expect(entries.filter((entry) => entry.type === "thinking_level_change")).toHaveLength(1);

138+

expect(entries.filter((entry) => entry.type === "session_info")).toHaveLength(1);

139+

expect(entries.find((entry) => entry.type === "model_change")).toMatchObject({

140+

provider: "openai",

141+

modelId: "gpt-5.2",

142+

});

143+

expect(entries).toContainEqual(

144+

expect.objectContaining({

145+

type: "custom",

146+

customType: "test-extension",

147+

data: { cursor: "preserved" },

148+

}),

149+

);

150+151+

const context = successor.buildSessionContext();

152+

expect(context.thinkingLevel).toBe("high");

153+

expect(successor.getSessionName()).toBe("current title");

154+

});

155+105156

it("skips sessions with no compaction entry", async () => {

106157

const dir = await createTmpDir();

107158

const manager = SessionManager.create(dir, dir);

@@ -212,6 +263,55 @@ describe("rotateTranscriptAfterCompaction", () => {

212263

expect(activeContextText).toContain("next");

213264

expect(activeContextText).not.toContain("do task B instead");

214265

});

266+267+

it("orders preserved sibling branches after their surviving parents", async () => {

268+

const dir = await createTmpDir();

269+

const manager = SessionManager.create(dir, dir);

270+271+

manager.appendMessage({ role: "user", content: "hello", timestamp: 1 });

272+

const branchFromId = manager.appendMessage(makeAssistant("hi there", 2));

273+274+

const branchSummaryId = manager.branchWithSummary(

275+

branchFromId,

276+

"Summary of the inactive branch.",

277+

);

278+

const inactiveMsgId = manager.appendMessage({

279+

role: "user",

280+

content: "inactive branch",

281+

timestamp: 3,

282+

});

283+

manager.appendMessage(makeAssistant("inactive done", 4));

284+285+

manager.branch(branchFromId);

286+

manager.appendMessage({ role: "user", content: "active branch", timestamp: 5 });

287+

manager.appendMessage(makeAssistant("active done", 6));

288+

manager.appendCompaction("Summary of active work.", branchFromId, 5000);

289+

const activeLeafId = manager.appendMessage({

290+

role: "user",

291+

content: "next active",

292+

timestamp: 7,

293+

});

294+295+

const result = await rotateTranscriptAfterCompaction({

296+

sessionManager: manager,

297+

sessionFile: manager.getSessionFile()!,

298+

now: () => new Date("2026-04-27T13:00:00.000Z"),

299+

});

300+301+

expect(result.rotated).toBe(true);

302+

const successor = SessionManager.open(result.sessionFile!);

303+

const entries = successor.getEntries();

304+

const indexById = new Map(entries.map((entry, index) => [entry.id, index]));

305+

expect(indexById.get(branchFromId)).toBeLessThan(indexById.get(branchSummaryId)!);

306+

expect(indexById.get(branchSummaryId)).toBeLessThan(indexById.get(inactiveMsgId)!);

307+

expect(entries.at(-1)?.id).toBe(activeLeafId);

308+

expect(successor.getLeafId()).toBe(activeLeafId);

309+310+

const activeContextText = JSON.stringify(successor.buildSessionContext().messages);

311+

expect(activeContextText).toContain("Summary of active work.");

312+

expect(activeContextText).toContain("next active");

313+

expect(activeContextText).not.toContain("inactive branch");

314+

});

215315

});

216316217317

describe("shouldRotateCompactionTranscript", () => {