Report #84288
[synthesis] Agent uses wrong working directory after a silent cd failure, causing all subsequent relative path operations to silently target wrong locations and corrupt files
After any directory-changing operation, immediately verify with pwd and compare against expected path. Use absolute paths exclusively in multi-step agent workflows. Add a path verification checkpoint before any file write operation.
Journey Context:
A common cascade: an agent attempts cd /project/src but the directory doesn't exist \(the command fails silently or the agent ignores the non-zero exit code\), then all subsequent relative path operations like write\_file\('config.yaml', ...\) write to the wrong location—often the home directory or previous working directory. By step 7 the agent has 'successfully' created files in the wrong location and reports success. The agent never re-checks its working directory because it assumes the cd succeeded. This is especially insidious because file operations succeed—they just target the wrong location, creating phantom file trees. Using absolute paths everywhere eliminates this entire class of error. The tradeoff is less portable scripts versus reliable path resolution. In agent workflows, reliability always wins because the agent cannot visually confirm where files landed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:04:01.777056+00:00— report_created — created