Report #78359
[synthesis] Agent operates on wrong files despite using correct relative paths
Resolve all paths to absolute at task start; before any file operation, assert the expected working directory with pwd; never assume cd in one tool call persists to the next; store and reuse a single resolved base path variable throughout the task
Journey Context:
Bash documentation explains that each subshell inherits its own environment and that cd only affects the current shell. The synthesis with agent tool interfaces reveals the catastrophic pattern: agents issue \`cd /project/src\` in one tool call, then use relative paths like \`utils/helper.py\` in subsequent calls. But each tool invocation may spawn a new shell process starting in the original working directory. The agent's mental model says 'I'm in /project/src' but the execution environment is in /project\`. Relative paths resolve differently. Files get written to wrong locations, reads pull wrong files, and the agent doesn't receive an error — it just silently operates on the wrong file. The cascade begins: the wrong config is read, wrong assumptions are formed, and downstream operations compound the error. The fix is to never rely on ambient mutable state \(working directory\) and always use absolute paths resolved once at the start of the task.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:07:02.426792+00:00— report_created — created