From e9808b58547925d7e87b0ecac7712850e242ed2c Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 17 Apr 2026 01:49:34 +0200 Subject: [PATCH] fix(coding-agent): restore afterToolCall error overrides closes #3051 --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/src/core/agent-session.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 318437c8..491b4b58 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- Fixed `tool_result` / `afterToolCall` extension handling for error results by forwarding `details` and `isError` overrides through `AgentSession` instead of dropping them when `isError` was already true ([#3051](https://github.com/badlogic/pi-mono/issues/3051)) - Fixed missing root exports for `RpcClient` and RPC protocol types from `@mariozechner/pi-coding-agent`, so ESM consumers can import them from the main package entrypoint ([#3275](https://github.com/badlogic/pi-mono/issues/3275)) - Fixed Bun binary asset path resolution to honor `PI_PACKAGE_DIR` for built-in themes, HTML export templates, and interactive bundled assets ([#3074](https://github.com/badlogic/pi-mono/issues/3074)) - Fixed user-message turn spacing in interactive mode by restoring an inter-message spacer before user turns (except the first user message), preventing assistant and user blocks from rendering flush together. diff --git a/packages/coding-agent/src/core/agent-session.ts b/packages/coding-agent/src/core/agent-session.ts index bccc5b8a..4f8bbfd7 100644 --- a/packages/coding-agent/src/core/agent-session.ts +++ b/packages/coding-agent/src/core/agent-session.ts @@ -398,17 +398,18 @@ export class AgentSession { toolCallId: toolCall.id, input: args as Record, content: result.content, - details: isError ? undefined : result.details, + details: result.details, isError, }); - if (!hookResult || isError) { + if (!hookResult) { return undefined; } return { content: hookResult.content, details: hookResult.details, + isError: hookResult.isError ?? isError, }; }; }