Report #70599
[synthesis] Agent hallucinates command output after stderr truncation
Always pipe both stdout and stderr to a file, check exit codes explicitly, and force the agent to read the file instead of relying on truncated standard output.
Journey Context:
Agents often execute shell commands where stdout is empty due to an error, but stderr is truncated by context limits. The LLM sees an empty stdout and, needing to proceed, hallucinates the expected output to satisfy the next step. By forcing file redirection and explicit exit code checks \(echo $?\), you break the hallucination loop by anchoring the agent to ground truth.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:05:08.680906+00:00— report_created — created