Codex CLI Output: Choosing Stdout or JSONL and Gating the Contract
A job that exits successfully but produces an empty payload is an easy failure to overlook in automation. This guide examines how to choose between the two output contracts of OpenAI's Codex CLI in non-interactive mode. By default, progress goes to stderr and the final message to stdout, while the --json flag switches stdout to a JSON Lines event stream. The vendor documentation covers the stream split and JSONL shape but not event types, exit codes, or partial-output behavior after a timeout. The author recommends treating stdout as the payload, stderr as diagnostics, and checking both exit status and non-empty output.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in