Affected Component
- Agent Tools / Terminal (
file/write_file)
Describe the bug
The file tool with action=write (or inferred write) reports success when content is empty:
// backend/pkg/tools/terminal.go — WriteFile
return fmt.Sprintf("Successfully wrote %d bytes to %s", len(content), path), nilEmpty content is a common LLM failure mode (wrong arg name, omitted body, truncated JSON). The agent then treats the write as done and never retries with real content — leaving a 0-byte artifact on disk.
Inference already maps omitted action + empty content → read, but an explicit write with empty content still creates a 0-byte file and returns success.
Observed: FarVision WSL DinD trial on vxcontrol/pentagi:latest (rev around hcffed94 / Hub digest ~2026-10-22). In a 7-day window, 36 file toolcalls returned Successfully wrote 0 bytes (flows 20/22 among others). Host /work is RW and shell/heredoc writes work — this is not a disk/permission issue.
Expected
- Reject empty-content writes with a clear error (force agent retry / fixer), or
- Treat empty content as failure in
WriteFilebeforeCopyToContainer, or - Require non-empty
contentin the tool schema + validator (and keep inference for omitted action).
Steps to Reproduce
- Run a flow with a sandbox terminal.
- Invoke
filewith{"action":"write","path":"/work/probe.txt","content":""}(or omitcontent). - Observe: tool result
Successfully wrote 0 bytes to /work/probe.txt; file exists with size 0; agent may stop without retrying.
Workaround (operators)
Prefer terminal/cat heredoc for critical artifacts; re-prompt when DB/toolcalls show Successfully wrote 0 bytes.
System Configuration
- PentAGI Version:
vxcontrol/pentagi:latest(~2026-10-22) - Deployment Type: Docker Compose (DinD / WSL trial)
- Host OS: Linux (WSL2)
Verification
- I have checked that this issue hasn't been already reported (searched
write_file/0 bytes/Successfully wrote— no matching open issue as of 2026-10-26) - I have included relevant logs and error messages
- I am running a recent
vxcontrol/pentagi:latest
Strong +1 on this. Silently succeeding empty writes are a classic failure amplifier: the agent believes the artifact exists and moves on, and the 0-byte file only surfaces later when a downstream step reads it. Making WriteFile return an explicit error ("refusing to write empty content") forces the retry/fixer loop to engage immediately, and a non-empty validator in the tool schema catches it even earlier. Given the reported 36 occurrences in a 7-day window, this is clearly not a rare edge case. I'd suggest rejecting empty content inside WriteFile itself (before CopyToContainer) as the single choke point shared by explicit and inferred writes, so both paths fail consistently.