fix(api): autodetect unified vs multi-process status for running field

handlers + poller llamaban Manager.StatusAll() siempre. En unified mode (launcher
arranca todos los agents como goroutines bajo 1 PID) no existen PID files
por agente, asi que StatusAll devolvia Running=false aunque los agents estaban
operativos.

Anade Server.statusAllAuto() que chequea IsUnifiedRunning() y delega a
StatusAllUnified() o StatusAll() segun corresponda. Reemplaza las 3 llamadas
directas en handlers.go (handleListAgents, handleGetAgent) y poller.go
(pollStatus seed + checkAndPublishDiffs).

Sin esto el frontend (0129) mostraria running=false universal.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 21:31:41 +02:00
parent 98839cd8a8
commit b3cf8b41aa
2 changed files with 15 additions and 4 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ func (s *Server) pollStatus(ctx context.Context) {
// Seed the previous state map.
prev := make(map[string]bool)
if statuses, err := s.mgr.StatusAll(); err == nil {
if statuses, err := s.statusAllAuto(); err == nil {
for _, st := range statuses {
prev[st.ID] = st.Running
}
@@ -39,7 +39,7 @@ func (s *Server) pollStatus(ctx context.Context) {
}
func (s *Server) checkAndPublishDiffs(prev map[string]bool) {
statuses, err := s.mgr.StatusAll()
statuses, err := s.statusAllAuto()
if err != nil {
return
}