[Bug] virtiofs mount serves truncated file contents to sandboxed environment while host files are clean
Bug Description
Summary: Cowork's virtiofs mount served stale/truncated file contents to the sandboxed Linux environment while the host Windows disk was clean. Git-level tools inside the sandbox reported the working tree as modified, files ended mid-statement, and python -m py_compile raised SyntaxError — all on files that were verified clean and matching HEAD from the host's PowerShell.
Repro:
On Windows, place a git repo with ~1000-line Python files in a user folder (e.g., C:\Users\<you>\Documents\<repo>).
Select that folder in Cowork; Cowork mounts it at /sessions/<id>/mnt/<name> via virtiofs.
In the sandbox, run against a specific file:
wc -c <file> — reports a byte count smaller than the host's.
git hash-object <file> — returns a SHA different from git ls-tree HEAD <file>.
git diff HEAD -- <file> — shows large deletions that don't exist on the host.
python -m py_compile <file> — fails with SyntaxError at the truncation boundary.
In host PowerShell, the same commands report the file as clean, hash matches HEAD, compiles cleanly.
Key detail that made the bug hard to diagnose: the .git/index mtime did reflect live host activity inside the sandbox — so a standard "is the mount stale?" check passed. The staleness was selective to specific working-tree files, not the whole mount. This allowed two Claude sessions with different views of the same path to argue past each other across multiple rounds.
Impact: If a user asks Claude inside Cowork to run a build/publish command (twine upload, npm publish, docker build) against a folder with this discrepancy, Claude would package the corrupted sandbox view and ship it to a public registry. This nearly happened on the cloakllm v0.6.3 release.
Error message:
$ python3 -m py_compile server.py
File "server.py", line 731
"""
^
SyntaxError: unterminated triple-quoted string literal (detected at line 735)
EXIT=1
(file on host disk was 38,869 bytes, ended cleanly with if __name__ == "__main__": mcp.run(); sandbox view was 30,917 bytes, truncated mid-docstring)
Environment:
Windows host: [put your Windows version here]
Mounted path: C:\Users\97250\Documents\cloakllm
Sandbox path: C:\Users\97250\Documents\cloakllm
Filesystem: virtiofs via fuse
Claude desktop app version: [from Help → About or equivalent]
Session type: Cowork mode
Workaround: always run publish/build commands from the host terminal, not from Claude inside Cowork, until this is resolved. Restarting the Cowork session may re-sync the mount, but I didn't get to verify.
Environment Info
- Platform: win32
- Terminal: vscode
- Version: 2.1.110
- Feedback ID: bf22aca8-f73d-40b4-8b13-05300c956cb8
Errors
[]This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗