ovis icon indicating copy to clipboard operation
ovis copied to clipboard

File viewer: a bare file name is not found when a large folder comes first in the pane's folder

Open bricks-8 opened this issue 1 month ago • 0 comments

What happened

A file named without its folders (11_two-version-design.md, as an agent writes it in a code span or a sentence) opens with "no readable file at that path" in a repository that also holds a large folder of generated files, although the file is right there under the pane's folder.

The pane's folder is a git repository with about 27,000 entries in all. One folder of experiment results under apps/ holds about 13,000 of them. The file is tracked, at docs/architecture/<…>/11_two-version-design.md.

locateFile falls back to filesNamed for a bare name, and filesNamed walks the folder (walkFiles in server/files.ts). The walk stops at MAX_ENTRIES (5,000) entries counted across the whole tree, in name order, so the results folder under apps/ takes 4,685 of them and the budget is gone before the walk reaches docs/. The git inventory that paneFiles uses would have the file, but filesNamed walks instead, so it can also see ignored files (build output, recordings).

Steps:

  1. In a git repository, add a folder that sorts before docs/ and holds more than 5,000 files, ignored or not (a-data/, ignored, in the test below).
  2. Commit docs/design/11_two-version-design.md.
  3. Open the repository in a pane and open 11_two-version-design.md from the chat (a code span naming it) or through /api/fs/stat?path=11_two-version-design.md&pane_id=….
  4. The viewer says there is no readable file at that path. docs/design/11_two-version-design.md opens.

A fix on a fork reads the git inventory first (git ls-files -co --exclude-standard, synchronously, as locateFile is synchronous) and adds the walk after it, so ignored files are still found within the walk's bounds. It comes with a test that builds the case above and fails without the change: https://github.com/bricks-8/herdr-web-ui/tree/fix/file-name-lookup-git-first

Happy to open it as a PR.

How often

Every time, in that repository.

herdr web ui version

0.4.8

How it runs

herdr plugin

Server PC

macOS (Mac mini), herdr 0.9.4

Device and browser

Not device specific: the lookup runs on the server.

How the device reaches the server

Tailscale (tailscale serve)

bricks-8 avatar Oct 15 '26 11:10 bricks-8