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

推荐订阅源

博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
aimingoo的专栏
aimingoo的专栏
腾讯CDC
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
Engineering at Meta
Engineering at Meta
博客园_首页
B
Blog RSS Feed
D
Docker
M
MIT News - Artificial intelligence
爱范儿
爱范儿
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(e2e): require zai fallback evidence · openclaw/opencl...
vincentkoc · 2026-06-07 · via Recent Commits to openclaw:main

@@ -5,8 +5,10 @@ import path from "node:path";

55

import { describe, expect, it } from "vitest";

66

import {

77

appendBoundedReproOutput,

8+

outputContainsStandaloneToolOk,

89

runZaiFallbackRepro,

910

resolveZaiFallbackPnpmCommand,

11+

sessionTranscriptHasToolResult,

1012

} from "../../scripts/zai-fallback-repro.ts";

11131214

describe("zai fallback repro command resolution", () => {

@@ -38,6 +40,32 @@ describe("zai fallback repro command resolution", () => {

3840

expect(second).toEqual({ text: "fghij", truncatedChars: 5 });

3941

});

404243+

it("scans session transcripts with a byte cap", async () => {

44+

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

45+

try {

46+

const sessionFile = path.join(root, "session.jsonl");

47+

await fs.writeFile(

48+

sessionFile,

49+

`${"x".repeat(70_000)}\n{"event":"message","toolResult":true}\n`,

50+

"utf8",

51+

);

52+53+

await expect(sessionTranscriptHasToolResult(sessionFile)).resolves.toBe(true);

54+

await expect(sessionTranscriptHasToolResult(sessionFile, 1024)).resolves.toBe(false);

55+

await expect(sessionTranscriptHasToolResult(path.join(root, "missing.jsonl"))).resolves.toBe(

56+

false,

57+

);

58+

} finally {

59+

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

60+

}

61+

});

62+63+

it("requires tool-ok as a standalone output line", () => {

64+

expect(outputContainsStandaloneToolOk("before\ntool-ok\nafter\n")).toBe(true);

65+

expect(outputContainsStandaloneToolOk("before tool-ok after\n")).toBe(false);

66+

expect(outputContainsStandaloneToolOk("tool-okay\n")).toBe(false);

67+

});

68+4169

it("cleans temporary repro state after fallback proof", async () => {

4270

const tempRoots: string[] = [];

4371

const calls: string[] = [];

@@ -70,14 +98,74 @@ describe("zai fallback repro command resolution", () => {

7098

await fs.mkdir(path.dirname(sessionFile), { recursive: true });

7199

await fs.writeFile(sessionFile, '{"toolResult":true}\n', "utf8");

72100

}

73-

return { code: 0, signal: null, stderr: "", stdout: "" };

101+

return {

102+

code: 0,

103+

signal: null,

104+

stderr: "",

105+

stdout: label === "run2" ? "tool-ok\n" : "",

106+

};

74107

},

75-

warn: () => {},

76108

});

7710978110

expect(exitCode).toBe(0);

79111

expect(calls).toEqual(["run1", "run2"]);

80112

expect(tempRoots).toHaveLength(1);

81113

await expect(fs.stat(tempRoots[0])).rejects.toMatchObject({ code: "ENOENT" });

82114

});

115+116+

it("fails when run 1 does not leave tool result evidence", async () => {

117+

const calls: string[] = [];

118+

const errors: string[] = [];

119+120+

const exitCode = await runZaiFallbackRepro({

121+

env: {

122+

ANTHROPIC_API_KEY: "anthropic-test-key",

123+

OPENCLAW_ZAI_FALLBACK_SESSION_ID: "session-test",

124+

PATH: process.env.PATH,

125+

ZAI_API_KEY: "zai-test-key",

126+

},

127+

error: (message) => errors.push(message),

128+

log: () => {},

129+

runCommand: async (label) => {

130+

calls.push(label);

131+

return { code: 0, signal: null, stderr: "", stdout: "" };

132+

},

133+

});

134+135+

expect(exitCode).toBe(1);

136+

expect(calls).toEqual(["run1"]);

137+

expect(errors).toContain("FAIL: no toolResult entries detected in session history.");

138+

});

139+140+

it("fails when fallback exits zero without returning tool-ok", async () => {

141+

const errors: string[] = [];

142+143+

const exitCode = await runZaiFallbackRepro({

144+

env: {

145+

ANTHROPIC_API_KEY: "anthropic-test-key",

146+

OPENCLAW_ZAI_FALLBACK_SESSION_ID: "session-test",

147+

PATH: process.env.PATH,

148+

ZAI_API_KEY: "zai-test-key",

149+

},

150+

error: (message) => errors.push(message),

151+

log: () => {},

152+

runCommand: async (label, _args, env) => {

153+

if (label === "run1") {

154+

const sessionFile = path.join(

155+

String(env.OPENCLAW_STATE_DIR),

156+

"agents",

157+

"main",

158+

"sessions",

159+

"session-test.jsonl",

160+

);

161+

await fs.mkdir(path.dirname(sessionFile), { recursive: true });

162+

await fs.writeFile(sessionFile, '{"toolResult":true}\n', "utf8");

163+

}

164+

return { code: 0, signal: null, stderr: "", stdout: "not-it\n" };

165+

},

166+

});

167+168+

expect(exitCode).toBe(1);

169+

expect(errors).toContain("FAIL: fallback run did not return standalone tool-ok.");

170+

});

83171

});