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.

Add a guided Ollama quickstart blessing qwen3:8b for Patrol

rcourtman99dad2b51135
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index b05119a725..f9d136721e 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -713,7 +713,12 @@ investigation-only over agent-reporting resources: it must not alter agent
lifecycle, registration, token binding, reporting contracts, or install-command
identity. The scoped Patrol request carries resource identity only and reuses
the existing Patrol scoped engine, so it adds no agent lifecycle control
-surface and no new `internal/api/` lifecycle handler.
+surface and no new `internal/api/` lifecycle handler. AI settings projection
+changes in `internal/api/ai_handlers.go`, such as the registry's suggested
+Patrol quickstart model metadata on `/api/settings/ai`, are likewise
+ai-runtime configuration surface: they must not become an agent lifecycle
+install-guidance or discovery channel, and agent setup surfaces must not
+consume them as lifecycle state.
First-run security discovery under shared `internal/api/` is likewise an
adjacent API/security boundary, not an agent-lifecycle discovery surface.
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index bc340ec62d..a3f2e5961a 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -153,6 +153,20 @@ Provider definitions that declare a BaseURLField (today OpenAI, Ollama, and
Z.ai) expose a user-overridable endpoint via the AI settings payload; the
registry default base URL applies when no override is stored, so one provider
can serve both standard and alternate (e.g. Z.ai coding) endpoint tiers.
+Patrol-blessed quickstart models are registry-owned the same way. For a
+provider whose model catalog is user-supplied (today Ollama), the suggested
+Patrol model, its hardware-expectation note, and its equivalent catalog tags
+live on the provider definition in `internal/config/ai_providers.go` and
+project through `/api/settings/ai`; settings surfaces render that projection
+and must not hardcode blessed model IDs. A blessing must be verified against
+Patrol's real tool-call preflight before it ships or changes; the env-gated
+`TestManualOllamaBlessedModelPreflight` harness in `internal/ai/` is the
+re-blessing procedure, and connectivity or catalog presence alone is not
+verification (qwen3:4b passed connectivity yet emitted a tool call in 0 of 4
+preflight runs, which is why only qwen3:8b is blessed). Recommended-model
+resolution may prefer blessed models only by exact normalized catalog ID
+match, never by family or substring, so cloud-gateway catalog neighbours of
+the same model family are not promoted by fuzzy matching.
Native provider tool-calling is a transport projection over the shared
provider-neutral `Tool`, `ToolChoice`, `ToolCall`, and `ToolResult` shapes.
Nil `ToolChoice` means provider-owned automatic selection, `none` disables
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index e1f9118fa8..fec54ac075 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -895,7 +895,12 @@ payload shape change when the portal presents compact client rows.
non-secret provider metadata from the config-layer registry, including
provider id, display name, protocol family, default route, default base URL,
credential field names, configured-state field names, clear-key field names,
- env-var hints, docs URL, gateway flag, and current configured state. The
+ env-var hints, docs URL, gateway flag, current configured state, and, for
+ providers whose model catalog is user-supplied (today Ollama), the
+ Patrol-blessed `suggested_model` with its `suggested_model_note` hardware
+ copy and `suggested_model_equivalents` tags. Those suggested-model fields
+ are registry-derived guidance, omitted when a provider has no blessing, and
+ must never be inferred or overridden browser-side. The
legacy top-level configured booleans may remain for browser compatibility,
but new provider additions must update the registry-backed projection and
contract tests rather than adding an untyped browser-only provider list.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index e22fef67ef..4bc6768d95 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1506,6 +1506,12 @@ Agent`), with the plain-language source phrase available through accessible
arrays/maps and the backend registry projection instead of introducing
provider-specific JSX branches, local configured-state inference, or
browser-owned default endpoint facts.
+ The Ollama guided quickstart on that card (the copyable `ollama pull`
+ command block, the hardware-expectation note, and the post-test next-step
+ hint) renders the backend registry's `suggested_model` projection from the
+ settings payload; the browser must not hardcode blessed model IDs or their
+ equivalent tags, and the hint must compare the tested model against the
+ server-authored suggestion set rather than a frontend literal.
Provider connection controls are page-scoped: the global Pulse
Intelligence enable toggle, provider readiness strip, and Test Connection
action belong to `Provider & Models`; Patrol, Assistant, and Service Context
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 52732f465c..ddcaa944c5 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -105,7 +105,8 @@ Operations-loop status wiring in `internal/api/agent_resource_context.go` is
storage/recovery-adjacent only through the shared action-audit and verification
projection. Sibling handlers in `internal/api/` such as the AI settings handler
(`ai_handlers.go`) carry AI provider configuration (for example per-provider
-base URL overrides) that is ai-runtime config-surface, not storage or recovery
+base URL overrides or the registry's suggested Patrol quickstart model
+metadata) that is ai-runtime config-surface, not storage or recovery
state; a manual scoped Patrol check routed through this handler is
investigate-only as well (it may analyze storage resources but invokes no
backup, restore, SMART, or recovery operation, and carries resource identity
diff --git a/frontend-modern/src/components/Settings/AIProviderConfigurationSection.tsx b/frontend-modern/src/components/Settings/AIProviderConfigurationSection.tsx
index 42749f3b15..0d74952137 100644
--- a/frontend-modern/src/components/Settings/AIProviderConfigurationSection.tsx
+++ b/frontend-modern/src/components/Settings/AIProviderConfigurationSection.tsx
@@ -1,6 +1,7 @@
import { For, Show, type Accessor, type Component, type Setter } from 'solid-js';
import type { SetStoreFunction } from 'solid-js/store';
import { CalloutCard } from '@/components/shared/CalloutCard';
+import { CopyCommandBlock } from '@/components/Settings/CopyCommandBlock';
import { ExternalTextLink } from '@/components/shared/ExternalTextLink';
import { HelpIcon } from '@/components/shared/HelpIcon';
import { controlClass } from '@/components/shared/Form';
@@ -126,6 +127,27 @@ export const AIProviderConfigurationSection: Component<AIProviderConfigurationSe
props.providerTestResult()?.provider === config.provider
? props.providerTestResult()
: null;
+ const registryDefinition = () =>
+ props.settings()?.providers?.find((def) => def.id === config.provider);
+ const suggestedModel = () => registryDefinition()?.suggested_model ?? '';
+ const suggestedModelNote = () => registryDefinition()?.suggested_model_note ?? '';
+ const testedModelIsSuggested = () => {
+ const definition = registryDefinition();
+ if (!definition?.suggested_model) {
+ return true;
+ }
+ const tested = (testResult()?.model ?? '').toLowerCase();
+ if (!tested) {
+ return true;
+ }
+ const bare = tested.startsWith(`${config.provider}:`)
+ ? tested.slice(config.provider.length + 1)
+ : tested;
+ return [
+ definition.suggested_model,
+ ...(definition.suggested_model_equivalents ?? []),
+ ].some((id) => id.toLowerCase() === bare);
+ };
return (
<div
@@ -223,6 +245,21 @@ export const AIProviderConfigurationSection: Component<AIProviderConfigurationSe
)}
</For>
+ <Show when={config.provider === 'ollama' && suggestedModel()}>
+ <div class="space-y-1">
+ <p class="text-xs text-muted">
+ Patrol needs a model that can call tools. This one is tested with Pulse:
+ </p>
+ <CopyCommandBlock
+ command={`ollama pull ${suggestedModel()}`}
+ codeClass="block whitespace-pre overflow-x-auto rounded-md border border-border bg-base p-3 pr-10 font-mono text-xs text-base-content"
+ />
+ <Show when={suggestedModelNote()}>
+ <p class="text-xs text-muted">{suggestedModelNote()}</p>
+ </Show>
+ </div>
+ </Show>
+
<Show when={config.helperText}>
<p class="text-xs text-muted">{config.helperText}</p>
</Show>
@@ -266,6 +303,18 @@ export const AIProviderConfigurationSection: Component<AIProviderConfigurationSe
{testResult()?.message}
</p>
</Show>
+ <Show
+ when={
+ config.provider === 'ollama' &&
+ testResult()?.success &&
+ !testedModelIsSuggested()
+ }
+ >
+ <p class="text-xs text-amber-600 dark:text-amber-400">
+ Next step for Patrol: run the ollama pull command above, then pick{' '}
+ {suggestedModel()} as the Patrol model.
+ </p>
+ </Show>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 1a76b47fe4..5fdaefdda1 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -715,6 +715,20 @@ describe('settings architecture guardrails', () => {
expect(aiProviderConfigurationSectionSource).not.toContain('extraField()');
});
+ it('keeps the Ollama quickstart on the server-authored suggested-model projection', () => {
+ // The blessed Patrol model is registry-owned backend metadata; the
+ // provider row renders the projection and must not hardcode model IDs.
+ expect(aiProviderConfigurationSectionSource).toContain(
+ "registryDefinition()?.suggested_model ?? ''",
+ );
+ expect(aiProviderConfigurationSectionSource).toContain(
+ 'command={`ollama pull ${suggestedModel()}`}',
+ );
+ expect(aiProviderConfigurationSectionSource).toContain('suggested_model_equivalents');
+ expect(aiProviderConfigurationSectionSource).not.toContain('qwen');
+ expect(aiSettingsModelSource).not.toContain('qwen');
+ });
+
it('keeps Assistant session maintenance limited to Pulse-owned session actions', () => {
expect(aiChatMaintenanceSectionSource).toContain('Summarize session');
expect(aiChatMaintenanceSectionSource).toContain('handleSessionSummarize');
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index 8865b07675..57b0302eb5 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -793,7 +793,7 @@ describe('AIIntelligence entitlement gating', () => {
status: 'warning',
ready: true,
summary:
- 'Ollama connectivity alone does not prove tool support. Use an Ollama model that returns tool_calls for Patrol verification.',
+ "Ollama connectivity alone does not prove tool support. qwen3:8b passes Patrol's tool check; run ollama pull qwen3:8b and select it as the Patrol model.",
provider: 'ollama',
model: 'ollama:llama3',
checks: [
@@ -802,7 +802,7 @@ describe('AIIntelligence entitlement gating', () => {
status: 'warning',
label: 'Patrol tools',
message:
- 'Ollama connectivity alone does not prove tool support. Use an Ollama model that returns tool_calls for Patrol verification.',
+ "Ollama connectivity alone does not prove tool support. qwen3:8b passes Patrol's tool check; run ollama pull qwen3:8b and select it as the Patrol model.",
action: 'open_provider_settings',
},
],
diff --git a/frontend-modern/src/types/ai.ts b/frontend-modern/src/types/ai.ts
index bf33d3fb34..6f63932388 100644
--- a/frontend-modern/src/types/ai.ts
+++ b/frontend-modern/src/types/ai.ts
@@ -34,6 +34,11 @@ export interface AIProviderDefinition {
models_dev_provider_id?: string;
env_vars: string[];
docs_url?: string;
+ // Patrol-blessed quickstart model for providers where users must pick a
+ // model themselves (Ollama). Absent for curated-catalog providers.
+ suggested_model?: string;
+ suggested_model_note?: string;
+ suggested_model_equivalents?: string[];
}
export interface PatrolReadinessCheck {
diff --git a/internal/ai/manual_ollama_preflight_test.go b/internal/ai/manual_ollama_preflight_test.go
new file mode 100644
index 0000000000..04255a297b
--- /dev/null
+++ b/internal/ai/manual_ollama_preflight_test.go
@@ -0,0 +1,47 @@
+package ai
+
+// Manual verification harness for the Ollama blessed-model quickstart
+// (config.OllamaSuggestedPatrolModel). Skipped unless pointed at a real
+// Ollama server, so it never runs in CI. Use it when re-blessing the
+// suggested model:
+//
+// ollama pull <candidate>
+// PULSE_MANUAL_OLLAMA_PREFLIGHT_URL=http://127.0.0.1:11434 \
+// PULSE_MANUAL_OLLAMA_PREFLIGHT_MODEL=<candidate> \
+// go test ./internal/ai -run TestManualOllamaBlessedModelPreflight -v -count=1
+//
+// Run it several times: qwen3:4b passed connectivity but emitted a tool
+// call in 0 of 4 preflight runs, which is why only qwen3:8b is blessed.
+
+import (
+ "context"
+ "os"
+ "testing"
+ "time"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/config"
+)
+
+func TestManualOllamaBlessedModelPreflight(t *testing.T) {
+ base := os.Getenv("PULSE_MANUAL_OLLAMA_PREFLIGHT_URL")
+ if base == "" {
+ t.Skip("manual preflight: set PULSE_MANUAL_OLLAMA_PREFLIGHT_URL")
+ }
+ model := os.Getenv("PULSE_MANUAL_OLLAMA_PREFLIGHT_MODEL")
+ if model == "" {
+ model = config.OllamaSuggestedPatrolModel
+ }
+
+ svc := &Service{}
+ svc.cfg = &config.AIConfig{Enabled: true, OllamaBaseURL: base}
+
+ ctx, cancel := context.WithTimeout(context.Background(), 180*time.Second)
+ defer cancel()
+
+ res := svc.RunPatrolToolPreflight(ctx, config.AIProviderOllama, model)
+ t.Logf("provider=%s model=%s success=%v toolCallObserved=%v durationMs=%d cause=%q title=%q summary=%q",
+ res.Provider, res.Model, res.Success, res.ToolCallObserved, res.DurationMs, res.Cause, res.Title, res.Summary)
+ if !res.Success || !res.ToolCallObserved {
+ t.Fatalf("blessed model %q failed Patrol preflight: %+v", model, res)
+ }
+}
diff --git a/internal/ai/modelresolution/model_resolution.go b/internal/ai/modelresolution/model_resolution.go
index e4d168dfcb..343a70686b 100644
--- a/internal/ai/modelresolution/model_resolution.go
+++ b/internal/ai/modelresolution/model_resolution.go
@@ -300,13 +300,17 @@ func resolveConfiguredProviderModel(ctx context.Context, cfg *config.AIConfig, p
// SelectRecommendedProviderModel picks the current best candidate from a provider's
// live model catalog. The policy is intentionally vendor-neutral but Assistant
// first:
-// 1. ignore obvious non-chat catalog entries such as moderation, embeddings, and
+// 1. prefer Patrol-blessed models (exact-ID match against the registry's
+// suggested models, e.g. Ollama's guided-quickstart pick) so a user who
+// followed the setup instructions gets that model without selecting it,
+// 2. ignore obvious non-chat catalog entries such as moderation, embeddings, and
// content-safety endpoints,
-// 2. prefer likely chat/instruction models over unknown model families,
-// 3. prefer notable models,
-// 4. then prefer models with a newer created timestamp,
-// 5. then fall back to a stable lexical tie-break.
+// 3. prefer likely chat/instruction models over unknown model families,
+// 4. prefer notable models,
+// 5. then prefer models with a newer created timestamp,
+// 6. then fall back to a stable lexical tie-break.
func SelectRecommendedProviderModel(models []providers.ModelInfo) (providers.ModelInfo, bool) {
+ blessed := config.SuggestedModelIDSet()
bestIndex := -1
var best providers.ModelInfo
for i, candidate := range models {
@@ -316,7 +320,7 @@ func SelectRecommendedProviderModel(models []providers.ModelInfo) (providers.Mod
if recommendedModelSuitabilityRank(candidate) >= recommendedModelRankSpecialized {
continue
}
- if bestIndex == -1 || recommendedModelBetter(candidate, i, best, bestIndex) {
+ if bestIndex == -1 || recommendedModelBetter(blessed, candidate, i, best, bestIndex) {
best = candidate
bestIndex = i
}
@@ -324,7 +328,18 @@ func SelectRecommendedProviderModel(models []providers.ModelInfo) (providers.Mod
return best, bestIndex >= 0
}
-func recommendedModelBetter(candidate providers.ModelInfo, candidateIndex int, current providers.ModelInfo, currentIndex int) bool {
+func recommendedModelBlessed(blessed map[string]struct{}, model providers.ModelInfo) bool {
+ _, ok := blessed[strings.ToLower(strings.TrimSpace(model.ID))]
+ return ok
+}
+
+func recommendedModelBetter(blessed map[string]struct{}, candidate providers.ModelInfo, candidateIndex int, current providers.ModelInfo, currentIndex int) bool {
+ candidateBlessed := recommendedModelBlessed(blessed, candidate)
+ currentBlessed := recommendedModelBlessed(blessed, current)
+ if candidateBlessed != currentBlessed {
+ return candidateBlessed
+ }
+
candidateRank := recommendedModelSuitabilityRank(candidate)
currentRank := recommendedModelSuitabilityRank(current)
if candidateRank != currentRank {
diff --git a/internal/ai/patrol_readiness.go b/internal/ai/patrol_readiness.go
index f2233949b5..be23eb8144 100644
--- a/internal/ai/patrol_readiness.go
+++ b/internal/ai/patrol_readiness.go
@@ -91,7 +91,7 @@ func PatrolToolReadinessForModel(provider, model string) (string, PatrolFailureC
case providerDefinitionIsGateway(provider):
return PatrolReadinessWarning, PatrolFailureCauseModelToolSupportUnverified, fmt.Sprintf("%s routes vary by model and endpoint. Patrol will fail closed if the routed model rejects tools or tool_choice.", config.AIProviderDisplayName(provider))
case provider == config.AIProviderOllama:
- return PatrolReadinessWarning, PatrolFailureCauseModelToolSupportUnverified, "Ollama connectivity alone does not prove tool support. Use an Ollama model that returns tool_calls for Patrol verification."
+ return PatrolReadinessWarning, PatrolFailureCauseModelToolSupportUnverified, fmt.Sprintf("Ollama connectivity alone does not prove tool support. %s passes Patrol's tool check; run ollama pull %s and select it as the Patrol model.", config.OllamaSuggestedPatrolModel, config.OllamaSuggestedPatrolModel)
default:
return PatrolReadinessReady, PatrolFailureCauseNone, "The selected provider path supports Patrol's tool-backed analysis contract."
}
diff --git a/internal/api/ai_handlers.go b/internal/api/ai_handlers.go
index 07569c4531..e23b5df312 100644
--- a/internal/api/ai_handlers.go
+++ b/internal/api/ai_handlers.go
@@ -2378,6 +2378,11 @@ type AIProviderDefinitionResponse struct {
ModelsDevProviderID string `json:"models_dev_provider_id,omitempty"`
EnvVars []string `json:"env_vars"`
DocsURL string `json:"docs_url,omitempty"`
+ // Patrol-blessed quickstart model for providers where users must pick a
+ // model themselves (Ollama). Empty for curated-catalog providers.
+ SuggestedModel string `json:"suggested_model,omitempty"`
+ SuggestedModelNote string `json:"suggested_model_note,omitempty"`
+ SuggestedModelEquivalents []string `json:"suggested_model_equivalents,omitempty"`
}
// PatrolPreflightSnapshot is the API-shaped projection of the cached
@@ -2444,6 +2449,10 @@ func aiProviderDefinitionResponses(settings *config.AIConfig) []AIProviderDefini
ModelsDevProviderID: def.ModelsDevProviderID,
EnvVars: append([]string(nil), def.EnvVars...),
DocsURL: def.DocsURL,
+ SuggestedModel: def.SuggestedModel,
+ SuggestedModelNote: def.SuggestedModelNote,
+ SuggestedModelEquivalents: append(
+ []string(nil), def.SuggestedModelEquivalents...),
})
}
return responses
diff --git a/internal/api/ai_handlers_test.go b/internal/api/ai_handlers_test.go
index c025b4b482..50bff86df2 100644
--- a/internal/api/ai_handlers_test.go
+++ b/internal/api/ai_handlers_test.go
@@ -230,6 +230,30 @@ func TestAISettingsHandler_PatrolAutonomyMonitorOnlyAllowsMonitor(t *testing.T)
require.Contains(t, premiumRec.Body.String(), "limited to Monitor")
}
+func TestAISettingsProvidersProjectionCarriesSuggestedModelWireShape(t *testing.T) {
+ payload, err := json.Marshal(aiProviderDefinitionResponses(nil))
+ require.NoError(t, err)
+
+ var decoded []map[string]any
+ require.NoError(t, json.Unmarshal(payload, &decoded))
+
+ var ollama map[string]any
+ for _, entry := range decoded {
+ if entry["id"] == config.AIProviderOllama {
+ ollama = entry
+ continue
+ }
+ // omitempty: providers without a blessing must not emit the keys.
+ require.NotContains(t, entry, "suggested_model")
+ require.NotContains(t, entry, "suggested_model_note")
+ require.NotContains(t, entry, "suggested_model_equivalents")
+ }
+ require.NotNil(t, ollama)
+ require.Equal(t, config.OllamaSuggestedPatrolModel, ollama["suggested_model"])
+ require.NotEmpty(t, ollama["suggested_model_note"])
+ require.NotEmpty(t, ollama["suggested_model_equivalents"])
+}
+
func TestAISettingsHandler_PatrolReadinessFlagsReasoningOnlyModel(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index cc4f45880a..29f99df216 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -1933,6 +1933,27 @@ func TestContract_AISettingsProviderRegistryMetadata(t *testing.T) {
if !byID["ollama"].Configured {
t.Fatal("Ollama provider metadata should reflect the default local endpoint")
}
+
+ // The Ollama guided quickstart is registry-derived: the blessed Patrol
+ // model, its hardware note, and equivalent tags ride the providers
+ // projection so the frontend never hardcodes model IDs.
+ if byID["ollama"].SuggestedModel != config.OllamaSuggestedPatrolModel {
+ t.Fatalf("Ollama suggested model = %q, want %q", byID["ollama"].SuggestedModel, config.OllamaSuggestedPatrolModel)
+ }
+ if byID["ollama"].SuggestedModelNote == "" {
+ t.Fatal("Ollama suggested model note must carry the hardware-expectation copy")
+ }
+ if len(byID["ollama"].SuggestedModelEquivalents) == 0 {
+ t.Fatal("Ollama suggested model equivalents must include the alias tags that satisfy the same blessing")
+ }
+ for id, def := range byID {
+ if id == "ollama" {
+ continue
+ }
+ if def.SuggestedModel != "" || def.SuggestedModelNote != "" || len(def.SuggestedModelEquivalents) != 0 {
+ t.Fatalf("provider %s must not carry suggested-model quickstart metadata", id)
+ }
+ }
}
func TestContract_ChartMetricPointsPreserveMillisecondPrecision(t *testing.T) {
diff --git a/internal/config/ai_additional_test.go b/internal/config/ai_additional_test.go
index 72aad3bb09..0783266ae9 100644
--- a/internal/config/ai_additional_test.go
+++ b/internal/config/ai_additional_test.go
@@ -172,7 +172,7 @@ func TestDefaultModelForProvider(t *testing.T) {
{
name: "ollama",
provider: AIProviderOllama,
- want: FormatModelString(AIProviderOllama, "llama3.2"),
+ want: FormatModelString(AIProviderOllama, OllamaSuggestedPatrolModel),
},
{
name: "retired quickstart",
diff --git a/internal/config/ai_config_test.go b/internal/config/ai_config_test.go
index fa6c4770a1..336d5cd9b2 100644
--- a/internal/config/ai_config_test.go
+++ b/internal/config/ai_config_test.go
@@ -346,7 +346,7 @@ func TestDefaultModelForProvider_UsesCanonicalProviderFallbacks(t *testing.T) {
{provider: AIProviderCerebras, expected: "cerebras:llama-4-scout-17b-16e-instruct"},
{provider: AIProviderTogether, expected: "together:meta-llama/Llama-3.3-70B-Instruct-Turbo"},
{provider: AIProviderFireworks, expected: "fireworks:accounts/fireworks/models/llama-v3p1-70b-instruct"},
- {provider: AIProviderOllama, expected: "ollama:llama3.2"},
+ {provider: AIProviderOllama, expected: "ollama:" + OllamaSuggestedPatrolModel},
{provider: AIProviderQuickstart, expected: ""},
{provider: "unknown", expected: ""},
}
diff --git a/internal/config/ai_providers.go b/internal/config/ai_providers.go
index 4400d5b8e8..f88788eaf7 100644
--- a/internal/config/ai_providers.go
+++ b/internal/config/ai_providers.go
@@ -43,8 +43,30 @@ type AIProviderDefinition struct {
EnvVars []string
DocsURL string
FallbackModels []AIProviderModelDefinition
+ // SuggestedModel is a model verified to pass Patrol's tool-call
+ // preflight, surfaced as a guided quickstart on the provider's setup
+ // row. Only set for providers where users must choose a model without
+ // a curated catalog (Ollama). Re-verify with RunPatrolToolPreflight
+ // before changing the blessing.
+ SuggestedModel string
+ // SuggestedModelNote is the hardware-expectations copy rendered next
+ // to the suggested model's pull command.
+ SuggestedModelNote string
+ // SuggestedModelEquivalents lists additional catalog IDs that satisfy
+ // the same blessing (smaller same-family tags, alias tags).
+ SuggestedModelEquivalents []string
}
+// OllamaSuggestedPatrolModel is the Ollama model blessed for Patrol:
+// verified to emit tool_calls through Patrol's preflight
+// (RunPatrolToolPreflight). qwen3 is the model family Ollama's own
+// tool-calling docs are written against. qwen3:4b was tried as a low-RAM
+// alternative and consistently failed the preflight (0/4 runs emitted a
+// tool call), so no smaller tag is suggested. When re-blessing, re-run
+// the preflight against the new tag and sweep the test pins on the
+// readiness copy.
+const OllamaSuggestedPatrolModel = "qwen3:8b"
+
func aiProviderDefinitions() []AIProviderDefinition {
return []AIProviderDefinition{
{
@@ -255,17 +277,20 @@ func aiProviderDefinitions() []AIProviderDefinition {
DocsURL: "https://docs.fireworks.ai/tools-sdks/openai-compatibility",
},
{
- ID: AIProviderOllama,
- DisplayName: "Ollama",
- Description: "Local models served by Ollama",
- Protocol: AIProviderProtocolOllama,
- DefaultModel: "llama3.2",
- DefaultBaseURL: DefaultOllamaBaseURL,
- ConfiguredField: "ollama_configured",
- ClearKeyField: "clear_ollama_url",
- BaseURLField: "ollama_base_url",
- UserConfigurable: true,
- DocsURL: "https://ollama.com",
+ ID: AIProviderOllama,
+ DisplayName: "Ollama",
+ Description: "Local models served by Ollama",
+ Protocol: AIProviderProtocolOllama,
+ DefaultModel: OllamaSuggestedPatrolModel,
+ DefaultBaseURL: DefaultOllamaBaseURL,
+ ConfiguredField: "ollama_configured",
+ ClearKeyField: "clear_ollama_url",
+ BaseURLField: "ollama_base_url",
+ UserConfigurable: true,
+ DocsURL: "https://ollama.com",
+ SuggestedModel: OllamaSuggestedPatrolModel,
+ SuggestedModelNote: "Allow about 8 GB of free RAM (5.2 GB download). Smaller qwen3 tags did not pass Patrol's tool check reliably.",
+ SuggestedModelEquivalents: []string{"qwen3:latest"},
},
{
ID: AIProviderQuickstart,
@@ -285,6 +310,7 @@ func AIProviderDefinitions() []AIProviderDefinition {
for i := range defs {
defs[i].EnvVars = append([]string(nil), defs[i].EnvVars...)
defs[i].FallbackModels = append([]AIProviderModelDefinition(nil), defs[i].FallbackModels...)
+ defs[i].SuggestedModelEquivalents = append([]string(nil), defs[i].SuggestedModelEquivalents...)
}
return defs
}
@@ -311,12 +337,40 @@ func LookupAIProviderDefinition(provider string) (AIProviderDefinition, bool) {
if def.ID == provider {
def.EnvVars = append([]string(nil), def.EnvVars...)
def.FallbackModels = append([]AIProviderModelDefinition(nil), def.FallbackModels...)
+ def.SuggestedModelEquivalents = append([]string(nil), def.SuggestedModelEquivalents...)
return def, true
}
}
return AIProviderDefinition{}, false
}
+// SuggestedModelForProvider returns the provider's Patrol-blessed model ID,
+// or "" when the provider has no blessing.
+func SuggestedModelForProvider(provider string) string {
+ def, ok := LookupAIProviderDefinition(provider)
+ if !ok {
+ return ""
+ }
+ return def.SuggestedModel
+}
+
+// SuggestedModelIDSet returns the normalized (lowercase, trimmed) union of
+// every provider's suggested model plus its equivalents. Model recommendation
+// uses exact-ID membership here so blessed models outrank catalog neighbours
+// without fuzzy family matching pulling in unrelated cloud variants.
+func SuggestedModelIDSet() map[string]struct{} {
+ out := make(map[string]struct{})
+ for _, def := range aiProviderDefinitions() {
+ for _, id := range append([]string{def.SuggestedModel}, def.SuggestedModelEquivalents...) {
+ id = strings.ToLower(strings.TrimSpace(id))
+ if id != "" {
+ out[id] = struct{}{}
+ }
+ }
+ }
+ return out
+}
+
func IsOpenAICompatibleProvider(provider string) bool {
def, ok := LookupAIProviderDefinition(provider)
return ok && def.Protocol == AIProviderProtocolOpenAICompatible
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 72cee496a5..f2c1b2e452 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -2917,7 +2917,7 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 1197,
+ "line": 1202,
"heading_line": 141,
}
],