Merge branch 'sipeed:main' into reasoning-chnl

This commit is contained in:
Avisek Ray authored and GitHub committed 2026-02-27 14:50:14 +05:30
commit b1a6b3898d
28 files changed
+369 -200

No files matched your search

+4 -7
View File
@@ -4,10 +4,11 @@ import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"sync/atomic"
"github.com/caarlos0/env/v11"
"github.com/sipeed/picoclaw/pkg/fileutil"
)
// rrCounter is a global counter for round-robin load balancing across models.
@@ -640,12 +641,8 @@ func SaveConfig(path string, cfg *Config) error {
return err
}
dir := filepath.Dir(path)
if err := os.MkdirAll(dir, 0o755); err != nil {
return err
}
return os.WriteFile(path, data, 0o600)
// Use unified atomic write utility with explicit sync for flash storage reliability.
return fileutil.WriteFileAtomic(path, data, 0o600)
}
func (c *Config) WorkspacePath() string {
+4 -4
View File
@@ -210,8 +210,8 @@ func TestDefaultConfig_WorkspacePath(t *testing.T) {
func TestDefaultConfig_Model(t *testing.T) {
cfg := DefaultConfig()
if cfg.Agents.Defaults.Model == "" {
t.Error("Model should not be empty")
if cfg.Agents.Defaults.Model != "" {
t.Error("Model should be empty")
}
}
@@ -331,8 +331,8 @@ func TestConfig_Complete(t *testing.T) {
if cfg.Agents.Defaults.Workspace == "" {
t.Error("Workspace should not be empty")
}
if cfg.Agents.Defaults.Model == "" {
t.Error("Model should not be empty")
if cfg.Agents.Defaults.Model != "" {
t.Error("Model should be empty")
}
if cfg.Agents.Defaults.Temperature != nil {
t.Error("Temperature should be nil when not provided")
+3 -3
View File
@@ -13,10 +13,10 @@ func DefaultConfig() *Config {
Workspace: "~/.picoclaw/workspace",
RestrictToWorkspace: true,
Provider: "",
Model: "glm-4.7",
MaxTokens: 8192,
Model: "",
MaxTokens: 32768,
Temperature: nil, // nil means use provider default
MaxToolIterations: 20,
MaxToolIterations: 50,
},
},
Bindings: []AgentBinding{},