OneDrive-backed workspaces silently truncate files on write (Cowork)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
- OS: Windows 11
- Workspace location: OneDrive-synced folder (
C:\Users\...\OneDrive\Documents\Obsidian\) - Cowork version: 2.1.87
Description
Files written or updated by Cowork (via Write/Edit tools) are silently truncated when the file grows in size. No error is thrown. The mounted file ends mid-sentence with no closing newline on subsequent sessions.
Steps to Reproduce
- Mount a OneDrive-synced folder as a Cowork workspace
- Have Claude write or update a file that grows in size from its previous version (e.g., appending content to an existing context file)
- End the session
- Start a new session and read the same file
Observed Behavior
- File on the Cowork mount ends mid-sentence with no closing newline
cat -Aon the mounted file confirms no trailing$(no newline) at endwc -lvsawk NRline count discrepancy confirms truncation- No error was thrown during the write operation — the Write tool reported success
- The local Windows copy (viewed in Obsidian) appears complete, suggesting a sync discrepancy between the OneDrive source and the Cowork mount
Expected Behavior
Write operations should either complete fully or fail with a visible error. Silent partial writes that report success are dangerous — subsequent sessions treat the truncated file as the canonical version.
Additional Context
This appears related to OneDrive's Files On-Demand / Cloud Files API behavior with the virtiofs/Plan 9 mount protocol used by Cowork's Linux sandbox. When a file grows during a write, the OneDrive layer may not correctly extend the allocation, resulting in the write being silently clipped to the original file size.
Related issues: #40231 (silent skill file truncation), #29153 (.claude.json corruption cascade on OneDrive), #30928 (EEXIST on OneDrive directories)
What Should Happen?
Write operations should either complete fully or fail with a visible error. Silent partial writes that report success are dangerous — subsequent sessions treat the truncated file as canonical. At minimum, Cowork should detect when a write results in a file smaller than the intended content and surface an error to the user.
Error Messages/Logs
Steps to Reproduce
- Mount a OneDrive-synced folder (e.g.,
C:\Users\...\OneDrive\Documents\) as a Cowork workspace - Have Claude write or update an existing file such that the new content is larger than the previous version (e.g., appending new sections to a context file like
CLAUDE.md) - End the Cowork session
- Start a new session and read the same file using the Read tool or
cat -A
Result: The file ends mid-sentence with no trailing newline. The Write tool reported success during the write. wc -c on the mounted file confirms it is smaller than the content that was written. cat -A shows no $ at the end of the last line, confirming no closing newline and an abrupt truncation.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.87 (Cowork)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗