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

推荐订阅源

I
InfoQ
博客园_首页
美团技术团队
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
J
Java Code Geeks
T
Tailwind CSS Blog
Jina AI
Jina AI
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

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
test: dedupe session lock symlink fixtures · openclaw/ope...
steipete · 2026-04-24 · via Recent Commits to openclaw:main

@@ -70,6 +70,38 @@ async function writeCurrentProcessLock(lockPath: string, extra?: Record<string,

7070

);

7171

}

727273+

async function withSymlinkedSessionPaths(

74+

run: (params: {

75+

sessionReal: string;

76+

sessionLink: string;

77+

realLockPath: string;

78+

linkLockPath: string;

79+

}) => Promise<void>,

80+

) {

81+

if (process.platform === "win32") {

82+

return;

83+

}

84+85+

const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-lock-"));

86+

try {

87+

const realDir = path.join(root, "real");

88+

const linkDir = path.join(root, "link");

89+

await fs.mkdir(realDir, { recursive: true });

90+

await fs.symlink(realDir, linkDir);

91+92+

const sessionReal = path.join(realDir, "sessions.json");

93+

const sessionLink = path.join(linkDir, "sessions.json");

94+

await run({

95+

sessionReal,

96+

sessionLink,

97+

realLockPath: `${sessionReal}.lock`,

98+

linkLockPath: `${sessionLink}.lock`,

99+

});

100+

} finally {

101+

await fs.rm(root, { recursive: true, force: true });

102+

}

103+

}

104+73105

async function expectActiveInProcessLockIsNotReclaimed(params?: {

74106

legacyStarttime?: unknown;

75107

}): Promise<void> {

@@ -109,48 +141,33 @@ describe("acquireSessionWriteLock", () => {

109141

vi.restoreAllMocks();

110142

});

111143

it("reuses locks across symlinked session paths", async () => {

112-

if (process.platform === "win32") {

113-

return;

114-

}

115-116-

const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-lock-"));

117-

try {

118-

const realDir = path.join(root, "real");

119-

const linkDir = path.join(root, "link");

120-

await fs.mkdir(realDir, { recursive: true });

121-

await fs.symlink(realDir, linkDir);

122-123-

const sessionReal = path.join(realDir, "sessions.json");

124-

const sessionLink = path.join(linkDir, "sessions.json");

125-

const realLockPath = `${sessionReal}.lock`;

126-

const linkLockPath = `${sessionLink}.lock`;

127-128-

const lockA = await acquireSessionWriteLock({

129-

sessionFile: sessionReal,

130-

timeoutMs: 500,

131-

allowReentrant: true,

132-

});

133-

const lockB = await acquireSessionWriteLock({

134-

sessionFile: sessionLink,

135-

timeoutMs: 500,

136-

allowReentrant: true,

137-

});

138-139-

await expect(fs.access(realLockPath)).resolves.toBeUndefined();

140-

await expect(fs.access(linkLockPath)).resolves.toBeUndefined();

141-

const [realCanonicalLockPath, linkCanonicalLockPath] = await Promise.all([

142-

fs.realpath(realLockPath),

143-

fs.realpath(linkLockPath),

144-

]);

145-

expect(linkCanonicalLockPath).toBe(realCanonicalLockPath);

146-

await expectLockRemovedOnlyAfterFinalRelease({

147-

lockPath: realLockPath,

148-

firstLock: lockA,

149-

secondLock: lockB,

150-

});

151-

} finally {

152-

await fs.rm(root, { recursive: true, force: true });

153-

}

144+

await withSymlinkedSessionPaths(

145+

async ({ sessionReal, sessionLink, realLockPath, linkLockPath }) => {

146+

const lockA = await acquireSessionWriteLock({

147+

sessionFile: sessionReal,

148+

timeoutMs: 500,

149+

allowReentrant: true,

150+

});

151+

const lockB = await acquireSessionWriteLock({

152+

sessionFile: sessionLink,

153+

timeoutMs: 500,

154+

allowReentrant: true,

155+

});

156+157+

await expect(fs.access(realLockPath)).resolves.toBeUndefined();

158+

await expect(fs.access(linkLockPath)).resolves.toBeUndefined();

159+

const [realCanonicalLockPath, linkCanonicalLockPath] = await Promise.all([

160+

fs.realpath(realLockPath),

161+

fs.realpath(linkLockPath),

162+

]);

163+

expect(linkCanonicalLockPath).toBe(realCanonicalLockPath);

164+

await expectLockRemovedOnlyAfterFinalRelease({

165+

lockPath: realLockPath,

166+

firstLock: lockA,

167+

secondLock: lockB,

168+

});

169+

},

170+

);

154171

});

155172156173

it("keeps the lock file until the last release", async () => {

@@ -185,29 +202,15 @@ describe("acquireSessionWriteLock", () => {

185202

});

186203187204

it("does not reenter locks by default through symlinked session paths", async () => {

188-

if (process.platform === "win32") {

189-

return;

190-

}

191-192-

const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-lock-"));

193-

try {

194-

const realDir = path.join(root, "real");

195-

const linkDir = path.join(root, "link");

196-

await fs.mkdir(realDir, { recursive: true });

197-

await fs.symlink(realDir, linkDir);

198-199-

const sessionReal = path.join(realDir, "sessions.json");

200-

const sessionLink = path.join(linkDir, "sessions.json");

205+

await withSymlinkedSessionPaths(async ({ sessionReal, sessionLink }) => {

201206

const lock = await acquireSessionWriteLock({ sessionFile: sessionReal, timeoutMs: 500 });

202207203208

await expect(

204209

acquireSessionWriteLock({ sessionFile: sessionLink, timeoutMs: 5, staleMs: 60_000 }),

205210

).rejects.toThrow(/session file locked/);

206211207212

await lock.release();

208-

} finally {

209-

await fs.rm(root, { recursive: true, force: true });

210-

}

213+

});

211214

});

212215213216

it("allows a new default lock acquisition after the held lock is released", async () => {