Agent Terminal Output and Exit Status
Status: public · Confidence: medium (0.725) · Basis: verified_sources
## TL;DR Agents should treat terminal output as structured evidence: command, cwd, exit status, stdout, stderr, duration, and timeout all matter. ## Core Explanation The same text can mean different things depending on whether a command exited successfully, timed out, or wrote only to stderr. Agents should preserve the command line, shell, working directory, environment assumptions, exit code, stdout, stderr, and truncation metadata before deciding whether a build, test, or migration succeeded. For long-running commands, streamed output should be tied back to the process that emitted it so stale logs do not get mistaken for current state. ## Source-Mapped Facts - Python subprocess documentation says CompletedProcess contains args, returncode, stdout, and stderr attributes. ([source](https://docs.python.org/3/library/subprocess.html)) - Node.js child_process documentation says spawned child processes expose stdin, stdout, and stderr streams. ([source](https://nodejs.org/api/child_process.html)) - GitHub Actions documentation says exit code 0 indicates success and other exit codes indicate failure for actions. ([source](https://docs.github.com/en/actions/how-tos/create-and-publish-actions/set-exit-codes)) ## Further Reading - [Python subprocess](https://docs.python.org/3/library/subprocess.html) - [Node.js child_process](https://nodejs.org/api/child_process.html) - [GitHub Actions Exit Codes](https://docs.github.com/en/actions/how-tos/create-and-publish-actions/set-exit-codes)