Skip to content

Commit 9c00268

Browse files
moeedahmedjalehman
andauthored
fix: honour tool error suppression for mutating tools (#81561)
Merged via squash. Prepared head SHA: 7462a86 Co-authored-by: moeedahmed <5780040+moeedahmed@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
1 parent 5d77512 commit 9c00268

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Docs: https://docs.openclaw.ai
6767
- Agents/compaction: bound plugin-owned CLI transcript compaction with the host safety timeout so a hung context engine can no longer stall post-turn cleanup. (#84083) Thanks @100yenadmin.
6868
- Control UI/usage: truncate long context skill, tool, and file names in the usage panel while keeping the full name available on hover. (#42197) Thanks @Rain120.
6969
- Codex: respect explicit `models auth order set` and `config.auth.order` precedence over stale `lastGood` in `/codex account`, and show `no working credential` when every explicit-order profile is ineligible instead of marking a lower-ranked profile as active. Fixes #84386. (#84412) Thanks @openperf.
70+
- Agents: honor `messages.suppressToolErrors` for mutating tool failures so configured chat surfaces do not receive separate warning payloads. (#81561) Thanks @moeedahmed.
7071

7172
## 2026.5.19
7273

src/agents/pi-embedded-runner/run/payloads.errors.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,14 @@ describe("buildEmbeddedRunPayloads", () => {
417417

418418
it.each([
419419
{
420-
name: "still shows mutating tool errors when messages.suppressToolErrors is enabled",
420+
name: "suppresses mutating tool errors when messages.suppressToolErrors is enabled",
421421
payload: {
422422
lastToolError: { toolName: "write", error: "connection timeout" },
423423
config: { messages: { suppressToolErrors: true } },
424424
},
425425
title: "Write",
426426
absentDetail: "connection timeout",
427+
suppressed: true,
427428
},
428429
{
429430
name: "shows recoverable tool errors for mutating tools",
@@ -441,8 +442,12 @@ describe("buildEmbeddedRunPayloads", () => {
441442
title: "Browser",
442443
absentDetail: "connection timeout",
443444
},
444-
])("$name", ({ payload, title, absentDetail }) => {
445+
])("$name", ({ payload, title, absentDetail, suppressed }) => {
445446
const payloads = buildPayloads(payload);
447+
if (suppressed) {
448+
expect(payloads).toEqual([]);
449+
return;
450+
}
446451
expectSingleToolErrorPayload(payloads, { title, absentDetail });
447452
});
448453

src/agents/pi-embedded-runner/run/payloads.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ function resolveToolErrorWarningPolicy(params: {
162162
if (normalizedToolName === "sessions_send") {
163163
return { showWarning: false, includeDetails };
164164
}
165+
if (params.suppressToolErrors) {
166+
return { showWarning: false, includeDetails };
167+
}
165168
const isMutatingToolError =
166169
params.lastToolError.mutatingAction ?? isLikelyMutatingToolName(params.lastToolError.toolName);
167170
if (isMutatingToolError) {
@@ -173,9 +176,6 @@ function resolveToolErrorWarningPolicy(params: {
173176
if (isExecLikeToolName(params.lastToolError.toolName) && !includeDetails) {
174177
return { showWarning: false, includeDetails };
175178
}
176-
if (params.suppressToolErrors) {
177-
return { showWarning: false, includeDetails };
178-
}
179179
return {
180180
showWarning: !params.hasUserFacingReply && !isRecoverableToolError(params.lastToolError.error),
181181
includeDetails,

0 commit comments

Comments
 (0)