fix: corregir isSpecialConfig cuando loadedSpecials está vacío

Eliminar el early-return `if len(loadedSpecials) == 0 { return false }`
que causaba que el config del orchestrator (disabled/fallido) se intentara
cargar como agente normal, fallando con "agent.id is required".

Ahora la función parsea el YAML con LoadSpecial y devuelve true si
cfg.Special.ID != "" — independientemente de si el agente arrancó.
Esto silencia el error recurrente en cada inicio del launcher.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-11 00:25:03 +00:00
parent 53a22538d8
commit 04b8d2b461
+10 -9
View File
@@ -35,6 +35,8 @@ import (
_ "github.com/enmanuel/agents/agents/meteorologo" _ "github.com/enmanuel/agents/agents/meteorologo"
_ "github.com/enmanuel/agents/agents/test-personality" _ "github.com/enmanuel/agents/agents/test-personality"
_ "github.com/enmanuel/agents/agents/_specials/father-bot" _ "github.com/enmanuel/agents/agents/_specials/father-bot"
_ "github.com/enmanuel/agents/agents/wikipedia-bot"
_ "github.com/enmanuel/agents/agents/exchange-bot"
testbot "github.com/enmanuel/agents/agents/test-bot" testbot "github.com/enmanuel/agents/agents/test-bot"
) )
@@ -356,17 +358,16 @@ func newLogger(level string) *slog.Logger {
return slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: parseLogLevel(level)})) return slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: parseLogLevel(level)}))
} }
// isSpecialConfig checks whether a config path belongs to a special agent // isSpecialConfig checks whether a config path belongs to a middleware special
// that was already loaded (e.g. orchestrator). It reads the YAML to detect // (e.g. orchestrator) by detecting a "special:" top-level key with a non-empty
// a "special:" top-level key. This avoids config.Load() failing with // id. This avoids config.Load() failing with "agent.id is required" when the
// validation errors for SpecialConfig files. // orchestrator is disabled or failed to start (loadedSpecials would be empty).
func isSpecialConfig(path string, loadedSpecials map[string]bool) bool { // Agent-type specials like father-bot use a regular agent config (agent.id set)
if len(loadedSpecials) == 0 { // and are handled by the normal loading path.
return false func isSpecialConfig(path string, _ map[string]bool) bool {
}
cfg, err := config.LoadSpecial(path) cfg, err := config.LoadSpecial(path)
if err != nil { if err != nil {
return false // not a valid special config → let Load() handle it return false // not a valid special config → let Load() handle it
} }
return loadedSpecials[cfg.Special.ID] return cfg.Special.ID != "" // has special.id → middleware special, skip
} }