Skip to content

test(pi-agent-core): reproduce dropped resolved tool errors - #2016

Draft
pimmink wants to merge 2 commits into
open-gsd:mainfrom
pimmink:fix/agent-core-tool-result-iserror
Draft

test(pi-agent-core): reproduce dropped resolved tool errors#2016
pimmink wants to merge 2 commits into
open-gsd:mainfrom
pimmink:fix/agent-core-tool-result-iserror

Conversation

@pimmink

@pimmink pimmink commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

TL;DR

What: Adds a focused regression reproduction for a resolved tool result carrying isError: true.
Why: The current agent loop emits isError: false, silently losing the result-level error signal.
How: Runs a real agentLoop turn with a tool that resolves successfully with an embedded isError: true field and asserts the emitted tool_execution_end error state.

What

This Draft PR contains only the failing regression test in packages/pi-agent-core/test/agent-loop.test.ts. It does not change production code or the public type declarations yet.

Why

The test reproduces the behavior described in RFC issue #2015: a normally resolved result is wrapped as { result, isError: false }, and normalization currently drops the result-level isError property.

Current result: the focused test fails against upstream/main because the loop emits tool_execution_end.isError === false for a resolved { isError: true } result.

How

The test uses the real agent loop and a minimal mock assistant stream. It verifies the tool execution event and returned content, so it exercises the production finalization path rather than mocking that path away.

RFC / approval gate

Related RFC issue: #2015

packages/pi-agent-core is an upstream core/agent-orchestration surface. Before production code is added, maintainer approval is requested on whether AgentToolResult should gain an optional public isError?: boolean field, or whether this should remain an adapter-only conversion to thrown errors / existing result hooks.

This Draft PR intentionally remains red until that design decision is confirmed and the smallest approved implementation is added.

Verification

  • Focused pre-fix reproduction: fails as expected at expect(toolEnd.isError).toBe(true); received false.
  • git diff --check: passed.
  • Commit: fd9946ca.

AI-assisted contribution: investigation and draft are AI-assisted; the human contributor remains responsible for the design and implementation.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 PR Risk Report — LOW

Files changed 1
Systems affected 0
Overall risk 🟢 LOW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant