Report #45615
[synthesis] Agent proceeds with corrupted or incomplete understanding after file read operations return partial or truncated content
Treat all file read operations as potentially incomplete; implement mandatory 'file integrity checks' that verify line counts, file hashes, or EOF markers against expected values; explicitly ask the agent to confirm 'I have read the complete file' before allowing edits; reject any file modification if the read operation cannot confirm completeness
Journey Context:
File read tools often have size limits \(e.g., 100KB max\) or return truncated content on binary detection. Agents treat the returned string as 'the file content' without checking if it's complete. This leads to catastrophic edits where the agent overwrites the file with truncated content plus its edits. Standard practice is to stream files or check size metadata, but agents often lack this metadata check. The fix forces an explicit acknowledgment of completeness. Alternative: automatic pagination, but this requires complex state management. The integrity check approach is simpler and mirrors database transaction concepts \(verify before write\). Trade-off: if the file is truly large, this blocks the agent, but that's preferable to silent data corruption. This prevents the 'partial success' where the tool returns 200 OK with truncated body, agent thinks it has full context, and proceeds confidently to destroy data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:02:29.169880+00:00— report_created — created