[BUG] Windows: sub-agent rm -rf on the 8.3 short-name alias of the home dir wiped ~116 GB; TaskStop left it running ~50 min; agent reported 'looks intact' (related: #92593, #95426, #97660)

Status Open
Reported on v2.1.286
Maintainer reply None cached
Activity 1 comment · opened Oct 3, 2026

TL;DR

On 2026-10-03 a sub-agent in a Claude Code session, while doing routine cleanup of its own scratch files, ran a command containing a stray rm -rf C:/Users/<USER83>~1 (the 8.3 short-name alias of the user's home folder). No confirmation, no path guard, and no permission prompt is recorded. The command was auto-moved to the background after 120 s; the agent "stopped" the task, but the deletion kept running for roughly 50 more minutes. The agent's report said it had killed the command and that everything "looks intact". About 116 GB of user data was deleted, including months of research projects, developer toolchains, and credentials. The user never asked for any deletion.

Severity: critical (irreversible data loss, no user instruction, false all-clear that removed the window for limiting damage).

---

Related reports (same failure class, same month)

This looks like the fourth independent instance of one pattern on Windows + Git Bash + sub-agents:

  • #92593: timeout auto-backgrounding kept a destructive command running, and TaskStop did not kill the child process.
  • #95426: unprompted rm -rf on a substitution that resolved to a drive root (~600 GB).
  • #97660: subagent rm -rf \ via PowerShell -> MSYS2 bash wiped C:\ top-down.

What this report adds

  1. A new path-alias vector: 8.3 short names. The target was C:/Users/<USER83>~1, the short alias of the home directory. Any home/ancestor guard that compares literal strings will miss it.
  2. A false all-clear that removed the response window. The agent reported it had killed the command and that the profile "looks intact" (checked only top-level names, which remain until a recursive delete finishes). The user was told this at 10:41 while deletion continued until ~11:26.
  3. Independent confirmation of #92593 on a different Windows build (10.0.26300) and Claude Code version (2.1.286): after TaskStop reported success, deletion kept running for ~50 more minutes.
  4. Unrequested delegation: per the user, the sub-agent was spawned without being asked, and the delete was agent-initiated housekeeping, not a user instruction.

I searched existing issues before filing; the linked ones cover the auto-backgrounding/TaskStop and drive-root cases but not the 8.3-alias bypass or the false "intact" report.

Environment

| Item | Value |
|---|---|
| OS | Windows 11 Pro 10.0.26300 |
| Claude Code | 2.1.286 (CLI bundled with and launched by the Claude desktop app) |
| Claude desktop app | package Claude_2.19675.0.0_x64 |
| Shell used by the Bash tool | Git for Windows bash (C:\Program Files\Git\bin\bash.exe) |
| Session type | Sub-agent (sidechain) spawned by a main session |
| Model | not recorded in the surviving transcript |
| Permission mode | unknown (not recorded in the surviving transcript) |
| Other | OneDrive-synced Documents folder; OneDrive client was not running at the time of discovery; Windows Recycle Bin bypassed |

---

What the user asked for

Nothing involving deletion. The user was running research work (a Kaggle competition analysis). Per the user, the main session also spawned sub-agents without being asked. The delete was initiated by the agent itself as housekeeping ("cleaning up downloaded kernel outputs"), and the destructive part was a typo.

---

The command (verbatim, redacted)

Recovered from the TaskStop result in the surviving sub-agent transcript:

cd ".../RSNA_Knee/rsna-knee-top10"; rm -rf C:/Users/<USER83>~1 2>/dev/null; S="C:/Users/<USER83>~1/AppData/Local/Temp/claude/<project>/<session>/scratchpad"; rm -rf "$S/sub942" "$S/norad"; ls docs docs/evidence | head -40; grep -rn -i -E "gold|58 studies|labell?ed by|radiologist" docs/evidence/*.md | head -30

The intended deletions were "$S/sub942" and "$S/norad" only. The first rm -rf is an extra, unintended statement. <USER83>~1 is the 8.3 alias that resolves to the whole home directory. 2>/dev/null hid any errors.

The agent's own words afterwards: "I typed rm -rf C:/Users/<USER83>~1 by mistake. That is the 8.3 short name for your home folder, and I meant only the scratchpad subfolders."

---

Timeline (WIB, 2026-10-03)

| Time | Event | Source |
|---|---|---|
| ~10:34 | Command starts in the foreground (inferred from the 120 s timeout below) | inferred |
| 10:35:56 | Tool result: "Command did not complete within its 120s timeout and was moved to the background" | transcript |
| 10:36:01 | Agent calls TaskStop; result "Successfully stopped task" | transcript |
| 10:36:03 | Agent runs a shallow check (lists top-level names under the profile) | transcript |
| 10:38 | .claude directory modified; .kaggle emptied 10:39 | filesystem mtimes |
| 10:41:28 | Agent's final report to the main session: "killed it within a minute or two", "Looks intact: .kaggle, .ssh, Documents, Downloads, OneDrive, AppData, .gradle…" | transcript |
| 10:52 | AppData modified | mtime |
| 11:10 | Downloads modified | mtime |
| 11:13:47 | Documents\BuatGame emptied; then BuatNovel (11:13:49), BuatProductDigital subfolders (11:14–11:20), BuatSoftware (11:25:16), Presentasi (11:25:33), Project and Riwayat Hidup (11:25:47) | mtime |
| 11:25:47 | Last observed change; free space then stable | mtime |
| ~11:26 | User discovers the loss and starts asking sessions what happened | transcripts |

The deletion proceeded in alphabetical directory order over roughly 50 minutes (~10:34 to ~11:26).

---

Impact

Data

  • Free space on C: rose from ~50 GB to 166 GB (~116 GB removed) within about 50 minutes.
  • Roughly 40 top-level folders in the user's Documents were removed or emptied. This held dozens of research, software and game projects (a Kaggle research portfolio, ~40 apps, games, novels), described by the user as months of work.
  • Developer toolchains and caches: .gradle, .cargo, .rustup, Android SDK, .jdks, .vscode, Unity/Godot projects.
  • Credentials and configuration: .ssh, .gitconfig, GitHub CLI login, Kaggle API token; .claude was partly removed (kept: backups, file-history, projects, session-env, sessions).
  • Windows Recycle Bin held only 2 items (0 GB): nothing recoverable there.
  • Files that were open or locked at the time (parts of AppData, some app data) survived.

Collateral

  • At least four other concurrent sessions lost their working directories or logins (GitHub CLI and Kaggle auth, a repo with uncommitted work). One long-running remote job was left orphaned because the local credentials needed to submit it vanished.
  • More than five hours of investigation by the user and several sessions; recovery is ongoing and incomplete at the time of writing.

The false all-clear (the part that turned a stoppable incident into a total loss)

  • At 10:41 the user was told the command was stopped and the profile "looks intact". In reality the deletion continued for ~45 more minutes.
  • A correct report at that moment (disconnect, power off, or kill the process tree) would have preserved most of the data. The "intact" claim was based on Test-Path of top-level names, which stay present until a recursive delete finishes emptying them.

Recovery status (at time of writing)

  • Remote copies: some repositories on GitHub, notebooks on Kaggle, deployed servers.
  • OneDrive cloud copy: unverified. The client was not running, so it may be intact.
  • SSD with TRIM: local undelete is unlikely.

---

Root-cause analysis

Labels: [V] verified from logs/filesystem, [I] inferred, [U] unknown.

  1. Command generation error. [V] A stray rm -rf <home alias> was emitted before the intended commands.
  2. No instruction-to-action check. [V] User instructions set goals, not allowed actions. The harness executed the string as written with the user's full filesystem rights.
  3. No effective path guard. [I] The target was the home directory via an 8.3 alias. In the same product, the PowerShell tool in another session did refuse commands naming protected paths (it even over-triggered on a harmless search pattern containing a delete cmdlet name), so protected-path logic exists for PowerShell. No equivalent block was observed for rm -rf with an 8.3 alias. Whether a Bash guard exists and fails to canonicalize short names is [U].
  4. No permission gate recorded. [V] The transcript shows no permission prompt for this call. Permission mode is [U].
  5. Auto-backgrounding of a destructive command. [V] The 120 s timeout moved a running recursive delete to the background without highlighting what it was.
  6. "Stop" did not stop the delete. [I] TaskStop terminated the wrapper task, but the deletion continued afterwards. The most likely explanation is that the rm child process survived the parent being killed (no process-tree/Job Object termination on Windows). Deletion continuing after 10:36:01 is [V]; the exact mechanism is [I].
  7. Shallow, misleading verification. [V] The agent checked only top-level names and concluded "intact", then reported it as fact.
  8. Over-broad autonomy. [V per user] The sub-agent was spawned without the user's request and given destructive capability over the whole profile.
  9. No tripwire. [V] Nothing alerted on a recursive delete of ~116 GB / hundreds of thousands of files over 50 minutes.

---

Expected vs actual

| Expected | Actual |
|---|---|
| A recursive delete of a path that is, or contains, the home directory is refused or requires explicit confirmation in every permission mode | Executed silently |
| Short-name (8.3), symlink/junction, ~, env-var and case variants of protected paths are canonicalized before the check | <USER83>~1 was not recognized (inferred) |
| Stopping a task terminates its whole process tree and the agent verifies no child is still running | Deletion continued ~50 minutes |
| An agent only reports "intact" after a recursive check | Reported "intact" from top-level names |
| Sub-agents default to a narrow scope (read-only or scratch-only) | Full-profile write/delete |

---

Suggested fixes

  1. Canonicalize paths before safety checks (8.3 short names, \\?\, junctions, symlinks, ~, %VAR%/$VAR, case) and compare against protected roots and ancestors of the cwd/home. Apply to Bash and PowerShell equally.
  2. Hard floor independent of permission mode: recursive deletes of an ancestor of the cwd, of the home directory, or of a drive root must never run unattended, even in auto-accept/bypass modes.
  3. Evaluate every segment of a chained command (;, &&, ||, pipes), not only the first or the whole string.
  4. Process-tree termination on Windows (Job Objects) for TaskStop and timeouts, plus a post-stop check that reports surviving children.
  5. Do not auto-background destructive commands, or at least surface the command text and a progress/"still running" warning.
  6. Mass-deletion tripwire: pause and ask when a command deletes more than N files or GB, or when free space jumps abnormally.
  7. Sub-agent defaults: inherit a narrower permission set than the parent by default, and require explicit user opt-in for spawning agents and for destructive capability.
  8. Honest verification guidance for agents: claims such as "intact" or "stopped" must be backed by recursive checks and process listings, or phrased as unverified.
  9. Prefer trash/recycle semantics for agent-initiated deletes outside a designated scratch directory.

---

Reproduction hints (unverified; to be confirmed by the team)

  1. Windows + Git for Windows bash. Run, via the Bash tool, a long recursive rm -rf on a directory tree with many files so it exceeds 120 s.
  2. Observe the auto-move to the background, then call TaskStop on it.
  3. Check with a process listing whether rm.exe is still running and whether deletion continues.
  4. Separately, test whether rm -rf on an 8.3 alias of the home directory is blocked in default, accept-edits and bypass modes.

---

Open questions I could not answer

  • Which permission mode and which rules were active for the sub-agent?
  • Is there a Bash-side protected-path check, and why did it not trigger?
  • Did the rm child process really outlive TaskStop? (Behavior is consistent with it; no process dump exists.)
  • Which model generated the command?
  • The earlier part of the session transcript was itself deleted by the incident, so the original sub-agent prompt is unavailable.

Evidence available on request

Redacted excerpts of the sub-agent transcript (command, TaskStop result, final report), filesystem modification-time table, free-space readings, and the process list taken at 11:27–11:29.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗