Skip to content

bridge fs: Stats.isDirectory() derives from mode bits only, ignoring the explicit is_directory flag from the host #1839

Description

@atsushi-ishibashi

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions