From 603b49e513c8dbea0c894fb376b4dc07c4ebb59b Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Wed, 25 Feb 2026 05:05:56 +0900 Subject: [PATCH] fix: --orchestration flag not applied in gateway command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cmd_gateway.go parsed --debug and --stats but not --orchestration, so cfg.Agents.Defaults.Orchestration was never set to true. As a result GetOrchBroadcaster() returned nil, SetOrchBroadcaster() was never called, and the /miniapp/api/orchestration/ws endpoint always returned 503 → "Disconnected" in the Orch tab. Also restored loop.go comment to clarify that instance.go already maps defaults.Orchestration → Subagents.Enabled before the loop runs. Co-Authored-By: Claude Sonnet 4.6 --- cmd/picoclaw/cmd_gateway.go | 8 ++++++++ pkg/agent/loop.go | 2 ++ 2 files changed, 10 insertions(+) diff --git a/cmd/picoclaw/cmd_gateway.go b/cmd/picoclaw/cmd_gateway.go index 2b9567af5..986480d8c 100644 --- a/cmd/picoclaw/cmd_gateway.go +++ b/cmd/picoclaw/cmd_gateway.go @@ -37,6 +37,7 @@ func gatewayCmd() { // Check for --debug and --stats flags args := os.Args[2:] enableStats := false + orchestrationEnabled := false for _, arg := range args { if arg == "--debug" || arg == "-d" { logger.SetLevel(logger.DEBUG) @@ -45,6 +46,9 @@ func gatewayCmd() { if arg == "--stats" { enableStats = true } + if arg == "--orchestration" { + orchestrationEnabled = true + } } cfg, err := loadConfig() @@ -58,6 +62,10 @@ func gatewayCmd() { fmt.Printf("Error creating provider: %v\n", err) os.Exit(1) } + if orchestrationEnabled { + cfg.Agents.Defaults.Orchestration = true + } + // Use the resolved model ID from provider creation if modelID != "" { cfg.Agents.Defaults.Model = modelID diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 4649e71eb..00033edbe 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -137,6 +137,8 @@ func NewAgentLoop(cfg *config.Config, msgBus *bus.MessageBus, provider providers } // Determine if orchestration broadcaster is needed (any agent has subagents enabled). + // Note: instance.go maps defaults.Orchestration → Subagents.Enabled, so --orchestration + // is automatically reflected here. var orchBroadcaster *orch.Broadcaster var orchReporter orch.AgentReporter = orch.Noop for _, id := range registry.ListAgentIDs() {