From 9f802b2dcfe7236d34406467c51a35c6f9c3f1a5 Mon Sep 17 00:00:00 2001 From: DBT Date: Mon, 23 Feb 2026 16:59:55 +0000 Subject: [PATCH] show dialog template change summary on hot reload --- cmd/clawgo/cmd_gateway.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/cmd/clawgo/cmd_gateway.go b/cmd/clawgo/cmd_gateway.go index 442804d..fd9ea26 100644 --- a/cmd/clawgo/cmd_gateway.go +++ b/cmd/clawgo/cmd_gateway.go @@ -196,6 +196,8 @@ func gatewayCmd() { reflect.DeepEqual(cfg.Tools, newCfg.Tools) && reflect.DeepEqual(cfg.Channels, newCfg.Channels) + changes := summarizeDialogTemplateChanges(cfg, newCfg) + if runtimeSame { configureLogging(newCfg) sentinelService.Stop() @@ -219,6 +221,9 @@ func gatewayCmd() { sentinelService.Start() } cfg = newCfg + if len(changes) > 0 { + fmt.Printf("↻ Dialog template changes: %s\n", strings.Join(changes, ", ")) + } fmt.Println("✓ Config hot-reload applied (logging/metadata only)") continue } @@ -261,6 +266,9 @@ func gatewayCmd() { continue } go agentLoop.Run(ctx) + if len(changes) > 0 { + fmt.Printf("↻ Dialog template changes: %s\n", strings.Join(changes, ", ")) + } fmt.Println("✓ Config hot-reload applied") default: fmt.Println("\nShutting down...") @@ -276,6 +284,37 @@ func gatewayCmd() { } } +func summarizeDialogTemplateChanges(oldCfg, newCfg *config.Config) []string { + if oldCfg == nil || newCfg == nil { + return nil + } + type pair struct { + name string + a string + b string + } + oldT := oldCfg.Agents.Defaults.Texts + newT := newCfg.Agents.Defaults.Texts + checks := []pair{ + {name: "system_rewrite_template", a: oldT.SystemRewriteTemplate, b: newT.SystemRewriteTemplate}, + {name: "lang_usage", a: oldT.LangUsage, b: newT.LangUsage}, + {name: "lang_invalid", a: oldT.LangInvalid, b: newT.LangInvalid}, + {name: "lang_updated_template", a: oldT.LangUpdatedTemplate, b: newT.LangUpdatedTemplate}, + {name: "runtime_compaction_note", a: oldT.RuntimeCompactionNote, b: newT.RuntimeCompactionNote}, + {name: "startup_compaction_note", a: oldT.StartupCompactionNote, b: newT.StartupCompactionNote}, + } + out := make([]string, 0) + for _, c := range checks { + if strings.TrimSpace(c.a) != strings.TrimSpace(c.b) { + out = append(out, c.name) + } + } + if oldCfg.Agents.Defaults.Heartbeat.PromptTemplate != newCfg.Agents.Defaults.Heartbeat.PromptTemplate { + out = append(out, "heartbeat.prompt_template") + } + return out +} + func runGatewayStartupCompactionCheck(parent context.Context, agentLoop *agent.AgentLoop) { if agentLoop == nil { return