Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Route service-context discovery through the Patrol model by default

rcourtmana63c3b104510
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 1f3ebec089..32a3c20dba 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -1141,6 +1141,21 @@ deriving an older display status from `workflowStatusHistory`.
and `internal/ai/providers/ollama.go` is the only layer that turns it into
the Ollama `keep_alive` request field. An empty configured value means
Pulse omits `keep_alive` so the Ollama server default applies.
+ Per-surface model fallback chains are owned by the `Get*Model()` getters in
+ `internal/config/ai.go` and follow the operator's intent split between
+ interactive and background work. Interactive chat resolves
+ `ChatModel -> Model`. Background bulk work — Patrol, auto-fix, and
+ service-context discovery — resolves through the Patrol tier:
+ `PatrolModel -> Model` for Patrol itself, `AutoFixModel -> PatrolModel ->
+ Model` for auto-fix, and `DiscoveryModel -> PatrolModel -> Model` for
+ discovery. Discovery is high-fan-out (one model call per container or
+ service per refresh), so it must NOT fall back straight to the shared
+ default model past a configured Patrol override: an operator who selected
+ a cheap Patrol model has declared their background-work model, and
+ scheduled context refreshes silently burning the shared (often premium)
+ model with no chat activity is the bug this chain prevents. Settings copy
+ that describes the shared default model must state this chain rather than
+ claiming the shared default governs discovery unconditionally.
Cloud context privacy is a FIXED posture, not a user setting. Pulse is a
self-hosted homelab/SMB tool: when the operator points the Assistant at a cloud
model they have accepted that their (non-secret) infrastructure detail reaches
diff --git a/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx b/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx
index 369e78025b..197bcdda95 100644
--- a/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx
+++ b/frontend-modern/src/components/Settings/AIModelSelectionSection.tsx
@@ -45,7 +45,8 @@ const MODEL_OVERRIDE_CONFIG: Record<
discovery: {
formKey: 'discoveryModel',
label: 'Service context model',
- description: 'Used for model-backed service identification and scheduled context refreshes.',
+ description:
+ 'Used for model-backed service identification and scheduled context refreshes. Follows the Patrol model unless set.',
ariaLabel: 'Service context model identifier',
title: 'Select service context model',
},
@@ -431,8 +432,8 @@ export const AIModelSelectionSection: Component<AIModelSelectionSectionProps> =
</p>
</Show>
<p class="text-[11px] text-muted mt-1">
- Used by Pulse Assistant, Patrol, and Discovery unless you set a section-specific override
- below.
+ Used by Pulse Assistant and Patrol unless you set a section-specific override. Service
+ context discovery follows the Patrol model when one is set.
</p>
</div>
diff --git a/internal/config/ai.go b/internal/config/ai.go
index 24eb0e9bc7..64c6729fcf 100644
--- a/internal/config/ai.go
+++ b/internal/config/ai.go
@@ -625,13 +625,14 @@ func (c *AIConfig) GetPatrolModel() string {
}
// GetDiscoveryModel returns the model for infrastructure discovery
-// Falls back to the main model since discovery needs to use the same provider
+// Falls back to PatrolModel, then to the main Model if DiscoveryModel is not set
+// Discovery is high-fan-out background work (one call per container/service),
+// so it belongs on the operator's background-work model, not the shared default
func (c *AIConfig) GetDiscoveryModel() string {
if c.DiscoveryModel != "" {
return NormalizeQuickstartModelString(c.DiscoveryModel)
}
- // Fall back to the main model to ensure we use the same provider
- return c.GetModel()
+ return c.GetPatrolModel()
}
// GetAutoFixModel returns the model for automatic remediation actions
diff --git a/internal/config/ai_additional_test.go b/internal/config/ai_additional_test.go
index 0783266ae9..7a5597d09d 100644
--- a/internal/config/ai_additional_test.go
+++ b/internal/config/ai_additional_test.go
@@ -12,6 +12,13 @@ func TestAIConfig_DiscoveryAndControl(t *testing.T) {
t.Fatalf("default discovery model should fall back to GetModel(), got %q", got)
}
+ // A Patrol override is the operator's background-work model; discovery
+ // follows it before the shared default.
+ cfg.PatrolModel = "custom:patrol"
+ if got := cfg.GetDiscoveryModel(); got != "custom:patrol" {
+ t.Fatalf("discovery model should fall back to the Patrol model, got %q", got)
+ }
+
cfg.DiscoveryModel = "custom:discovery"
if got := cfg.GetDiscoveryModel(); got != "custom:discovery" {
t.Fatalf("custom discovery model = %q", got)
diff --git a/internal/config/ai_config_test.go b/internal/config/ai_config_test.go
index 336d5cd9b2..dd4028ccd7 100644
--- a/internal/config/ai_config_test.go
+++ b/internal/config/ai_config_test.go
@@ -1288,3 +1288,23 @@ func TestAIConfig_GetRequestTimeout(t *testing.T) {
})
}
}
+
+func TestAIConfig_GetDiscoveryModelFallbackChain(t *testing.T) {
+ // Discovery is high-fan-out background work: it follows the operator's
+ // background-work (Patrol) model before the shared default so scheduled
+ // context refreshes never silently burn a premium shared model.
+ cfg := AIConfig{Model: "gemini:gemini-flash-latest"}
+ if got := cfg.GetDiscoveryModel(); got != "gemini:gemini-flash-latest" {
+ t.Fatalf("with only the shared default set, GetDiscoveryModel() = %q, want the shared default", got)
+ }
+
+ cfg.PatrolModel = "gemini:gemini-2.5-flash-lite"
+ if got := cfg.GetDiscoveryModel(); got != "gemini:gemini-2.5-flash-lite" {
+ t.Fatalf("with a Patrol override set, GetDiscoveryModel() = %q, want the Patrol model", got)
+ }
+
+ cfg.DiscoveryModel = "ollama:qwen3:8b"
+ if got := cfg.GetDiscoveryModel(); got != "ollama:qwen3:8b" {
+ t.Fatalf("with an explicit discovery override set, GetDiscoveryModel() = %q, want the discovery override", got)
+ }
+}