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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Align Patrol preflight with the live context envelope
rcourtman1933a5be370e
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 1561427583..fa3ce77e3a 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -7467,9 +7467,9 @@ finding to resolved. A failed proposal remains absent from the receipt.### Live Patrol uses the context envelope it certifies-Every Watch and Patrol investigation provider request, including bounded-recovery and final-summary turns, carries a provider-neutral minimum context-request of 16,384 tokens. Providers without a runtime context control ignore+Every Patrol tool preflight, Watch, and Patrol investigation provider request,+including bounded recovery and final-summary turns, carries a provider-neutral+minimum context request of 16,384 tokens. Providers without a runtime context control ignorethe hint; Ollama projects it to native `num_ctx`. The Patrol model-readinessprobe imports this same core-owned value rather than maintaining a secondqualification-only constant. A model must therefore be exercised and run withdiff --git a/internal/ai/patrol_preflight.go b/internal/ai/patrol_preflight.goindex 5fa8c3c3a7..a63c1c5156 100644--- a/internal/ai/patrol_preflight.go+++ b/internal/ai/patrol_preflight.go@@ -6,6 +6,7 @@ import ("sync""time"+ "github.com/rcourtman/pulse-go-rewrite/internal/ai/chat""github.com/rcourtman/pulse-go-rewrite/internal/ai/providers""github.com/rcourtman/pulse-go-rewrite/internal/config")@@ -286,8 +287,9 @@ func (s *Service) runPatrolToolPreflight(ctx context.Context, providerName, mode},},},- MaxTokens: 256,- ReasoningEffort: providers.ReasoningEffortLow,+ MaxTokens: 256,+ ReasoningEffort: providers.ReasoningEffortLow,+ MinContextTokens: chat.PatrolProviderMinContextTokens,}if parsedProvider == config.AIProviderGemini {req.ToolChoice = &providers.ToolChoice{Type: providers.ToolChoiceRequired}diff --git a/internal/ai/patrol_preflight_test.go b/internal/ai/patrol_preflight_test.goindex 081a146456..b2ae19cbb0 100644--- a/internal/ai/patrol_preflight_test.go+++ b/internal/ai/patrol_preflight_test.go@@ -13,6 +13,7 @@ import ("testing""time"+ "github.com/rcourtman/pulse-go-rewrite/internal/ai/chat""github.com/rcourtman/pulse-go-rewrite/internal/ai/circuit""github.com/rcourtman/pulse-go-rewrite/internal/config")@@ -620,3 +621,41 @@ func TestRunPatrolToolPreflight_RequestShapeIncludesVerifyTool(t *testing.T) {t.Fatalf("expected preflight to keep tool selection automatic, got %v", captured["tool_choice"])}}++func TestRunPatrolToolPreflight_OllamaUsesLivePatrolContextEnvelope(t *testing.T) {+ var captured struct {+ Options struct {+ NumCtx int `json:"num_ctx"`+ } `json:"options"`+ }+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.Path != "/api/chat" {+ http.NotFound(w, r)+ return+ }+ if err := json.NewDecoder(r.Body).Decode(&captured); err != nil {+ t.Errorf("decode Ollama request: %v", err)+ http.Error(w, "bad request", http.StatusBadRequest)+ return+ }+ w.Header().Set("Content-Type", "application/json")+ _, _ = w.Write([]byte(`{"model":"gpt-oss:20b","done":true,"done_reason":"stop","message":{"role":"assistant","tool_calls":[{"function":{"name":"patrol_verify_tool","arguments":{"ok":true}}}]}}`))+ }))+ defer server.Close()++ svc := NewService(config.NewConfigPersistence(t.TempDir()), nil)+ svc.cfg = &config.AIConfig{+ Enabled: true,+ Model: "ollama:gpt-oss:20b",+ PatrolModel: "ollama:gpt-oss:20b",+ OllamaBaseURL: server.URL,+ }++ result := svc.RunPatrolToolPreflight(context.Background(), "", "")+ if !result.Success || !result.ToolCallObserved {+ t.Fatalf("preflight result = %+v, want successful tool call", result)+ }+ if captured.Options.NumCtx != chat.PatrolProviderMinContextTokens {+ t.Fatalf("Ollama preflight num_ctx = %d, want %d", captured.Options.NumCtx, chat.PatrolProviderMinContextTokens)+ }+}