Show agent liveness, stuck/zombie detection and parse errors in admin

This commit is contained in:
Ian Gulliver
2026-10-14 22:35:53 -07:00
parent 33e682a9d5
commit 1dc09c77e0
21 changed files with 1072 additions and 114 deletions
+12
View File
@@ -67,6 +67,7 @@ func New(dataDir string, spa fs.FS) (*Server, error) {
s.store.Close()
return nil, fmt.Errorf("recover sessions: %w", err)
}
go s.agents.Watch()
return s, nil
}
@@ -393,6 +394,12 @@ func (s *Server) GetStatus(w http.ResponseWriter, r *http.Request) {
return
}
health, err := s.agents.Health(r.Context())
if err != nil {
writeError(w, http.StatusInternalServerError, err)
return
}
dbBytes := int64(0)
for _, suffix := range []string{"", "-wal", "-shm"} {
fi, err := os.Stat(s.store.Path() + suffix)
@@ -413,6 +420,11 @@ func (s *Server) GetStatus(w http.ResponseWriter, r *http.Request) {
QueuedTurns: usage.Queued,
Caps: usage.Caps,
RateLimits: usage.RateLimits,
AgentProcesses: health.Processes,
Zombies: health.Zombies,
StuckAfterSeconds: int(agents.StuckAfter / time.Second),
ProtocolErrors: s.agents.ProtocolErrors(),
})
}