Skip to content

Pi-backed Guided Review masks insufficient-credits errors as guide parse failures #1037

Description

@alexanderkreidich

Summary

When a Pi-backed Guided Review uses an API model whose account has no remaining credits, the provider error is not surfaced. Instead, Plannotator reports a misleading guide parsing failure:

[guide] Failed to parse output for job c5fa951f-1e32-4585-986a-67cd462960df

The same behavior was observed previously with job 49318521-4030-425d-8c60-c8d15499eb4e.

Reproduction

  1. Configure an API-backed Pi model on an account with no remaining API credits.
  2. Open a pull request using /plannotator-review.
  3. Open Guided Review.
  4. Select the Pi engine and the no-credits API model.
  5. Generate the guide.

Tested with:

  • @plannotator/pi-extension 0.22.0
  • Pi 0.80.6
  • Guide engine: Pi
  • Model: codex-proxy/openai/gpt-5.5
  • Thinking: medium

Actual behavior

The provider rejects the request because the account has no credits, but the visible/logged failure is:

[guide] Failed to parse output for job <uuid>

The underlying insufficient-credits error is lost, and the failure appears to be malformed guide JSON.

Expected behavior

The job should fail with the original provider error, for example:

Insufficient API credits

Plannotator should not attempt to parse guide JSON after the underlying agent run has already failed.

Technical diagnosis

The relevant flow appears to be:

  1. Pi is launched in JSON mode by the marker-engine integration.
  2. pi --mode json can exit with code 0 even when the agent run itself errors or is aborted. This behavior is already documented in piBuildArgv() in packages/server/marker-review.ts.
  3. Because the process exit code is 0, the agent-job handler invokes Guided Review result ingestion.
  4. The failed agent produced no complete nonce-delimited guide JSON block.
  5. parseGuideMarkerOutput() returns null, and createGuideSession().onJobComplete() logs the generic parsing failure.

A normal replay using the same Pi/model configuration successfully produced a valid marker block, so this is error propagation for the no-credits path rather than a general Pi/Guide parser incompatibility.

Suggested regression coverage

Add a Pi NDJSON fixture where:

  • the process exit code is 0;
  • the assistant/provider event contains an error or error stop reason;
  • no marker-delimited output exists.

Assert that the job surfaces the provider error and does not report Failed to parse output. The same handling may be relevant to Pi-backed code review jobs in addition to Guided Review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions