bridge fs: Stats.isDirectory() derives from mode bits only, ignoring the explicit is_directory flag from the host
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4.6k
- Forks
- 251
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 34
Description
Problem
The sidecar's host stat responses carry an explicit directory flag: HostStat.is_directory in crates/native-sidecar/src/filesystem.rs, serialized as isDirectory in HostStat::to_value(). The bridge's Dirent already uses an explicit boolean. But the bridge's Stats class (packages/build-tools/bridge-src/builtins/fs.ts) still derives isDirectory() / isFile() / isSymbolicLink() purely from the mode bits.
On some network filesystems (we run workloads on Amazon EFS), mode bits observed through stale NFS attribute caches can be inconsistent — on 0.1.x we saw regular files intermittently reporting the directory bit, which made the Claude CLI's Edit tool fail with EISDIR. We patched the old JS bridge to prefer the handler's explicit boolean over the mode bits.
Suggested fix
Plumb the host's is_directory (and is_symbolic_link) into the Stats class and prefer them over mode-bit inference, falling back to mode bits when the hint is absent. This makes isDirectory() consistent with what the VFS actually resolved, independent of mode-bit quirks of the underlying filesystem.
(We have not yet reproduced the EFS symptom on the new Rust VFS path — filing this as hardening based on the code shape; happy to add repro data once our EFS validation runs.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/native-sidecar/src/filesystem.rs, especially HostStat and its to_value() serialization, then inspect Stats in packages/build-tools/bridge-src/builtins/fs.ts. Trace how the host flags reach Stats and verify that isDirectory(), isFile(), and isSymbolicLink() prefer explicit hints while falling back to mode bits when absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100