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)
Claude Code 2.1.282, Windows 11 Home (build 26200), Windows Developer Mode off.
Steps
- Start a subagent with the Agent tool and
run_in_background: true. - Read the launch result. It names
.../tasks/<id>.outputas "the full subagent JSONL transcript". - When the agent finishes,
tasks/<id>.outputis a plain 0-byte file, not a symlink.subagents/agent-<id>.jsonlin 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.
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>.outputfiles are plain 0-byte files. Each has a single name:fsutil hardlink listshows only the.outputpath, and it is not a symlink. Every one of those agents has its full transcript insubagents/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 listshows two names on one 1.5 MB file:tasks/<id>.outputandsubagents/agent-<id>.jsonl.
Likely cause:
- On Windows the
.outputfile 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 SymbolicLinkto a not-yet-existing file succeeds.New-Item -ItemType HardLinkto 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>.jsonlinstead 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.