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

推荐订阅源

S
SegmentFault 最新的问题
J
Java Code Geeks
V
V2EX
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
B
Blog
A
About on SuperTechFans
有赞技术团队
有赞技术团队
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
美团技术团队
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
N
Netflix TechBlog - Medium
C
Check Point Blog
Recent Announcements
Recent Announcements
博客园 - Franky
博客园 - 叶小钗
T
Tailwind CSS 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
test: tighten edit recovery assertions · openclaw/opencla...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -86,6 +86,23 @@ describe("edit tool recovery hardening", () => {

8686

});

8787

}

888889+

function expectRecoveredText(result: Awaited<ReturnType<AnyAgentTool["execute"]>>, text: string) {

90+

expect((result as { isError?: unknown }).isError).toBe(false);

91+

const first = result.content[0];

92+

expect(first?.type).toBe("text");

93+

expect(first?.type === "text" ? first.text : undefined).toBe(text);

94+

}

95+96+

async function expectPathMissing(targetPath: string) {

97+

try {

98+

await fs.access(targetPath);

99+

throw new Error(`expected ${targetPath} to be missing`);

100+

} catch (error) {

101+

const code = error && typeof error === "object" && "code" in error ? error.code : undefined;

102+

expect(code).toBe("ENOENT");

103+

}

104+

}

105+89106

it("adds current file contents to exact-match mismatch errors", async () => {

90107

tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-edit-recovery-"));

91108

const filePath = path.join(tmpDir, "demo.txt");

@@ -136,11 +153,7 @@ describe("edit tool recovery hardening", () => {

136153

undefined,

137154

);

138155139-

expect(result).toMatchObject({ isError: false });

140-

expect(result.content[0]).toMatchObject({

141-

type: "text",

142-

text: `Successfully replaced text in ${filePath}.`,

143-

});

156+

expectRecoveredText(result, `Successfully replaced text in ${filePath}.`);

144157

});

145158146159

it("does not recover false success when the file never changed", async () => {

@@ -186,11 +199,7 @@ describe("edit tool recovery hardening", () => {

186199

undefined,

187200

);

188201189-

expect(result).toMatchObject({ isError: false });

190-

expect(result.content[0]).toMatchObject({

191-

type: "text",

192-

text: `Successfully replaced text in ${filePath}.`,

193-

});

202+

expectRecoveredText(result, `Successfully replaced text in ${filePath}.`);

194203

});

195204196205

it("recovers multi-edit payloads after a post-write throw", async () => {

@@ -218,11 +227,7 @@ describe("edit tool recovery hardening", () => {

218227

undefined,

219228

);

220229221-

expect(result).toMatchObject({ isError: false });

222-

expect(result.content[0]).toMatchObject({

223-

type: "text",

224-

text: `Successfully replaced 2 block(s) in ${filePath}.`,

225-

});

230+

expectRecoveredText(result, `Successfully replaced 2 block(s) in ${filePath}.`);

226231

});

227232228233

it("recovers tilde paths against the OS home even when OPENCLAW_HOME differs", async () => {

@@ -257,14 +262,8 @@ describe("edit tool recovery hardening", () => {

257262

undefined,

258263

);

259264260-

expect(result).toMatchObject({ isError: false });

261-

expect(result.content[0]).toMatchObject({

262-

type: "text",

263-

text: "Successfully replaced text in ~/demo.txt.",

264-

});

265-

await expect(fs.access(path.join(openclawHome, "demo.txt"))).rejects.toMatchObject({

266-

code: "ENOENT",

267-

});

265+

expectRecoveredText(result, "Successfully replaced text in ~/demo.txt.");

266+

await expectPathMissing(path.join(openclawHome, "demo.txt"));

268267

} finally {

269268

if (previousHome === undefined) {

270269

delete process.env.HOME;

@@ -305,10 +304,6 @@ describe("edit tool recovery hardening", () => {

305304

undefined,

306305

);

307306308-

expect(result).toMatchObject({ isError: false });

309-

expect(result.content[0]).toMatchObject({

310-

type: "text",

311-

text: `Successfully replaced text in ${filePath}.`,

312-

});

307+

expectRecoveredText(result, `Successfully replaced text in ${filePath}.`);

313308

});

314309

});