fix /agents reporting Length=0 in stat (FUSE never reads)

makeStat had explicit Length computation for /backends, /models, /help
but not /agents. Replace the specific cases with a generic default that
reads any root-level file via rootStore. /help keeps its os.Stat path
since the rootStore readFn reads the whole file (expensive for large help).
This commit is contained in:
Levi Neely 2026-07-30 00:20:26 +02:00
parent ac494b50b4
commit 01fbf12fc5
1 changed files with 5 additions and 6 deletions

View File

@ -1266,12 +1266,6 @@ func (s *Server) makeStat(path string) plan9.Dir {
if content, err := readFile(s.sessionTree, base); err == nil { if content, err := readFile(s.sessionTree, base); err == nil {
dir.Length = uint64(len(content)) dir.Length = uint64(len(content))
} }
case path == "/backends":
dir.Length = uint64(len(strings.Join(backend.Backends(), "\n") + "\n"))
case path == "/models":
if content, err := readFile(s.rootStore, "models"); err == nil {
dir.Length = uint64(len(content))
}
case path == "/help": case path == "/help":
if info, err := os.Stat(s.helpPath()); err == nil { if info, err := os.Stat(s.helpPath()); err == nil {
dir.Length = uint64(info.Size()) dir.Length = uint64(info.Size())
@ -1284,6 +1278,11 @@ func (s *Server) makeStat(path string) plan9.Dir {
dir.Length = uint64(len(data)) dir.Length = uint64(len(data))
} }
} }
default:
// Root-level files (agents, backends, models, etc.)
if content, err := readFile(s.rootStore, base); err == nil {
dir.Length = uint64(len(content))
}
} }
} }