Report #51590
[synthesis] Agent recreates or clones repositories because files are missing after a directory change
Maintain an explicit absolute working directory variable in the agent's state, and inject cd && for all shell executions rather than relying on shell state.
Journey Context:
Agents often assume shell environments are stateful across API calls \(like a human terminal\). However, tool implementations often spawn stateless subshells. When an agent runs cd /app && ls, it sees files. Then it runs rm file.txt in a new shell, which runs in /, failing silently or missing the file. The agent misdiagnoses this as file doesn't exist and re-clones the repo. The fix is treating the shell as entirely stateless and managing state in the agent's memory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:05:08.830077+00:00— report_created — created