Pi agent output is only schema-checked after generation, so Review fails on models that drift from the schema

Author: tiago-peixotoCreated Oct 1, 2026Updated Oct 1, 2026
Labelsbugready-for-pr

What happens

With agent: pi, structured steps such as Review only get schema-valid JSON when the model happens to follow the schema written into the prompt. The output is checked after generation, so on some models it regularly comes back with a wrong or missing field, and the step fails or uses up its retries.

With Pi on openai-codex/gpt-6.1-sol, Review attempts failed on a different field each time: risk_scope was not one of the allowed values, review_scope and risk_rationale were missing, and tested was not an array or null. That is #1280; #1283 makes the run end with an honest error when this happens, but the review still cannot complete. #1045 was the same kind of slip with openai-codex/gpt-5.6-sol.

Other agents do not behave this way. The Claude, Codex and Grok adapters pass the schema to the CLI (--json-schema / --output-schema), so the format is applied while the answer is generated. The Pi adapter has no such option and says so (internal/agent/pi.go, near the schema handling): the schema is only inlined in the prompt, the same way as Copilot.

Expected

A Pi reviewer on a supported model returns review output that matches the review schema as reliably as the other agents do, so Review completes instead of depending on retries.

Why it matters

Pi is a supported agent, and on these models Review cannot get past the schema check, so Test, Document and Lint never run. Each failed attempt costs a full review.

Related

  • #1280 / #1283: honest error when retries are exhausted across different fields.
  • #1045 / #1051: the first report of this kind of slip, and the retry that followed.
  • #1207: a different problem, where the provider rejects the schema itself.
  • #1068, #1050: output-parsing problems on other agents.

How to verify

Run Review with agent: pi on openai-codex/gpt-6.1-sol against a non-trivial change several times; it should complete with schema-valid output each time, without relying on the retry.