test(pi-agent-core): reproduce dropped resolved tool errors - #2016
Draft
pimmink wants to merge 2 commits into
Draft
test(pi-agent-core): reproduce dropped resolved tool errors#2016pimmink wants to merge 2 commits into
pimmink wants to merge 2 commits into
Conversation
Contributor
🟢 PR Risk Report — LOW
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
agentLoopturn with a tool that resolves successfully with an embeddedisError: truefield and asserts the emittedtool_execution_enderror 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-levelisErrorproperty.Current result: the focused test fails against
upstream/mainbecause the loop emitstool_execution_end.isError === falsefor 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-coreis an upstream core/agent-orchestration surface. Before production code is added, maintainer approval is requested on whetherAgentToolResultshould gain an optional publicisError?: booleanfield, 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
expect(toolEnd.isError).toBe(true); receivedfalse.git diff --check: passed.fd9946ca.AI-assisted contribution: investigation and draft are AI-assisted; the human contributor remains responsible for the design and implementation.