[Bug] Agent unsafe shell execution allows destructive commands and session state corruption
Resolved 💬 4 comments Opened Mar 14, 2026 by danielkov Closed Apr 12, 2026
Bug Description
whole CLI, the agent, everything bugged to hell. First the sub-agent decided to rm -rf the root directory where the session was running from (surely you can protect against this?) Then it attempted to recover, but your session refresh logic is broken, so it signed me out mid-way through. Once signed back in, the main session's CWD was switched (why is this possible?) to a now deleted worktree directory, so all commands the agent attempts to run fail.
Environment Info
- Platform: darwin
- Terminal: ghostty
- Version: 2.1.76
- Feedback ID: 6a8dcc7a-a9b9-49a1-9f57-b5d6fb4181d8
Errors
[{"error":"Error: File does not exist. Note: your current working directory is /Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a17db7d6.\n at call (/$bunfs/root/src/entrypoints/cli.js:1524:6510)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:33.220Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a17db7d6\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:36.833Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a17db7d6\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:40.885Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a1e9d2b2\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:41.585Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a17db7d6\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:45.909Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a1e9d2b2\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:45.962Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a372989d\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:50.150Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a1e9d2b2.\n at call (/$bunfs/root/src/entrypoints/cli.js:1524:6510)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:50.438Z"},{"error":"Error: Path \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a372989d\" does not exist\n at m3 (/$bunfs/root/src/entrypoints/cli.js:1478:3503)\n at kF7 (/$bunfs/root/src/entrypoints/cli.js:3216:236)\n at call (/$bunfs/root/src/entrypoints/cli.js:3216:3585)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:54.211Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a372989d\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:54.599Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a1e9d2b2\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:54.995Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a5b37a37\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:57.183Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug/.claude/worktrees/agent-a17db7d6\" no longer exists. Please restart Claude from an existing directory.\n at call (/$bunfs/root/src/entrypoints/cli.js:6429:1172)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-03-14T22:10:58.048Z"},{"error":"Error: Working directory \"/Users/danielkov/projects/ticketplug…
Note: Content was truncated.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗