From a4c3295c1a480995f95c83a594fce87362ac90ca Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 1 Jan 2026 15:30:27 +0000 Subject: [PATCH] fix: Ensure AI commands toggle remains stable vs agent reports. Related to #952 --- internal/monitoring/monitor.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index a847c5d75..970a2298f 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -2393,6 +2393,13 @@ func (m *Monitor) ApplyHostReport(report agentshost.Report, tokenRecord *config. IsLegacy: isLegacyHostAgent(report.Agent.Type), } + // Apply any pending commands execution override from server config + // This ensures the UI remains stable when the user toggles this setting, + // even if the agent hasn't yet picked up the new config in this report cycle. + if cfg := m.GetHostAgentConfig(identifier); cfg.CommandsEnabled != nil { + host.CommandsEnabled = *cfg.CommandsEnabled + } + if len(host.LoadAverage) == 0 { host.LoadAverage = nil }