feat(runtime): spill files 0600 via atomic write
This commit is contained in:
1 parent
87f77c76ba
commit
27fecf4588
1 file changed
+2
-1
+2
-1
@@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/sausheong/harness/llm"
|
"github.com/sausheong/harness/llm"
|
||||||
"github.com/sausheong/harness/session"
|
"github.com/sausheong/harness/session"
|
||||||
|
"github.com/sausheong/harness/tool"
|
||||||
)
|
)
|
||||||
|
|
||||||
// defaultMaxToolResultLen is the fallback cap used when LoopConfig.MaxToolResultLen
|
// 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)
|
return "", fmt.Errorf("spill mkdir: %w", err)
|
||||||
}
|
}
|
||||||
path := filepath.Join(dir, toolCallID+".txt")
|
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 "", fmt.Errorf("spill write: %w", err)
|
||||||
}
|
}
|
||||||
return path, nil
|
return path, nil
|
||||||
|
|||||||
Reference in new issue
Block a user