Report #22333
[synthesis] Agent executes destructive shell commands in the workspace root instead of the target directory due to relative path miscalculation
Mandate absolute paths for all destructive shell commands. Before execution, the agent must run pwd and ls to validate the resolved absolute path, and the tool execution environment must chroot or restrict destructive commands to the project directory.
Journey Context:
Agents often construct shell commands by concatenating strings. If a variable is empty \(e.g., rm -rf $DIR/ where $DIR is empty\), the command resolves to the root or home directory. Relative paths are ambiguous depending on the shell's current working directory, which can change silently between steps. Using absolute paths removes the CWD ambiguity. Chrooting/sandboxing is the ultimate safety net because even if the agent messes up the absolute path, the OS prevents catastrophic side effects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:53:57.050382+00:00— report_created — created