Skip to content

Pi adapter records failed archive reads as successful tool results #75

Description

@oritwoen

The Pi adapter returns the shared executor's isError: true object unchanged. Pi records a returned value as success, so failed archive reads become toolResult.isError: false. The error text survives, but the failure status does not.

Reproduction on archives 0.5.4, commit 37d69db, with Pi 0.85.1:

  1. Capture archives_content from the real extension factory. Mock ofetch to reject with Error('fixture CDX 503').
  2. Call its execute callback with {target: 'https://example.com/old', provider: 'wayback', cache: false, retries: 0}. The returned object has isError: true.
  3. Run the same registered tool through the installed pi-agent-core runAgentLoop, with a synthetic assistant stream that calls it once. The resulting tool message has isError: false. Replacing execute with a throwing callback gives isError: true. No model or network is needed.

packages/pi/extensions/archives.ts directly returns contentArchives(params, signal). Pi's documented contract requires throwing from execute to signal failure. The existing pi-extension test asserts the returned object's flag, not the runtime message.

Expected: translate failed shared results at the Pi boundary, preserve their diagnostic text, and test the recorded runtime flag. Keep MCP's returned isError contract unchanged. This affects retry decisions and failure accounting.

Verification: both deterministic audit fixtures passed, including the throwing control. Existing content, Pi extension and MCP suites also passed, 127 tests. No production fix is included. Checked open and closed issues and PRs. No matching Pi failure-status report found.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions