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

推荐订阅源

D
DataBreaches.Net
B
Blog
博客园_首页
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog RSS Feed
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
量子位
V
V2EX
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
I
InfoQ
博客园 - 【当耐特】

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(session): fence stale post-run session writes · openc...
xialonglee · 2026-06-17 · via Recent Commits to openclaw:main

@@ -127,6 +127,16 @@ function makeCliResult(text: string): EmbeddedAgentRunResult {

127127

};

128128

}

129129130+

async function persistCliTranscriptEntry(

131+

params: Parameters<typeof persistCliTurnTranscript>[0],

132+

): Promise<SessionEntry | undefined> {

133+

const result = await persistCliTurnTranscript(params);

134+

if (result.kind !== "persisted") {

135+

throw new Error("expected CLI transcript persistence to keep the current session");

136+

}

137+

return result.sessionEntry;

138+

}

139+130140

async function readSessionMessages(sessionFile: string) {

131141

return (await readSessionFileJsonLines<{ type?: string; message?: unknown }>(sessionFile))

132142

.filter((entry) => entry.type === "message")

@@ -1143,7 +1153,7 @@ describe("CLI attempt execution", () => {

11431153

});

11441154

let updatedEntry: SessionEntry | undefined;

11451155

try {

1146-

updatedEntry = await persistCliTurnTranscript({

1156+

updatedEntry = await persistCliTranscriptEntry({

11471157

body: "persist this",

11481158

result: makeCliResult("hello from cli"),

11491159

sessionId: sessionEntry.sessionId,

@@ -1204,6 +1214,40 @@ describe("CLI attempt execution", () => {

12041214

expect(sessionStore[sessionKey]?.updatedAt).toBe(persisted[sessionKey]?.updatedAt);

12051215

});

120612161217+

it("does not append a CLI transcript after the session is deleted", async () => {

1218+

const sessionKey = "agent:main:subagent:cli-transcript-deleted";

1219+

const staleSessionFile = path.join(tmpDir, "session-cli-stale.jsonl");

1220+

const staleEntry: SessionEntry = {

1221+

sessionId: "session-cli-stale",

1222+

sessionFile: staleSessionFile,

1223+

updatedAt: 1,

1224+

};

1225+

const sessionStore: Record<string, SessionEntry> = { [sessionKey]: staleEntry };

1226+

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

1227+

clearSessionStoreCacheForTest();

1228+1229+

const result = await persistCliTurnTranscript({

1230+

body: "late prompt",

1231+

result: makeCliResult("late reply"),

1232+

sessionId: staleEntry.sessionId,

1233+

sessionKey,

1234+

sessionEntry: staleEntry,

1235+

sessionStore,

1236+

storePath,

1237+

sessionAgentId: "main",

1238+

sessionCwd: tmpDir,

1239+

config: {},

1240+

});

1241+1242+

expect(result).toEqual({ kind: "session-rebound", sessionEntry: undefined });

1243+

await expect(fs.stat(staleSessionFile)).rejects.toMatchObject({ code: "ENOENT" });

1244+

const persisted = JSON.parse(await fs.readFile(storePath, "utf-8")) as Record<

1245+

string,

1246+

SessionEntry

1247+

>;

1248+

expect(persisted[sessionKey]).toBeUndefined();

1249+

});

1250+12071251

it("embedded assistant gap-fill skips user mirror and dedupes identical assistant tails", async () => {

12081252

const sessionKey = "agent:main:subagent:embedded-gap-fill";

12091253

const sessionEntry: SessionEntry = {

@@ -1221,7 +1265,7 @@ describe("CLI attempt execution", () => {

12211265

runner: "embedded",

12221266

};

122312671224-

const updatedFirst = await persistCliTurnTranscript({

1268+

const updatedFirst = await persistCliTranscriptEntry({

12251269

body: "ignored for gap fill",

12261270

transcriptBody: "also ignored",

12271271

result,

@@ -1278,7 +1322,7 @@ describe("CLI attempt execution", () => {

12781322

runner: "embedded",

12791323

};

128013241281-

const updatedFirst = await persistCliTurnTranscript({

1325+

const updatedFirst = await persistCliTranscriptEntry({

12821326

body: "ignored for gap fill",

12831327

result,

12841328

sessionId: sessionEntry.sessionId,

@@ -1344,7 +1388,7 @@ describe("CLI attempt execution", () => {

13441388

runner: "embedded",

13451389

};

134613901347-

const updatedFirst = await persistCliTurnTranscript({

1391+

const updatedFirst = await persistCliTranscriptEntry({

13481392

body: "ignored for gap fill",

13491393

result,

13501394

sessionId: sessionEntry.sessionId,

@@ -1415,7 +1459,7 @@ describe("CLI attempt execution", () => {

14151459

runner: "embedded",

14161460

};

141714611418-

const updatedFirst = await persistCliTurnTranscript({

1462+

const updatedFirst = await persistCliTranscriptEntry({

14191463

body: "ignored for gap fill",

14201464

result,

14211465

sessionId: sessionEntry.sessionId,

@@ -1484,7 +1528,7 @@ describe("CLI attempt execution", () => {

14841528

const sessionStore: Record<string, SessionEntry> = { [sessionKey]: sessionEntry };

14851529

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

148615301487-

const updatedEntry = await persistCliTurnTranscript({

1531+

const updatedEntry = await persistCliTranscriptEntry({

14881532

body: [

14891533

"<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>",

14901534

"secret runtime context",