feat: add agent loading debug logging and fix nodes endpoint response format

This commit is contained in:
Haitao Pan 2026-02-05 12:17:35 +08:00
parent e75b2d45e3
commit e48c23fab5

View File

@ -719,6 +719,12 @@ func runServer(ctx context.Context, cfg *config.Config, logger *slog.Logger) err
agentRegistry.SetStore(st)
if err := agentRegistry.Load(ctx); err != nil {
logger.Warn("failed to load agents from store", "err", err)
} else {
agents := agentRegistry.Agents()
logger.Info("loaded agents from store", "count", len(agents))
for _, agent := range agents {
logger.Info("loaded agent", "id", agent.ID, "name", agent.Name, "groups", agent.Groups)
}
}
// Start background cleanup task for stale agents (e.g., those that haven't heartbeated for 10 minutes)
go runAgentCleanup(ctx, st, logger)