feat(runtime): spill files 0600 via atomic write

This commit is contained in:
sausheong committed 2026-06-13 00:53:22 +08:00
1 parent 87f77c76ba
commit 27fecf4588
1 file changed
+2 -1
+2 -1
View File
@@ -11,6 +11,7 @@ import (
"github.com/sausheong/harness/llm"
"github.com/sausheong/harness/session"
"github.com/sausheong/harness/tool"
)
// defaultMaxToolResultLen is the fallback cap used when LoopConfig.MaxToolResultLen
@@ -433,7 +434,7 @@ func spillToolResult(cfg spillConfig, toolCallID, content string) (string, error
return "", fmt.Errorf("spill mkdir: %w", err)
}
path := filepath.Join(dir, toolCallID+".txt")
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
if err := tool.WriteFileAtomic(path, []byte(content), 0o600); err != nil {
return "", fmt.Errorf("spill write: %w", err)
}
return path, nil