From 6da03eabe254af2f336f732fee7557f1f78f1053 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 24 Feb 2026 14:41:46 +0000 Subject: [PATCH] fix: add changelog and clean regression comment for tool-result guard (#25429) (thanks @mikaeldiakhate-cell) --- CHANGELOG.md | 1 + src/agents/session-tool-result-guard.test.ts | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce4b669b0..69cdf788c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Sessions/Tool-result guard: avoid generating synthetic `toolResult` entries for assistant turns that ended with `stopReason: "aborted"` or `"error"`, preventing orphaned tool-use IDs from triggering downstream API validation errors. (#25429) Thanks @mikaeldiakhate-cell. - Usage accounting: parse Moonshot/Kimi `cached_tokens` fields (including `prompt_tokens_details.cached_tokens`) into normalized cache-read usage metrics. (#25436) Thanks @Elarwei001. - Doctor/Sandbox: when sandbox mode is enabled but Docker is unavailable, surface a clear actionable warning (including failure impact and remediation) instead of a mild “skip checks” note. (#25438) Thanks @mcaxtr. - Config/Meta: accept numeric `meta.lastTouchedAt` timestamps and coerce them to ISO strings, preserving compatibility with agent edits that write `Date.now()` values. (#25491) Thanks @mcaxtr. diff --git a/src/agents/session-tool-result-guard.test.ts b/src/agents/session-tool-result-guard.test.ts index 105b587cf..7df8b8d48 100644 --- a/src/agents/session-tool-result-guard.test.ts +++ b/src/agents/session-tool-result-guard.test.ts @@ -358,11 +358,9 @@ describe("installSessionToolResultGuard", () => { }); }); - // Regression test for orphaned tool_result bug - // See: https://github.com/clawdbot/clawdbot/issues/XXXX // When an assistant message with toolCalls is aborted, no synthetic toolResult // should be created. Creating synthetic results for aborted/incomplete tool calls - // causes API 400 errors: "unexpected tool_use_id found in tool_result blocks" + // causes API 400 errors: "unexpected tool_use_id found in tool_result blocks". it("does NOT create synthetic toolResult for aborted assistant messages with toolCalls", () => { const sm = SessionManager.inMemory(); installSessionToolResultGuard(sm);