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.

Enable Patrol qualification on fresh installs

rcourtman7422da843abe
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 9465701f0f..7c572b395c 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -952,7 +952,11 @@ for one explicit track, but it must acquire and freshly preflight one exact
provider/model route before provisioning any scenario, retain that route for
every repetition, and restore it once after the complete suite. Scenario
runners assert the leased route and must not rewrite model settings or trigger
-their own provider preflights. The suite acquisition deadline must mirror the
+their own provider preflights. On a fresh or intentionally disabled install,
+the suite lease must temporarily enable Pulse Intelligence in the same atomic
+route update so its route-specific preflight can run, then restore the original
+enabled state together with the model and subscription settings when the suite
+closes. The suite acquisition deadline must mirror the
runtime's route-aware preflight deadline, including the configured request
timeout for Ollama and custom OpenAI-compatible endpoints, plus bounded cache
publication grace; it must not restore a changed route while a permitted cold
diff --git a/internal/ai/qualification/client.go b/internal/ai/qualification/client.go
index 1f01f9c48c..136350dd13 100644
--- a/internal/ai/qualification/client.go
+++ b/internal/ai/qualification/client.go
@@ -348,6 +348,10 @@ func (c *PulseClient) OverridePatrolModel(ctx context.Context, model string) (fu
provider, _ := splitModel(model)
payload := make(map[string]any)
restorePayload := make(map[string]any)
+ if !settings.Enabled {
+ payload["enabled"] = true
+ restorePayload["enabled"] = settings.Enabled
+ }
if previous != model {
payload["patrol_model"] = model
restorePayload["patrol_model"] = previous
@@ -399,7 +403,7 @@ func (c *PulseClient) AcquirePatrolModelSuite(ctx context.Context, model string,
}
timeout = patrolModelSuiteAcquisitionTimeout(provider, timeout, before)
- routeChanged := before.EffectivePatrolModel() != target ||
+ routeChanged := !before.Enabled || before.EffectivePatrolModel() != target ||
(provider == "codex-subscription" && !before.CodexSubscriptionEnabled) ||
(provider == "claude-subscription" && !before.ClaudeSubscriptionEnabled)
previousPreflightUnix := int64(0)
@@ -422,7 +426,7 @@ func (c *PulseClient) AcquirePatrolModelSuite(ctx context.Context, model string,
}
}
- restore, err := c.OverridePatrolModel(ctx, model)
+ restore, err := c.OverridePatrolModel(ctx, target)
if err != nil {
return nil, err
}
diff --git a/internal/ai/qualification/client_test.go b/internal/ai/qualification/client_test.go
index 2e644e2588..dae04bc482 100644
--- a/internal/ai/qualification/client_test.go
+++ b/internal/ai/qualification/client_test.go
@@ -169,7 +169,7 @@ func TestOverridePatrolModelTemporarilyEnablesAndRestoresSubscriptionRoute(t *te
w.Header().Set("Content-Type", "application/json")
switch {
case r.Method == http.MethodGet && r.URL.Path == "/api/settings/ai":
- _, _ = w.Write([]byte(`{"enabled":true,"model":"ollama:qwen3:8b","patrol_model":"ollama:qwen3:8b","codex_subscription_enabled":false}`))
+ _, _ = w.Write([]byte(`{"enabled":false,"model":"ollama:qwen3:8b","patrol_model":"ollama:qwen3:8b","codex_subscription_enabled":false}`))
case r.Method == http.MethodPut && r.URL.Path == "/api/settings/ai/update":
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
@@ -193,10 +193,10 @@ func TestOverridePatrolModelTemporarilyEnablesAndRestoresSubscriptionRoute(t *te
if err := restore(context.Background()); err != nil {
t.Fatal(err)
}
- if len(requests) != 2 || requests[0]["codex_subscription_enabled"] != true || requests[0]["patrol_model"] != "codex-subscription:gpt-5.6-luna" {
+ if len(requests) != 2 || requests[0]["enabled"] != true || requests[0]["codex_subscription_enabled"] != true || requests[0]["patrol_model"] != "codex-subscription:gpt-5.6-luna" {
t.Fatalf("override request = %#v", requests)
}
- if requests[1]["codex_subscription_enabled"] != false || requests[1]["patrol_model"] != "ollama:qwen3:8b" {
+ if requests[1]["enabled"] != false || requests[1]["codex_subscription_enabled"] != false || requests[1]["patrol_model"] != "ollama:qwen3:8b" {
t.Fatalf("restore request = %#v", requests[1])
}
}
@@ -204,6 +204,7 @@ func TestOverridePatrolModelTemporarilyEnablesAndRestoresSubscriptionRoute(t *te
func TestAcquirePatrolModelSuitePinsOneRouteAndUsesFreshAsyncPreflight(t *testing.T) {
currentModel := "ollama:qwen3:8b"
codexEnabled := false
+ assistantEnabled := false
preflight := map[string]any{
"success": true, "provider": "ollama", "model": "qwen3:8b", "tool_call_observed": true,
"summary": "old preflight", "recorded_at_unix": int64(100),
@@ -215,7 +216,7 @@ func TestAcquirePatrolModelSuitePinsOneRouteAndUsesFreshAsyncPreflight(t *testin
switch {
case r.Method == http.MethodGet && r.URL.Path == "/api/settings/ai":
_ = json.NewEncoder(w).Encode(map[string]any{
- "enabled": true, "model": "ollama:qwen3:8b", "patrol_model": currentModel,
+ "enabled": assistantEnabled, "model": "ollama:qwen3:8b", "patrol_model": currentModel,
"patrol_enabled": true, "codex_subscription_enabled": codexEnabled,
"patrol_preflight": preflight,
})
@@ -231,7 +232,10 @@ func TestAcquirePatrolModelSuitePinsOneRouteAndUsesFreshAsyncPreflight(t *testin
if value, ok := body["codex_subscription_enabled"].(bool); ok {
codexEnabled = value
}
- if currentModel == "codex-subscription:gpt-5.6-sol" {
+ if value, ok := body["enabled"].(bool); ok {
+ assistantEnabled = value
+ }
+ if assistantEnabled && currentModel == "codex-subscription:gpt-5.6-sol" {
preflight = map[string]any{
"success": true, "provider": "codex-subscription", "model": "gpt-5.6-sol", "tool_call_observed": true,
"summary": "tool calling verified", "recorded_at_unix": int64(200),
@@ -267,9 +271,12 @@ func TestAcquirePatrolModelSuitePinsOneRouteAndUsesFreshAsyncPreflight(t *testin
if err := lease.Close(context.Background()); err != nil {
t.Fatal(err)
}
- if len(updates) != 2 || updates[1]["patrol_model"] != "ollama:qwen3:8b" || updates[1]["codex_subscription_enabled"] != false {
+ if len(updates) != 2 || updates[1]["enabled"] != false || updates[1]["patrol_model"] != "ollama:qwen3:8b" || updates[1]["codex_subscription_enabled"] != false {
t.Fatalf("route updates after close = %#v", updates)
}
+ if assistantEnabled {
+ t.Fatal("suite close did not restore disabled Pulse Intelligence state")
+ }
}
func TestPatrolModelSuiteAcquisitionTimeoutIsRouteAware(t *testing.T) {