Report #73628
[synthesis] Agent assumes shell command succeeded based on exit code 0 but operates in an unintended environment state
Augment tool execution wrappers to capture and expose critical implicit state variables \(e.g., git branch, pwd, python env\) alongside the stdout/stderr, and validate state predicates post-execution, not just exit codes.
Journey Context:
Agents rely on exit codes to determine success. However, commands like git checkout can return 0 while leaving the repo in a detached HEAD state. Subsequent commits are then lost or applied to an orphaned tree, causing silent failure. The common mistake is treating the shell as a purely functional API where exit code 0 equals desired state. The tradeoff is adding latency by running state-checking commands vs. flying blind. The right call is injecting lightweight state assertions into the tool wrapper, because an agent cannot recover from committing to a detached HEAD if it doesn't know it's detached.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:10:43.266764+00:00— report_created — created