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

推荐订阅源

J
Java Code Geeks
Martin Fowler
Martin Fowler
B
Blog RSS Feed
D
DataBreaches.Net
L
LangChain Blog
月光博客
月光博客
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
美团技术团队
Jina AI
Jina AI
博客园 - 司徒正美
雷峰网
雷峰网
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
小众软件
小众软件
罗磊的独立博客
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta

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(agents): memoize session lock owner args · openclaw/o...
openperf · 2026-05-27 · via Recent Commits to openclaw:main

@@ -742,6 +742,78 @@ describe("acquireSessionWriteLock", () => {

742742

}

743743

});

744744745+

it("memoizes readOwnerProcessArgs across locks with the same pid in one sweep (#86509)", async () => {

746+

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

747+

const sessionsDir = path.join(root, "sessions");

748+

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

749+

const nowMs = Date.now();

750+

const lockCount = 5;

751+

try {

752+

for (let i = 0; i < lockCount; i++) {

753+

await fs.writeFile(

754+

path.join(sessionsDir, `same-pid-${i}.jsonl.lock`),

755+

JSON.stringify({ pid: process.pid, createdAt: new Date(nowMs).toISOString() }),

756+

"utf8",

757+

);

758+

}

759+

const readArgsCalls: number[] = [];

760+

const readOwnerProcessArgs = (pid: number) => {

761+

readArgsCalls.push(pid);

762+

return ["node", "/srv/app/dist/index.js"];

763+

};

764+

const result = await cleanStaleLockFiles({

765+

sessionsDir,

766+

staleMs: 30_000,

767+

nowMs,

768+

removeStale: true,

769+

readOwnerProcessArgs,

770+

});

771+

expect(result.cleaned).toHaveLength(lockCount);

772+

// Without memo this would be `lockCount`; the per-pid cache collapses it to a single call.

773+

expect(readArgsCalls).toEqual([process.pid]);

774+

} finally {

775+

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

776+

}

777+

});

778+779+

it("does not poison the per-pid memo when readOwnerProcessArgs throws (#86509)", async () => {

780+

// A helper one layer up (`readOwnerProcessArgs`) already catches thrown resolvers and

781+

// returns null, so `cleanStaleLockFiles` never propagates the throw — but a naive memo

782+

// could still cache that null-equivalent failure and short-circuit later locks for the

783+

// same pid. The fix writes the cache only after the resolver returns, so each lock

784+

// retries the resolver fresh after a throw.

785+

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

786+

const sessionsDir = path.join(root, "sessions");

787+

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

788+

const nowMs = Date.now();

789+

const lockCount = 3;

790+

try {

791+

for (let i = 0; i < lockCount; i++) {

792+

await fs.writeFile(

793+

path.join(sessionsDir, `throwing-${i}.jsonl.lock`),

794+

JSON.stringify({ pid: process.pid, createdAt: new Date(nowMs).toISOString() }),

795+

"utf8",

796+

);

797+

}

798+

let throwCalls = 0;

799+

const result = await cleanStaleLockFiles({

800+

sessionsDir,

801+

staleMs: 30_000,

802+

nowMs,

803+

removeStale: true,

804+

readOwnerProcessArgs: () => {

805+

throwCalls++;

806+

throw new Error("transient resolver failure");

807+

},

808+

});

809+

// Resolver is invoked once per lock — the throw is not cached as a no-args entry.

810+

expect(throwCalls).toBe(lockCount);

811+

expect(result.cleaned).toHaveLength(0);

812+

} finally {

813+

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

814+

}

815+

});

816+745817

it("keeps fresh live .jsonl lock files with OpenClaw or unknown owners", async () => {

746818

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

747819

const sessionsDir = path.join(root, "sessions");