claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Background Agent .output file is 0 bytes on Windows without Developer Mode, while the launch result calls it "the full subagent JSONL transcript" (still in 2.1.282; follows #55263)

Open corpus-folk opened this issue 2 months ago • 1 comments

Claude Code 2.1.282, Windows 11 Home (build 26200), Windows Developer Mode off.

Steps

  1. Start a subagent with the Agent tool and run_in_background: true.
  2. Read the launch result. It names .../tasks/<id>.output as "the full subagent JSONL transcript".
  3. When the agent finishes, tasks/<id>.output is a plain 0-byte file, not a symlink. subagents/agent-<id>.jsonl in the session folder holds the full transcript (hundreds of KB).

Expected

Either the output file reads as the transcript (a hardlink or copy when a symlink cannot be made), or the launch text says the file may be empty and names the transcript path.

Notes

#55263 found the cause: symlink creation fails without Developer Mode, and the CLI falls back to an empty file. That issue was auto-closed as stale and is now locked. We see the same on 2.1.282, across two sessions and every background child in them. The final report still reaches the parent, so the harm is to anything that follows the launch text to the file.

corpus-folk avatar Sep 25 '26 03:09 corpus-folk

Same on 2.1.303, Windows 11 Pro build 26300, with Developer Mode on (AllowDevelopmentWithoutDevLicense = 1), so Developer Mode is not the whole story.

One session with 17 background agents:

  • 16 of 17 tasks/<id>.output files are plain 0-byte files. Each has a single name: fsutil hardlink list shows only the .output path, and it is not a symlink. Every one of those agents has its full transcript in subagents/agent-<id>.jsonl (273 KB to 1.4 MB).
  • The one that works is a hard link. It belongs to the agent that was later resumed with SendMessage. fsutil hardlink list shows two names on one 1.5 MB file: tasks/<id>.output and subagents/agent-<id>.jsonl.

Likely cause:

  • On Windows the .output file is made as a hard link to the transcript. A hard link needs an existing target, and at spawn time the transcript has not been written yet. The link fails and an empty placeholder is left.
  • On resume the transcript exists, so the link succeeds.
  • Checked on this machine:
    • New-Item -ItemType SymbolicLink to a not-yet-existing file succeeds.
    • New-Item -ItemType HardLink to one fails ("Could not find item").

Possible fixes, any one of these:

  • create the link after the transcript's first write;
  • prefer a symlink where it can be made, and use a hard link only once the target exists;
  • if the link failed, have the launch result name subagents/agent-<id>.jsonl instead of promising the transcript at .output.

Impact: anything that follows the launch text to the file reads nothing. Our workaround is to read subagents/agent-<id>.jsonl directly, or to have the subagent write its result to a file itself.

BorisDaich avatar Oct 19 '26 07:10 BorisDaich