Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/customtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"errors"
"fmt"
"io"
"log"
"log/slog"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -242,7 +242,7 @@ func (s *Server) seedPythonInterpreter() {
}
if p := detectPython(); p != "" {
_ = s.m.pg.SetSetting(settingPythonInterp, p)
log.Printf("[custom-tool] auto-detected python interpreter: %s", p)
slog.Info("[custom-tool] auto-detected python interpreter", "path", p)
}
}

Expand Down
16 changes: 8 additions & 8 deletions server/llmpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package server

import (
"context"
"log"
"log/slog"
"sync"
"time"

Expand Down Expand Up @@ -43,7 +43,7 @@ func newLLMHealthRegistry(ctx context.Context, pg *db.DB) (*llmpool.Registry, *h
st.OpenUntil = *h.OpenUntil
}
reg.Restore(h.ProfileID, st)
log.Printf("[llmpool] restored circuit-breaker state: profile #%d cooling until %s", h.ProfileID, st.OpenUntil.Format(time.RFC3339))
slog.Info("[llmpool] restored circuit-breaker state", "profile_id", h.ProfileID, "cooling_until", st.OpenUntil.Format(time.RFC3339))
}
}
return reg, syncer
Expand Down Expand Up @@ -103,7 +103,7 @@ func (s *Server) FlushLLMHealth() {
select {
case <-s.llmHealthSync.done:
case <-time.After(5 * time.Second):
log.Printf("[llmpool] timed out flushing circuit-breaker state")
slog.Warn("[llmpool] timed out flushing circuit-breaker state")
}
}

Expand All @@ -114,7 +114,7 @@ func (h *healthSync) enqueue(id int64, op healthOp) {
if h.stopped {
h.mu.Unlock()
if err := h.apply(id, op); err != nil {
log.Printf("[llmpool] write circuit-breaker profile #%d: %v", id, err)
slog.Error("[llmpool] write circuit-breaker profile failed", "profile_id", id, "err", err)
}
return
}
Expand Down Expand Up @@ -198,7 +198,7 @@ func (h *healthSync) apply(id int64, op healthOp) error {
func (h *healthSync) write(batch map[int64]healthOp) (failed bool) {
for id, op := range batch {
if err := h.apply(id, op); err != nil {
log.Printf("[llmpool] write circuit-breaker profile #%d: %v", id, err)
slog.Error("[llmpool] write circuit-breaker profile failed", "profile_id", id, "err", err)
h.restore(id, op)
failed = true
}
Expand All @@ -214,7 +214,7 @@ func (h *healthSync) finish() {
h.mu.Unlock()
for id, op := range batch {
if err := h.apply(id, op); err != nil {
log.Printf("[llmpool] write circuit-breaker profile #%d: %v", id, err)
slog.Error("[llmpool] write circuit-breaker profile failed", "profile_id", id, "err", err)
}
}
}
Expand Down Expand Up @@ -273,7 +273,7 @@ func (s *Server) poolChain(headID int64, headProv llm.Provider, headCfg agent.Co
}
profs, err := s.m.pg.PoolProfiles()
if err != nil {
log.Printf("[llmpool] failed to read the pool chain: %v", err)
slog.Error("[llmpool] failed to read pool chain", "err", err)
return nil
}
var head *db.LLMProfile
Expand Down Expand Up @@ -326,7 +326,7 @@ func (s *Server) poolForActive(activeID int64, prov llm.Provider, cfg agent.Conf
for _, m := range pool.Members() {
names = append(names, m.Name+"/"+m.Model)
}
log.Printf("[llmpool] LLM pooling enabled, chain (%d): %v", len(names), names)
slog.Info("[llmpool] LLM pooling enabled", "count", len(names), "chain", names)
return pool
}

Expand Down
20 changes: 10 additions & 10 deletions server/server_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"errors"
"fmt"
"io"
"log"
"log/slog"
"mime"
"net"
"net/http"
Expand Down Expand Up @@ -207,7 +207,7 @@ func (s *Server) abortTaskDelete(taskID string) {
state := task.lifecycleSnapshot()
keepPaused = state.Paused || state.Queued
if getErr != nil {
log.Printf("[task-delete] task %s failed to read persisted state, restoring the barrier from in-memory state: %v", taskID, getErr)
slog.Warn("[task-delete] failed to read persisted state, restoring barrier from in-memory state", "task_id", taskID, "err", getErr)
}
} else if getErr == nil {
// The request targeted a task that does not exist. Do not retain a
Expand Down Expand Up @@ -361,7 +361,7 @@ func (s *Server) pgCreateAgent(w http.ResponseWriter, r *http.Request) {
}
// starter prompt so the editor shows something editable from the start.
if err := pg.SeedPromptIfEmpty(a.ID, agent.DefaultAssistantPrompt); err != nil {
log.Printf("[agents] failed to seed starter prompt for %s: %v", a.Key, err)
slog.Error("[agents] failed to seed starter prompt", "agent", a.Key, "err", err)
}
writeJSON(w, 200, agentDTO(a))
}
Expand Down Expand Up @@ -409,10 +409,10 @@ func (s *Server) pgDeleteAgent(w http.ResponseWriter, r *http.Request) {
return
}
if err := pg.RemoveAgentFromToolBindings(a.Key); err != nil {
log.Printf("[agents] failed to clean up tool bindings for %s: %v", a.Key, err)
slog.Error("[agents] failed to clean up tool bindings", "agent", a.Key, "err", err)
}
if err := pg.DeleteTriggersForAgent(a.Key); err != nil {
log.Printf("[agents] failed to clean up triggers for %s: %v", a.Key, err)
slog.Error("[agents] failed to clean up triggers", "agent", a.Key, "err", err)
}
writeJSON(w, 200, map[string]any{"deleted": a.Key})
}
Expand Down Expand Up @@ -850,7 +850,7 @@ func (s *Server) pgListTools(w http.ResponseWriter, r *http.Request) {
// catalog query, so agent assembly never pays for this aggregate.
counts, countErr := pg.ToolUsageCounts()
if countErr != nil {
log.Printf("[tools] failed to read call stats: %v", countErr)
slog.Warn("[tools] failed to read call stats", "err", countErr)
} else {
for _, tool := range ts {
tool.Calls = counts[tool.Key]
Expand Down Expand Up @@ -1071,7 +1071,7 @@ func (s *Server) pgSaveMCP(w http.ResponseWriter, r *http.Request) {
m.ID = id
ctx, cancel := context.WithTimeout(r.Context(), 45*time.Second)
if derr := s.discoverAndCacheMCP(ctx, &m); derr != nil {
log.Printf("[mcp] tool discovery after adding %s failed: %v", m.Name, derr)
slog.Error("[mcp] tool discovery failed after adding mcp", "mcp", m.Name, "err", derr)
}
cancel()
}
Expand Down Expand Up @@ -1182,7 +1182,7 @@ func (s *Server) fsListSkills(w http.ResponseWriter, r *http.Request) {
if s.m.pg != nil {
stats, err := s.m.pg.SkillStats()
if err != nil {
log.Printf("[skills] failed to read call stats: %v", err)
slog.Warn("[skills] failed to read call stats", "err", err)
}
for _, st := range stats {
statBySkill[st.Skill] = st
Expand Down Expand Up @@ -1437,7 +1437,7 @@ func warnBrokenSkills(dir string) {
if s.Dir == "" || s.Name == filepath.Base(s.Dir) {
continue
}
log.Printf("[skill] %s: frontmatter did not parse (loaded under the directory name; description and mcps are empty) - fix the YAML in %s", s.Name, filepath.Join(s.Dir, "SKILL.md"))
slog.Warn("[skill] frontmatter did not parse", "skill", s.Name, "path", filepath.Join(s.Dir, "SKILL.md"))
}
}

Expand Down Expand Up @@ -2298,7 +2298,7 @@ func (s *Server) restoreTasksAfterProfileDelete(pg *db.DB) {
// paused task remains paused and terminal tasks remain immutable.
if !isTerminalStatus(task.lifecycleSnapshot().Status) && s.taskRuntimeAvailable(task, "planner", "worker") {
if _, reopenErr := task.Store.ReopenIntentsByBlockedReason(db.IntentBlockedLLMQuota); reopenErr != nil {
log.Printf("[llm-profile] task %s reopen quota-blocked intents after profile delete: %v", task.ID, reopenErr)
slog.Warn("[llm-profile] reopen quota-blocked intents failed after profile delete", "task_id", task.ID, "err", reopenErr)
}
}
task.Notify()
Expand Down
4 changes: 2 additions & 2 deletions server/task_archive_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"log/slog"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -157,7 +157,7 @@ func (s *Server) deleteRemoteTaskArchive(job *pgdb.TaskArchive) error {
}
if err := s.recoverRemoteArchiveJournal(journal); err != nil {
// The task is gone; the durable outbox retries the remaining object cleanup.
log.Printf("[task-archive] archive %d deleted; remote cleanup pending: %v", job.ID, err)
slog.Info("[task-archive] archive deleted, remote cleanup pending", "archive_id", job.ID, "err", err)
}
return nil
}
4 changes: 2 additions & 2 deletions server/task_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"log"
"log/slog"
"net/http"
"strings"

Expand Down Expand Up @@ -145,7 +145,7 @@ func (s *Server) applyTaskControlWithCause(t *Task, action string, pauseCause er
default:
return out, fmt.Errorf("action must be pause|resume")
}
log.Printf("[task] #%s %s", t.ID, map[string]string{"pause": "paused", "resume": "resumed"}[action])
slog.Info("[task] task state changed", "task_id", t.ID, "action", map[string]string{"pause": "paused", "resume": "resumed"}[action])
return out, nil
}

Expand Down
4 changes: 2 additions & 2 deletions server/task_outcome.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package server
import (
"database/sql"
"errors"
"log"
"log/slog"
"net/http"
"strconv"
)
Expand All @@ -23,7 +23,7 @@ func (s *Server) taskOutcome(w http.ResponseWriter, r *http.Request) {
return
}
if err != nil {
log.Printf("[tasks] outcome query failed for %d: %v", id, err)
slog.Error("[tasks] outcome query failed", "task_id", id, "err", err)
writeErr(w, 500, "outcome query failed")
return
}
Expand Down
6 changes: 3 additions & 3 deletions server/traffic_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"log/slog"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -145,7 +145,7 @@ func (m *Manager) reloadTamperHooks() {
}
rows, err := m.pg.ListTrafficTamperHooks()
if err != nil {
log.Printf("[traffic] tampering hooks not reloaded: %v", err)
slog.Warn("[traffic] tampering hooks not reloaded", "err", err)
return
}
defs := make([]traffic.HookDef, 0, len(rows))
Expand All @@ -165,7 +165,7 @@ func (m *Manager) reloadTamperHooks() {
loadErrs[id] = msg
}
for id, msg := range loadErrs {
log.Printf("[traffic] tampering hook %d not loaded: %s", id, msg)
slog.Warn("[traffic] tampering hook not loaded", "hook_id", id, "msg", msg)
}
m.hookLoadErrs = loadErrs
m.hookSet.Store(hs)
Expand Down
6 changes: 3 additions & 3 deletions server/triage.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package server
import (
"context"
"fmt"
"log"
"log/slog"
"net"
"net/http"
"strconv"
Expand All @@ -23,7 +23,7 @@ import (
// no base_url/model returns nil, and report_finding behaves exactly as before.
func (s *Server) triageClient() agent.TriageClient {
id := s.triageProfileID()
log.Printf("[triage] triageClient: profile_id=%d", id)
slog.Info("[triage] initialized triage client", "profile_id", id)
if id <= 0 {
return nil
}
Expand Down Expand Up @@ -52,7 +52,7 @@ func (s *Server) triageHTTPClient(baseURL string) *http.Client {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if _, err := g.validateURL(ctx, baseURL, "triage"); err != nil {
log.Printf("[triage] base_url refused (%v); dedup stays off", err)
slog.Warn("[triage] base_url refused, dedup stays off", "err", err)
return nil
}
var tr *http.Transport
Expand Down
Loading