fix: resolve test failures on Linux

- Wrap hostFs.ReadDir error to include "failed to read directory" prefix,
  matching the assertion in TestFilesystemTool_ListDir_NotFound
- Replace shell command substitution in TestExecTool_Bg_RingBufferOverflow
  to avoid triggering denyPatterns safety guard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-02-24 02:52:01 +09:00
parent 2c00e4537f
commit 36b4863ce0
2 changed files with 6 additions and 2 deletions

View file

@ -273,7 +273,11 @@ func (h *hostFs) ReadFile(path string) ([]byte, error) {
}
func (h *hostFs) ReadDir(path string) ([]os.DirEntry, error) {
return os.ReadDir(path)
entries, err := os.ReadDir(path)
if err != nil {
return nil, fmt.Errorf("failed to read directory: %w", err)
}
return entries, nil
}
func (h *hostFs) WriteFile(path string, data []byte) error {

View file

@ -844,7 +844,7 @@ func TestExecTool_Bg_RingBufferOverflow(t *testing.T) {
if runtime.GOOS == "windows" {
cmd = "1..2000 | ForEach-Object { Write-Output ('x' * 50) }; Start-Sleep -Seconds 30"
} else {
cmd = "for i in $(seq 1 2000); do echo $(head -c 50 /dev/zero | tr '\\0' 'x'); done; sleep 30"
cmd = "yes 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | head -n 2000; sleep 30"
}
result := tool.Execute(context.Background(), map[string]any{