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

推荐订阅源

博客园 - 叶小钗
D
Docker
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
Recent Announcements
Recent Announcements
GbyAI
GbyAI
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
L
LangChain Blog
A
About on SuperTechFans
M
MIT News - Artificial intelligence
B
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(agents): preserve Pi tool result error flags (#81546)...
MonkeyLeeT · 2026-05-16 · via Recent Commits to openclaw:main

@@ -69,4 +69,186 @@ describe("buildEmbeddedExtensionFactories", () => {

6969

expect(seenToolCallIds[1]).toMatch(/^pi-/);

7070

expect(seenToolCallIds[0]).not.toBe(seenToolCallIds[1]);

7171

});

72+73+

it("marks status-error tool results as model-visible failures", async () => {

74+

setActivePluginRegistry(createEmptyPluginRegistry());

75+76+

const factories = buildEmbeddedExtensionFactories({

77+

cfg: undefined,

78+

sessionManager: SessionManager.inMemory(),

79+

provider: "openai",

80+

modelId: "gpt-5.4",

81+

model: undefined,

82+

});

83+84+

const handlers = new Map<string, Function>();

85+

await factories[0]?.({

86+

on(event: string, handler: Function) {

87+

handlers.set(event, handler);

88+

},

89+

} as never);

90+

const handler = handlers.get("tool_result");

91+

const content = [{ type: "text", text: "oldText must be unique" }];

92+

const details = {

93+

status: "error",

94+

tool: "edit",

95+

error: "oldText must be unique",

96+

};

97+98+

const result = await handler?.(

99+

{

100+

toolName: "edit",

101+

toolCallId: "call-edit",

102+

content,

103+

details,

104+

isError: false,

105+

},

106+

{ cwd: "/tmp" },

107+

);

108+109+

expect(result).toEqual({

110+

content,

111+

details,

112+

isError: true,

113+

});

114+

});

115+116+

it("preserves model-visible failures when middleware rewrites details", async () => {

117+

const registry = createEmptyPluginRegistry();

118+

registry.agentToolResultMiddlewares.push({

119+

pluginId: "redactor",

120+

pluginName: "redactor",

121+

rawHandler: () => undefined,

122+

handler: (event) => {

123+

event.result.content = [{ type: "text", text: "redacted error" }];

124+

event.result.details = { redacted: true };

125+

return undefined;

126+

},

127+

runtimes: ["pi"],

128+

source: "test",

129+

});

130+

setActivePluginRegistry(registry);

131+132+

const factories = buildEmbeddedExtensionFactories({

133+

cfg: undefined,

134+

sessionManager: SessionManager.inMemory(),

135+

provider: "openai",

136+

modelId: "gpt-5.4",

137+

model: undefined,

138+

});

139+140+

const handlers = new Map<string, Function>();

141+

await factories[0]?.({

142+

on(event: string, handler: Function) {

143+

handlers.set(event, handler);

144+

},

145+

} as never);

146+

const handler = handlers.get("tool_result");

147+148+

const result = await handler?.(

149+

{

150+

toolName: "edit",

151+

toolCallId: "call-edit",

152+

content: [{ type: "text", text: "oldText must be unique" }],

153+

details: { status: "error", tool: "edit", error: "oldText must be unique" },

154+

isError: false,

155+

},

156+

{ cwd: "/tmp" },

157+

);

158+159+

expect(result).toEqual({

160+

content: [{ type: "text", text: "redacted error" }],

161+

details: { redacted: true },

162+

isError: true,

163+

});

164+

});

165+166+

it("marks status-timeout tool results as model-visible failures", async () => {

167+

setActivePluginRegistry(createEmptyPluginRegistry());

168+169+

const factories = buildEmbeddedExtensionFactories({

170+

cfg: undefined,

171+

sessionManager: SessionManager.inMemory(),

172+

provider: "openai",

173+

modelId: "gpt-5.4",

174+

model: undefined,

175+

});

176+177+

const handlers = new Map<string, Function>();

178+

await factories[0]?.({

179+

on(event: string, handler: Function) {

180+

handlers.set(event, handler);

181+

},

182+

} as never);

183+

const handler = handlers.get("tool_result");

184+185+

const result = await handler?.(

186+

{

187+

toolName: "exec",

188+

toolCallId: "call-exec",

189+

content: [{ type: "text", text: "Timed out" }],

190+

details: { status: "timeout", tool: "exec", error: "Timed out" },

191+

isError: false,

192+

},

193+

{ cwd: "/tmp" },

194+

);

195+196+

expect(result).toEqual({

197+

content: [{ type: "text", text: "Timed out" }],

198+

details: { status: "timeout", tool: "exec", error: "Timed out" },

199+

isError: true,

200+

});

201+

});

202+203+

it("does not mark results as errors when status is absent or non-error", async () => {

204+

setActivePluginRegistry(createEmptyPluginRegistry());

205+206+

const factories = buildEmbeddedExtensionFactories({

207+

cfg: undefined,

208+

sessionManager: SessionManager.inMemory(),

209+

provider: "openai",

210+

modelId: "gpt-5.4",

211+

model: undefined,

212+

});

213+214+

const handlers = new Map<string, Function>();

215+

await factories[0]?.({

216+

on(event: string, handler: Function) {

217+

handlers.set(event, handler);

218+

},

219+

} as never);

220+

const handler = handlers.get("tool_result");

221+222+

// Empty details — no status field

223+

const noStatusResult = await handler?.(

224+

{

225+

toolName: "read",

226+

toolCallId: "call-read",

227+

content: [{ type: "text", text: "file contents" }],

228+

details: {},

229+

isError: false,

230+

},

231+

{ cwd: "/tmp" },

232+

);

233+

expect(noStatusResult).toEqual({

234+

content: [{ type: "text", text: "file contents" }],

235+

details: {},

236+

});

237+238+

// Explicit ok status

239+

const okResult = await handler?.(

240+

{

241+

toolName: "read",

242+

toolCallId: "call-read-2",

243+

content: [{ type: "text", text: "ok" }],

244+

details: { status: "ok" },

245+

isError: false,

246+

},

247+

{ cwd: "/tmp" },

248+

);

249+

expect(okResult).toEqual({

250+

content: [{ type: "text", text: "ok" }],

251+

details: { status: "ok" },

252+

});

253+

});

72254

});