fix(coding-agent): warn and exit non-zero in print mode on truncated response

Print mode now writes a warning to stderr and exits 1 when the final
response stopped at the model's output token limit. The partial text
is still written to stdout.

fixes #10799
This commit is contained in:
David Brailovsky 2026-10-12 16:06:29 +02:00
parent 39badde840
commit 441f5767c4
4 changed files with 19 additions and 1 deletions

View file

@ -27,7 +27,7 @@ pi --print "Summarize the changes in this repository"
Use print mode when only the final text is needed, including command substitution, pipelines, and one-shot jobs. Intermediate events are not exposed.
Print mode writes errors to stderr. A final assistant response with an `error` or `aborted` stop reason produces a nonzero exit status.
Print mode writes errors to stderr. A final assistant response with an `error` or `aborted` stop reason produces a nonzero exit status. A response cut off at the model's output token limit (`length` stop reason) still prints its partial text to stdout, writes a warning to stderr, and produces a nonzero exit status.
When no mode is selected explicitly, non-TTY stdin or stdout also selects print mode. This allows piped input and output without adding `--print`.