fix: --orchestration flag not applied in gateway command

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 <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-02-25 05:05:56 +09:00
parent db77f63e20
commit 9bd665731b
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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() {