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

推荐订阅源

博客园_首页
C
Check Point Blog
B
Blog RSS Feed
G
Google Developers Blog
H
Help Net Security
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Recent Announcements
Recent Announcements
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
DataBreaches.Net
小众软件
小众软件
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
T
Tailwind CSS Blog
J
Java Code Geeks
MyScale Blog
MyScale 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: recover topic-suffixed restart locks (#76052) · open...
anyech · 2026-05-02 · via Recent Commits to openclaw:main

@@ -44,9 +44,9 @@ async function writeTranscript(

4444

await fs.writeFile(path.join(sessionsDir, `${sessionId}.jsonl`), `${lines}\n`);

4545

}

464647-

function cleanedLock(sessionsDir: string, sessionId: string): SessionLockInspection {

47+

function cleanedLockForPath(lockPath: string): SessionLockInspection {

4848

return {

49-

lockPath: path.join(sessionsDir, `${sessionId}.jsonl.lock`),

49+

lockPath,

5050

pid: 999_999,

5151

pidAlive: false,

5252

createdAt: new Date(Date.now() - 1_000).toISOString(),

@@ -57,6 +57,10 @@ function cleanedLock(sessionsDir: string, sessionId: string): SessionLockInspect

5757

};

5858

}

595960+

function cleanedLock(sessionsDir: string, sessionId: string): SessionLockInspection {

61+

return cleanedLockForPath(path.join(sessionsDir, `${sessionId}.jsonl.lock`));

62+

}

63+6064

describe("main-session-restart-recovery", () => {

6165

it("marks only main running sessions whose transcript lock was cleaned", async () => {

6266

const sessionsDir = await makeSessionsDir();

@@ -94,6 +98,123 @@ describe("main-session-restart-recovery", () => {

9498

expect(store["agent:main:other"]?.abortedLastRun).toBeUndefined();

9599

});

96100101+

it("marks a running main session whose cleaned transcript lock is topic-suffixed", async () => {

102+

const sessionsDir = await makeSessionsDir();

103+

const sessionId = "main-session";

104+

const sessionFile = `${sessionId}-topic-1234567890.jsonl`;

105+

await writeStore(sessionsDir, {

106+

"agent:main:discord:channel:123:thread:1234567890": {

107+

sessionId,

108+

sessionFile,

109+

updatedAt: Date.now() - 10_000,

110+

status: "running",

111+

},

112+

});

113+114+

const result = await markRestartAbortedMainSessionsFromLocks({

115+

sessionsDir,

116+

cleanedLocks: [cleanedLockForPath(path.join(sessionsDir, `${sessionFile}.lock`))],

117+

});

118+119+

const store = loadSessionStore(path.join(sessionsDir, "sessions.json"));

120+

expect(result).toEqual({ marked: 1, skipped: 0 });

121+

expect(store["agent:main:discord:channel:123:thread:1234567890"]?.abortedLastRun).toBe(true);

122+

});

123+124+

it("does not mark a session for an unrelated topic lock that only shares its id prefix", async () => {

125+

const sessionsDir = await makeSessionsDir();

126+

await writeStore(sessionsDir, {

127+

"agent:main:main": {

128+

sessionId: "main-session",

129+

sessionFile: "main-session.jsonl",

130+

updatedAt: Date.now() - 10_000,

131+

status: "running",

132+

},

133+

});

134+135+

const result = await markRestartAbortedMainSessionsFromLocks({

136+

sessionsDir,

137+

cleanedLocks: [

138+

cleanedLockForPath(path.join(sessionsDir, "main-session-topic-unrelated.jsonl.lock")),

139+

],

140+

});

141+142+

const store = loadSessionStore(path.join(sessionsDir, "sessions.json"));

143+

expect(result).toEqual({ marked: 0, skipped: 0 });

144+

expect(store["agent:main:main"]?.abortedLastRun).toBeUndefined();

145+

});

146+147+

it("normalizes relative cleaned lock paths against the current working directory", async () => {

148+

const sessionsDir = await makeSessionsDir();

149+

const sessionId = "main-session";

150+

const sessionFile = `${sessionId}-topic-1234567890.jsonl`;

151+

await writeStore(sessionsDir, {

152+

"agent:main:discord:channel:123:thread:1234567890": {

153+

sessionId,

154+

sessionFile,

155+

updatedAt: Date.now() - 10_000,

156+

status: "running",

157+

},

158+

});

159+160+

const result = await markRestartAbortedMainSessionsFromLocks({

161+

sessionsDir,

162+

cleanedLocks: [

163+

cleanedLockForPath(

164+

path.relative(process.cwd(), path.join(sessionsDir, `${sessionFile}.lock`)),

165+

),

166+

],

167+

});

168+169+

const store = loadSessionStore(path.join(sessionsDir, "sessions.json"));

170+

expect(result).toEqual({ marked: 1, skipped: 0 });

171+

expect(store["agent:main:discord:channel:123:thread:1234567890"]?.abortedLastRun).toBe(true);

172+

});

173+174+

it("falls back to the session id transcript lock when persisted sessionFile is outside the sessions dir", async () => {

175+

const sessionsDir = await makeSessionsDir();

176+

await writeStore(sessionsDir, {

177+

"agent:main:main": {

178+

sessionId: "main-session",

179+

sessionFile: "../stale/outside.jsonl",

180+

updatedAt: Date.now() - 10_000,

181+

status: "running",

182+

},

183+

});

184+185+

const result = await markRestartAbortedMainSessionsFromLocks({

186+

sessionsDir,

187+

cleanedLocks: [cleanedLock(sessionsDir, "main-session")],

188+

});

189+190+

const store = loadSessionStore(path.join(sessionsDir, "sessions.json"));

191+

expect(result).toEqual({ marked: 1, skipped: 0 });

192+

expect(store["agent:main:main"]?.abortedLastRun).toBe(true);

193+

});

194+195+

it("falls back to the session id transcript lock when persisted sessionFile belongs to another generated session", async () => {

196+

const sessionsDir = await makeSessionsDir();

197+

const sessionId = "11111111-1111-4111-8111-111111111111";

198+

const otherSessionId = "22222222-2222-4222-8222-222222222222";

199+

await writeStore(sessionsDir, {

200+

"agent:main:main": {

201+

sessionId,

202+

sessionFile: `${otherSessionId}.jsonl`,

203+

updatedAt: Date.now() - 10_000,

204+

status: "running",

205+

},

206+

});

207+208+

const result = await markRestartAbortedMainSessionsFromLocks({

209+

sessionsDir,

210+

cleanedLocks: [cleanedLock(sessionsDir, sessionId)],

211+

});

212+213+

const store = loadSessionStore(path.join(sessionsDir, "sessions.json"));

214+

expect(result).toEqual({ marked: 1, skipped: 0 });

215+

expect(store["agent:main:main"]?.abortedLastRun).toBe(true);

216+

});

217+97218

it("resumes marked sessions with a tool-result transcript tail", async () => {

98219

const sessionsDir = await makeSessionsDir();

99220

await writeStore(sessionsDir, {