From 04b8d2b461dcc4b4d3c04b8291209f6b747cc72c Mon Sep 17 00:00:00 2001 From: Enmanuel Date: Sat, 11 Apr 2026 00:25:03 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20corregir=20isSpecialConfig=20cuando=20lo?= =?UTF-8?q?adedSpecials=20est=C3=A1=20vac=C3=ADo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmd/launcher/main.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/launcher/main.go b/cmd/launcher/main.go index d07b1f3..50d9e42 100644 --- a/cmd/launcher/main.go +++ b/cmd/launcher/main.go @@ -35,6 +35,8 @@ import ( _ "github.com/enmanuel/agents/agents/meteorologo" _ "github.com/enmanuel/agents/agents/test-personality" _ "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" ) @@ -356,17 +358,16 @@ func newLogger(level string) *slog.Logger { return slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: parseLogLevel(level)})) } -// isSpecialConfig checks whether a config path belongs to a special agent -// that was already loaded (e.g. orchestrator). It reads the YAML to detect -// a "special:" top-level key. This avoids config.Load() failing with -// validation errors for SpecialConfig files. -func isSpecialConfig(path string, loadedSpecials map[string]bool) bool { - if len(loadedSpecials) == 0 { - return false - } +// isSpecialConfig checks whether a config path belongs to a middleware special +// (e.g. orchestrator) by detecting a "special:" top-level key with a non-empty +// id. This avoids config.Load() failing with "agent.id is required" when the +// orchestrator is disabled or failed to start (loadedSpecials would be empty). +// Agent-type specials like father-bot use a regular agent config (agent.id set) +// and are handled by the normal loading path. +func isSpecialConfig(path string, _ map[string]bool) bool { cfg, err := config.LoadSpecial(path) if err != nil { 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 }