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.

Retire self-hosted AI quickstart surfaces

rcourtmanb1e179479d02
diff --git a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
index 70f5bb87a3..cdb7ecdaad 100644
--- a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
+++ b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
@@ -51,6 +51,12 @@ Companion drill:
runtime and does not mutate entitlements. Ordinary self-hosted runtime
surfaces must still suppress trial prompts; signed support handoffs may return
through `/auth/trial-activate` only.
+ The same proof slice must keep retired hosted-AI quickstart out of normal GA
+ runtime paths: `/api/settings/ai` and `/api/ai/patrol/status` must not expose
+ quickstart credit/status fields, missing AI config in hosted mode must not
+ auto-bootstrap `quickstart:pulse-hosted`, and enabling Assistant without a
+ BYOK/local provider must fail with provider setup guidance rather than managed
+ credits.
- Live rehearsal helper:
`python3 scripts/release_control/hosted_signup_billing_replay_rehearsal.py --base-url <hosted-url> --signup-email <email> --org-name <org> ...`
- Manual scenario:
diff --git a/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md b/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md
index a2277d70f4..14d4c94178 100644
--- a/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md
+++ b/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md
@@ -424,11 +424,16 @@ Assertion design rules:
runtime may redeem signed trial activations through `/auth/trial-activate`,
but it must not mint local trial state directly or prompt users into paid
trial entry from default self-hosted surfaces.
-4. v5 to v6 commercial migration must preserve unresolved paid-license state
+4. Hosted AI quickstart is retired from ordinary v6 GA runtime paths.
+ Self-hosted and hosted app settings must stay BYOK/local-provider first unless
+ an operator explicitly configures a provider. The runtime must not auto-grant
+ quickstart credits, auto-bootstrap `quickstart:pulse-hosted`, or expose
+ quickstart credit/status fields as a normal AI Settings or Patrol contract.
+5. v5 to v6 commercial migration must preserve unresolved paid-license state
and downgrade safety.
-5. Cloud and MSP Stripe `price_*` IDs are operational fill-in items, not
+6. Cloud and MSP Stripe `price_*` IDs are operational fill-in items, not
architectural blockers.
-6. Stable or GA promotion for v6 must come from an exercised RC and stay
+7. Stable or GA promotion for v6 must come from an exercised RC and stay
blocked until the RC-to-GA promotion gate is cleared and the published v5
maintenance-policy notice is ready.
7. v6 and later releases use a promotion model, not a direct broad-rollout
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index f22484733a..648a05d6cb 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -182,8 +182,8 @@ runtime AI selection rules must stay canonical in the shared AI config model
instead of drifting into handler-local fallbacks or frontend-only assumptions.
That same provider-model ownership now explicitly forbids Pulse from baking
vendor model IDs into BYOK default selection. `internal/config/ai.go` may
-persist an explicit operator-chosen model or the Pulse-owned quickstart alias,
-but when a BYOK provider is configured without a concrete model selection,
+persist an explicit operator-chosen model, but when a BYOK provider is
+configured without a concrete model selection,
`internal/ai/model_resolution.go` must resolve the effective model from the
provider's live catalog at runtime using the shared provider metadata policy
instead of reviving static vendor constants in config defaults, service
@@ -296,11 +296,10 @@ setup surface must not reintroduce vendor-default model IDs in modal payloads
just to make the backend accept the request.
That same provider-model contract applies to the chat explore pre-pass in
`internal/ai/chat/service_explore.go`: any runtime model that is valid for the
-main chat execution path, including the Pulse-owned hosted quickstart alias
-`quickstart:pulse-hosted`, must resolve
-through the dedicated explore provider path as well. Explore must not reject
-the canonical quickstart provider while the main chat loop accepts it, because
-hosted tenants rely on the same governed quickstart model before BYOK exists.
+main chat execution path must resolve through the dedicated explore provider
+path as well. Retired quickstart model strings such as
+`quickstart:pulse-hosted` must fail closed and route the operator back to
+BYOK/local-provider setup instead of being accepted as managed-model runtime.
The same runtime ownership now includes the customer-facing AI usage and cost
surface. `frontend-modern/src/components/AI/AICostDashboard.tsx` is the
@@ -341,27 +340,20 @@ mobile tokens. Broader AI runtime surfaces must stay on their canonical AI
scopes instead of treating the mobile relay capability as a general-purpose
AI permission, and any new mobile-compatible AI route must land by extending
that governed backend inventory and proof set in the same slice.
-That same shared AI transport boundary now also owns hosted AI bootstrap.
-When Pulse Cloud runs in hosted mode and no explicit `ai.enc` exists yet,
-`internal/api/ai_hosted_runtime.go`, `internal/api/ai_handler.go`, and
-`internal/api/ai_handlers.go` must derive the initial runtime config from the
-canonical hosted billing state instead of falling back to a synthetic
-`enabled=false` default. Entitled hosted tenants that carry AI capabilities
-must persist one machine-owned quickstart-backed AI config with the canonical
-Pulse-owned alias `quickstart:pulse-hosted` so Chat and Patrol can start before
-the operator visits AI Settings, while any explicitly written AI config
-remains authoritative and must not be overwritten by hosted bootstrap. When
-the request runs under a hosted tenant org with no org-local billing lease,
-the same AI runtime path must inherit the default hosted lease for bootstrap
-and quickstart-credit reads so tenant-scoped Chat, Patrol, and AI Settings
-stay aligned with the machine-owned hosted entitlement state.
-That same hosted and self-hosted settings boundary must also normalize legacy
+That same shared AI transport boundary now also owns hosted AI bootstrap
+retirement. When Pulse Cloud runs in hosted mode and no explicit `ai.enc`
+exists yet, `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handler.go`,
+and `internal/api/ai_handlers.go` must return the same unconfigured
+BYOK/local-provider default as self-hosted settings instead of deriving a
+quickstart-backed managed-model config from hosted billing state. Any
+explicitly written AI config remains authoritative, and hosted billing state
+must not be converted into quickstart credits or a managed-model runtime.
+That same hosted and self-hosted settings boundary must also retire legacy
hosted quickstart model aliases on read and write. Persisted values such as
`quickstart:minimax-2.5m` are historical implementation detail, not governed
runtime truth, so `internal/config/ai.go`,
-`internal/config/persistence.go`, and `internal/api/ai_handlers.go` must
-rewrite them to `quickstart:pulse-hosted` before the runtime, API payloads,
-or structured logs consume those fields.
+`internal/config/persistence.go`, and `internal/api/ai_handlers.go` must clear
+them before the runtime, API payloads, or structured logs consume those fields.
That same runtime boundary also owns approval-store lifecycle in
`internal/api/ai_handler.go`. Settings-driven enablement and restart must be
able to cold-start the direct AI runtime, initialize approval persistence, and
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 95148a13ba..ee04ecc43c 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -251,7 +251,7 @@ the canonical monitored-system blocked payload.
and the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` card, so learned correlations and correlation context stay rendered through one governed frontend card instead of separate page-local list loops
and the same shared correlation card's ordering and truncation rule, so callers pass raw correlations instead of encoding their own top-N sort behavior
and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` and `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` cards' infrastructure resource-link default, so the Patrol page, resource drawer, and problem-resource dashboard panels inherit the canonical resource-filter path construction instead of rebuilding infrastructure URLs inline
- and the Patrol runtime-remediation destination shared with `/api/settings/ai`, so summary actions and runtime-finding actions may reuse the governed provider-settings route while still presenting that destination to Patrol operators as Patrol provider configuration instead of generic `AI Settings` copy
+ and the Patrol runtime-remediation destination shared with the AI settings endpoint, so summary actions and runtime-finding actions may reuse the governed provider-settings route while still presenting that destination to Patrol operators as Patrol provider configuration instead of generic `AI Settings` copy
and the Patrol route-shell destination itself, so the thin page shell at `frontend-modern/src/pages/AIIntelligence.tsx` may continue to bridge the shared AI-runtime payload boundary while exposing `/patrol` as the canonical product route and preserving `/ai` only as a compatibility redirect
and the Patrol route-shell accessibility boundary, so brand icons in `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx` stay decorative when the same heading already exposes visible Patrol text, preventing duplicate accessible names such as `Pulse Patrol Patrol`
9. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`
@@ -272,7 +272,7 @@ the canonical monitored-system blocked payload.
12. Keep `internal/api/session_store.go` on a fail-closed auth-persistence boundary: persisted OIDC refresh tokens may only round-trip through encrypted-at-rest session payloads, and any missing-crypto or invalid-ciphertext path must drop the token instead of preserving plaintext-at-rest session state.
13. Keep tenant AI handler wiring on canonical provider ownership: `internal/api/ai_handlers.go` may wire tenant `ReadState` and tenant-scoped unified-resource providers into AI services, but it must not revive tenant snapshot-provider bridges once Patrol can initialize and verify from those canonical providers directly.
14. Keep Patrol status transport semantics explicit in that same AI handler layer: the Patrol status endpoint must carry machine-readable runtime availability such as blocked, running, disabled, active, or unavailable rather than asking frontend consumers to infer operator state from stale summaries or run history.
-15. Keep legacy Patrol quickstart transport semantics explicit while those fields remain parseable: zero remaining quickstart credits are compatibility inventory data, not a standalone runtime-state override, and ordinary self-hosted frontend consumers must normalize retired hosted-model copy back to provider/local-model setup rather than presenting credit badges or acquisition prompts.
+15. Keep legacy Patrol quickstart transport semantics retired from the public v6 GA contract: ordinary AI settings and Patrol status payloads must not expose quickstart credit/status fields, and any stale hosted-model blocked copy that survives from compatibility state must normalize back to provider/local-model setup rather than presenting credit badges or acquisition prompts.
16. Keep Patrol intelligence summary transport semantics single-voiced: the canonical overall-health payload and Patrol run-history payload together must support one primary assessment plus one explicit verification explanation, and frontend consumers must not need to derive a second compact assessment or verification verdict row from the same payloads beneath the primary summary card.
17. Keep Pulse Mobile relay credential minting and permission ownership on backend ownership: `internal/api/router_routes_auth_security.go`, `internal/api/security_tokens.go`, `internal/api/auth.go`, `internal/api/relay_mobile_capability.go`, `internal/api/router_routes_ai_relay.go`, and `frontend-modern/src/api/security.ts` may expose the canonical mobile runtime token creator and governed route gates, but browser callers must only consume that route and must not define the mobile runtime scope, compatibility gate list, route inventory, or token-purpose metadata locally.
18. Keep hosted tenant browser-session precedence on the shared auth boundary: `internal/api/auth.go`, `internal/api/contract_test.go`, and hosted tenant callers must treat a valid `pulse_session` as authoritative before any API-only token fallback or no-local-auth anonymous fallback, so cloud handoff can continue into protected hosted routes without flattening the operator back to `anonymous` or forcing a browser session through bearer-token-only mode after the tenant has minted API tokens.
@@ -330,9 +330,8 @@ the canonical monitored-system blocked payload.
as compatibility input into that same canonical `agent-<hostname>`
binding, and unbound agent-exec tokens must fail closed instead of being
treated as global command authority.
-21. Keep hosted billing-state quickstart payload fields on the shared API contract: `internal/api/hosted_entitlement_refresh.go`, `internal/api/subscription_state_handlers.go`, and `internal/api/contract_test.go` must preserve `quickstart_credits_granted`, `quickstart_credits_used`, and `quickstart_credits_granted_at` through hosted signup, hosted lease refresh, and billing-state reads instead of letting lease rewrites silently erase seeded quickstart inventory.
-22. Keep hosted AI settings bootstrap on the shared API contract: `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handlers.go`, `internal/api/ai_handler.go`, and `internal/api/contract_test.go` must treat a missing `ai.enc` in hosted mode as a canonical bootstrap condition, persist one machine-owned quickstart-backed AI config with the Pulse-owned alias `quickstart:pulse-hosted` when hosted entitlements grant AI capability, and preserve that configured settings payload as the same public contract that Chat, Patrol, and AI Settings consume instead of embedding a third-party model ID in the transport contract.
- That same hosted bootstrap surface must also preserve the secure quickstart-identity contract: hosted entitlement-backed AI settings reads and enablement may bootstrap Patrol quickstart from the effective signed entitlement lease when no self-hosted installation token exists, but they must not fabricate installation-scoped activation state or anonymous client identity to satisfy `/v1/quickstart/bootstrap`.
+21. Keep hosted billing-state quickstart grants retired from new shared API flows: `internal/api/hosted_entitlement_refresh.go`, hosted signup, and trial-state construction must not auto-grant or refresh quickstart inventory for new workspaces, while low-level billing-state readers may still preserve historical fields that already exist on disk.
+22. Keep hosted AI settings bootstrap on the shared API contract as a retired path: `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handlers.go`, `internal/api/ai_handler.go`, and `internal/api/contract_test.go` must treat a missing `ai.enc` in hosted mode as an unconfigured BYOK/local-provider state, not as a machine-owned `quickstart:pulse-hosted` bootstrap condition. Hosted tenant reads may inherit billing state for commercial authorization, but they must not create quickstart-backed AI config or call the quickstart bootstrap upstream route.
23. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface: `internal/api/ai_handler.go`, `internal/api/ai_handlers.go`, `internal/api/router_routes_ai_relay.go`, and `internal/api/contract_test.go` must turn the governed approvals-list API into the canonical empty-list payload as soon as settings-driven AI enablement succeeds, rather than leaving that surface on `503 Approval store not initialized` until some separate startup-only side effect happens.
24. Keep infrastructure summary chart transport contract-backed on the shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and frontend infrastructure summary consumers must normalize long-range mixed-cadence history into equal-time summary buckets before shipping the infrastructure charts API payload, so 7-day and 30-day summary cards do not expose compressed right-edge tails just because recent samples arrive at a finer storage resolution.
25. Keep long-range workload chart transport time-proportional on the shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and workload chart consumers must cap mixed-cadence workload history by equal-time buckets rather than raw point index for the per-workload and aggregate workload chart APIs, so 7-day and 30-day workload cards do not bunch recent samples at the right edge just because recent telemetry is stored more densely.
@@ -525,32 +524,28 @@ the canonical monitored-system blocked payload.
6. Keep Patrol status payloads explicit enough that the frontend can present blocked runtime state without treating a previously healthy summary snapshot as current runtime truth, and keep Patrol recency semantics explicit in transport by reserving `last_patrol_at` for completed full patrols while exposing any Patrol activity separately through `last_activity_at`
and the scoped-trigger status payload on that same Patrol status surface, so queued scoped work, busy-mode state, and per-source enablement (`alert` versus `anomaly`) stay transport-backed instead of being inferred by page-local heuristics
and the split Patrol trigger settings contract, so `patrol_alert_triggers_enabled` and `patrol_anomaly_triggers_enabled` are the canonical AI settings fields while legacy `patrol_event_triggers_enabled` remains a compatibility aggregate rather than the primary control surface
- and the legacy quickstart compatibility contract, so `/api/settings/ai` and
- `/api/patrol/status` may continue to carry `quickstart_credits_remaining`,
- `quickstart_credits_total`, and `using_quickstart` while mixed-version
- runtimes still emit them, but those fields are no longer a normal
- self-hosted GA acquisition surface and shared handlers must not invent
- client-authored commercial identity or synthetic credits when the legacy
- server path is unavailable
+ and the retired quickstart compatibility contract, so `/api/settings/ai` and
+ `/api/ai/patrol/status` no longer carry `quickstart_credits_remaining`,
+ `quickstart_credits_total`, `quickstart_credits_available`,
+ `quickstart_blocked_reason`, or `using_quickstart` as ordinary v6 GA fields,
+ and shared handlers must not invent client-authored commercial identity,
+ synthetic credits, or quickstart-backed config when the legacy server path is
+ unavailable
and the provider-first availability rule, so missing managed-model activation
identity must not block ordinary BYOK/local setup and must not silently
attempt anonymous bootstrap
- and the Pulse-owned hosted model alias compatibility rule, so persisted
- legacy hosted quickstart model IDs such as `quickstart:minimax-2.5m` are
- rewritten to `quickstart:pulse-hosted` before `/api/settings/ai` responds,
- instead of leaking stale vendor identifiers back into governed payloads
+ and the hosted model alias retirement rule, so persisted legacy hosted
+ quickstart model IDs such as `quickstart:minimax-2.5m` are cleared before
+ `/api/settings/ai` responds, instead of leaking stale vendor identifiers or a
+ managed-model promise back into governed payloads
and the AI settings blocked-reason contract, so stale
`quickstart_blocked_reason` values are cleared or interpreted as
compatibility metadata when a provider-backed path is active or the
self-hosted app is routing the operator to provider/local-model setup
- and the public interpretation rule, so those fields must not become generic
- hosted AI quota, anonymous Community entitlement, trial CTA, account-backed
- activation support, or full-chat entitlement in normal self-hosted v6 GA UI
- and the legacy Patrol execution billing rule, so retained compatibility
- bridges that still call the hosted quickstart contract preserve the stable
- Patrol execution identifier used to charge once per higher-level Patrol run
- rather than once per internal provider
- turn
+ and the public interpretation rule, so compatibility state must not become
+ generic hosted AI quota, anonymous Community entitlement, trial CTA,
+ account-backed activation support, or full-chat entitlement in normal
+ self-hosted v6 GA UI
7. Keep Patrol summary payload consumers aligned on one assessment hierarchy: transport-driven Patrol summary surfaces may show supporting counts and outcomes, but the canonical assessment and verification states must remain singular and not be repeated as a second compact verdict strip
8. Keep Patrol verification and activity facts unified on one transport-backed secondary status area: when frontend consumers combine Patrol status payloads (`runtime_state`, `last_patrol_at`, `last_activity_at`, `trigger_status`) with run-history transport, the latest run result, activity mix, scoped-trigger state, and circuit-breaker context must read as one supporting explanation beneath the primary assessment instead of being re-expanded into a separate full-width status strip plus duplicate summary layers
and the main Patrol page composition boundary, so once that governed
@@ -2636,28 +2631,15 @@ That same frontend run-history path must also preserve and expose
`triage_flags` and `triage_skipped_llm` from canonical patrol run records so
deterministic triage-only runs do not collapse into generic "no analysis"
history entries.
-Patrol status payloads may still carry quickstart credit state as legacy API
-compatibility data while mixed-version runtimes exist:
-`quickstart_credits_remaining`, `quickstart_credits_total`, and
-`using_quickstart` must remain backend-owned when present, but the frontend must
-not turn them into normal self-hosted GA credit badges, trial prompts, or
-hosted-model acquisition copy.
-That compatibility contract must also preserve the distinction between credit
-inventory and live runtime path: zero remaining credits alone must not force a
-blocked or exhausted operator presentation while Patrol is active on a
-configured provider or local-model path.
-Those same transport fields no longer define a public self-hosted promise:
+Patrol status payloads no longer carry quickstart credit state as an ordinary
+v6 GA API contract. `quickstart_credits_remaining`,
+`quickstart_credits_total`, and `using_quickstart` are retired public fields;
pricing, README, Patrol header copy, and AI settings copy must present
provider/local-model setup and paid operational extras instead of managed
credits, anonymous bootstrap, trial CTAs, account-backed AI activation, or
-hosted-chat access.
-Hosted billing-state payloads now also carry the canonical quickstart grant
-metadata used by hosted bootstrap and refresh flows. Billing reads and contract
-proofs must preserve `quickstart_credits_granted`,
-`quickstart_credits_used`, and `quickstart_credits_granted_at` as backend-
-owned fields, so hosted entitlement refresh cannot silently drop a workspace
-back to "no quickstart inventory" just because the lease or trial state was
-rewritten.
+hosted-chat access. Historical billing-state fields may remain parseable for
+old data, but hosted signup, hosted entitlement refresh, and trial-state
+construction must not mint new quickstart inventory.
That same Patrol status contract now also carries a canonical `runtime_state`
field, so the frontend can distinguish blocked, running, disabled, active,
and unavailable Patrol runtime states without deriving operator status from
@@ -3146,19 +3128,17 @@ generated relay identity metadata instead of requiring a prior manual
only public relay fields while omitting the hosted instance secret and
private key.
That same shared backend API contract now also owns hosted AI bootstrap
-reads. `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handler.go`,
+retirement. `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handler.go`,
`internal/api/ai_handlers.go`, and `internal/api/contract_test.go` must derive
`/api/settings/ai` and the initial hosted AI runtime from the same runtime
-helper. In hosted mode, when no explicit `ai.enc` exists but the default
-hosted billing lease grants AI capability and carries hosted entitlement
-proof, those read surfaces must persist a canonical quickstart-backed AI
-config with the governed Pulse-owned alias `quickstart:pulse-hosted` instead of returning a synthetic
-`enabled=false` payload that leaves Chat and Patrol unavailable until the
-operator manually saves settings. Hosted tenant-org reads must also inherit
-the default hosted billing lease whenever no org-local billing state exists,
-so AI bootstrap and quickstart-credit surfaces stay aligned with the same
-machine-owned entitlement source. Once a real AI config exists, that explicit
-operator-owned state must remain authoritative over hosted bootstrap.
+helper. In hosted mode, when no explicit `ai.enc` exists, those read surfaces
+must return the same unconfigured BYOK/local-provider default used by
+self-hosted settings instead of persisting a quickstart-backed AI config with
+the old `quickstart:pulse-hosted` alias. Hosted tenant-org reads may still
+inherit the default hosted billing lease for commercial authorization, but they
+must not turn that lease into AI quickstart credits or a managed-model runtime.
+Once a real AI config exists, that explicit operator-owned state remains
+authoritative.
The same hosted contract now also requires tenant Pulse Assistant runtime
startup to consume that hosted-aware config path and to refuse caching a
failed tenant chat service, so tenant-org `/api/ai/status` and
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 7360220cfa..c02ce7acc3 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -495,6 +495,11 @@ Community limit enforcement.
limit pressure, paid-only settings navigation, and feature upsells unless
hosted mode, direct intent, activation/recovery state, or active entitlement
makes them relevant.
+17. Keep hosted and trial billing construction separate from retired hosted-AI
+ quickstart inventory: `pkg/licensing/trial_start.go` and hosted
+ entitlement refresh paths may preserve historical billing fields for old
+ state, but new trial or hosted workspaces must not mint quickstart credits
+ or imply a managed-model allowance as part of the commercial contract.
## Current State
@@ -1637,11 +1642,12 @@ prior email usage through `201` versus `429` drift.
Hosted billing-state normalization now follows the same rule: a missing
`plan_version` must remain missing instead of being synthesized from
`subscription_state`, while explicit trial defaults remain explicit.
-Hosted trial bootstrap and hosted entitlement refresh may still preserve legacy
-quickstart inventory fields as persisted billing compatibility while those
-fields exist. New user-facing hosted or self-hosted acquisition work should not
-depend on that inventory as a product promise, and lease-refresh rewrites must
-avoid turning legacy fields into a renewed customer-facing hosted-model offer.
+Hosted trial bootstrap and hosted entitlement refresh must not mint new
+quickstart inventory. Historical quickstart fields may remain parseable as
+persisted billing compatibility while those fields exist, but new user-facing
+hosted or self-hosted acquisition work must not depend on that inventory as a
+product promise, and lease-refresh rewrites must avoid turning legacy fields
+into a renewed customer-facing hosted-model offer.
Hosted AI runtime defaults are part of the same boundary as well: when a cloud
tenant falls back to provider defaults, the persisted model identifier must
remain canonical `provider:model` data rather than a bare provider-local alias,
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 4d21161f2c..605a1bffe2 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -247,7 +247,7 @@ provider-credit failure, the top assessment should read as a Patrol runtime
issue rather than implying infrastructure issues were detected across the
estate. When there is exactly one active Patrol runtime finding, that same
assessment copy should name the concrete runtime failure, such as
-`Insufficient API credits`, instead of reducing the state to a generic count of
+`Provider billing or quota issue`, instead of reducing the state to a generic count of
runtime findings.
That same runtime-owned assessment must expose the fix path directly. When the
primary Patrol issue is a Patrol runtime/provider problem rather than an
@@ -268,9 +268,9 @@ subject labels, so Patrol-owned synthetic service findings render as
handoff prompts.
That same title presentation contract should normalize Patrol-owned finding
titles too. The primary findings row, assistant handoff copy, and inline
-approval surfaces should present runtime findings as `Insufficient API credits`
-rather than repeating the product prefix as `Pulse Patrol: Insufficient API
-credits` once the surrounding UI already makes the Patrol context explicit.
+approval surfaces should present runtime findings as `Provider billing or quota issue`
+rather than repeating the product prefix or legacy `Insufficient API credits`
+wording once the surrounding UI already makes the Patrol context explicit.
That same finding presentation contract should own the primary remediation path
for Patrol-owned runtime findings as well. Expanded runtime-finding rows should
offer the same direct `Open Patrol provider settings` action that the top
diff --git a/frontend-modern/src/api/__tests__/patrol.test.ts b/frontend-modern/src/api/__tests__/patrol.test.ts
index 8d19812bcf..c3b8feba2f 100644
--- a/frontend-modern/src/api/__tests__/patrol.test.ts
+++ b/frontend-modern/src/api/__tests__/patrol.test.ts
@@ -62,77 +62,17 @@ describe('patrol api', () => {
it('preserves the canonical patrol runtime state payload', async () => {
apiFetchJSONMock.mockResolvedValueOnce({
runtime_state: 'blocked',
- blocked_reason:
- 'Quickstart credits exhausted. Connect your API key to continue using Patrol.',
+ blocked_reason: 'Connect a provider to power Pulse Assistant and Patrol.',
healthy: false,
} as any);
await expect(getPatrolStatus()).resolves.toMatchObject({
runtime_state: 'blocked',
- blocked_reason:
- 'Quickstart credits exhausted. Connect your API key to continue using Patrol.',
+ blocked_reason: 'Connect a provider to power Pulse Assistant and Patrol.',
healthy: false,
});
});
- it('preserves the activation-required quickstart blocked reason payload', async () => {
- const activationRequiredReason =
- 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.';
-
- apiFetchJSONMock.mockResolvedValueOnce({
- runtime_state: 'blocked',
- blocked_reason: activationRequiredReason,
- healthy: false,
- } as any);
-
- await expect(getPatrolStatus()).resolves.toMatchObject({
- runtime_state: 'blocked',
- blocked_reason: activationRequiredReason,
- healthy: false,
- });
- expect(activationRequiredReason.toLowerCase()).not.toContain('trial');
- });
-
- it('preserves activation-gated quickstart status without inventing inventory', async () => {
- apiFetchJSONMock.mockResolvedValueOnce({
- runtime_state: 'blocked',
- blocked_reason:
- 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.',
- healthy: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
- using_quickstart: false,
- } as any);
-
- await expect(getPatrolStatus()).resolves.toMatchObject({
- runtime_state: 'blocked',
- blocked_reason:
- 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.',
- healthy: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
- using_quickstart: false,
- });
- });
-
- it('preserves the canonical patrol quickstart transport fields', async () => {
- apiFetchJSONMock.mockResolvedValueOnce({
- runtime_state: 'active',
- healthy: true,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 12,
- using_quickstart: true,
- } as any);
-
- await expect(getPatrolStatus()).resolves.toMatchObject({
- runtime_state: 'active',
- healthy: true,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 12,
- using_quickstart: true,
- });
- });
-
it('preserves split patrol recency transport fields', async () => {
apiFetchJSONMock.mockResolvedValueOnce({
runtime_state: 'active',
diff --git a/frontend-modern/src/api/patrol.ts b/frontend-modern/src/api/patrol.ts
index 4dff78ee78..c66e205a68 100644
--- a/frontend-modern/src/api/patrol.ts
+++ b/frontend-modern/src/api/patrol.ts
@@ -165,16 +165,12 @@ export interface PatrolStatus {
healthy: boolean;
interval_ms: number; // Patrol interval in milliseconds
fixed_count: number; // Number of issues remediated by Patrol
- blocked_reason?: string; // Canonical server-authored Patrol block reason, including quickstart activation/exhaustion state.
+ blocked_reason?: string; // Canonical server-authored Patrol block reason.
blocked_at?: string;
license_required?: boolean;
license_status?: LicenseStatus;
upgrade_url?: string;
summary: FindingsSummary;
- // Server-authoritative Patrol quickstart inventory and runtime source for activated installs only.
- quickstart_credits_remaining?: number;
- quickstart_credits_total?: number;
- using_quickstart?: boolean;
}
/**
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 9bb385e642..cede1522b6 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -36,10 +36,7 @@ import {
doesFindingNeedAttention,
} from '@/utils/aiFindingPresentation';
-const findingsPanelSource = readFileSync(
- resolve(__dirname, '..', 'FindingsPanel.tsx'),
- 'utf-8',
-);
+const findingsPanelSource = readFileSync(resolve(__dirname, '..', 'FindingsPanel.tsx'), 'utf-8');
const patrolWorkspaceSource = readFileSync(
resolve(__dirname, '..', '..', '..', 'features', 'patrol', 'PatrolIntelligenceWorkspace.tsx'),
'utf-8',
@@ -69,7 +66,7 @@ describe('aiFindingPresentation', () => {
status: 'active',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toBe(0);
expect(
@@ -161,7 +158,7 @@ describe('aiFindingPresentation', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
label: 'Runtime issue',
@@ -179,7 +176,7 @@ describe('aiFindingPresentation', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
},
]),
).toEqual({
@@ -254,7 +251,7 @@ describe('aiFindingPresentation', () => {
getPatrolFindingClassification({
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
kind: 'runtime',
@@ -286,7 +283,7 @@ describe('aiFindingPresentation', () => {
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
resourceType: 'service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
label: 'Patrol runtime',
@@ -313,7 +310,7 @@ describe('aiFindingPresentation', () => {
getFindingPrimaryActionPresentation({
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
label: 'Open Patrol provider settings',
@@ -336,7 +333,7 @@ describe('aiFindingPresentation', () => {
getFindingPrimaryActionPresentation({
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Insufficient API credits',
+ title: 'Provider billing or quota issue',
}),
).toEqual({
label: 'Open Patrol provider settings',
@@ -346,7 +343,7 @@ describe('aiFindingPresentation', () => {
});
describe('findingTitlePresentation', () => {
- it('strips the product prefix from Patrol runtime finding titles', () => {
+ it('normalizes legacy Patrol runtime credit titles', () => {
expect(
getFindingTitlePresentation({
resourceId: 'ai-service',
@@ -354,7 +351,7 @@ describe('aiFindingPresentation', () => {
title: 'Pulse Patrol: Insufficient API credits',
}),
).toEqual({
- label: 'Insufficient API credits',
+ label: 'Provider billing or quota issue',
});
});
@@ -377,7 +374,7 @@ describe('aiFindingPresentation', () => {
getFindingManualControlsPresentation({
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
acknowledge: false,
@@ -453,7 +450,7 @@ describe('aiFindingPresentation', () => {
it('exposes the canonical primary action for Patrol runtime findings inside the expanded row', () => {
expect(findingsPanelSource).toContain('getFindingPrimaryActionPresentation');
expect(findingsPanelSource).toContain('{action().label}');
- expect(findingsPanelSource).toContain("href={action().href}");
+ expect(findingsPanelSource).toContain('href={action().href}');
});
it('resolves unified resources and shared route links for expanded finding handoffs', () => {
@@ -464,7 +461,7 @@ describe('aiFindingPresentation', () => {
expect(findingsPanelSource).toContain('const { get: getResource } = useResources();');
expect(findingsPanelSource).toContain('buildResolvedResourceSurfaceLinks({');
expect(findingsPanelSource).toContain('resource: getResource(finding.resourceId)');
- expect(findingsPanelSource).toContain("{link.compactLabel}");
+ expect(findingsPanelSource).toContain('{link.compactLabel}');
});
it('routes generic finding controls through the shared manual-controls helper', () => {
@@ -516,7 +513,7 @@ describe('aiFindingPresentation', () => {
expect(findingsPanelSource).toContain('if (hasUnknownRunSnapshot()) {');
expect(findingsPanelSource).toContain('return [];');
expect(findingsPanelSource).toContain(
- "() => props.runSnapshot !== undefined && props.filterFindingIds === undefined",
+ '() => props.runSnapshot !== undefined && props.filterFindingIds === undefined',
);
});
@@ -527,7 +524,7 @@ describe('aiFindingPresentation', () => {
});
it('uses explicit textual separators for patrol tab badges instead of css-only spacing', () => {
- expect(patrolWorkspaceSource).toContain("aria-hidden=\"true\"");
+ expect(patrolWorkspaceSource).toContain('aria-hidden="true"');
expect(patrolWorkspaceSource).toContain("{' '}");
expect(patrolWorkspaceSource).toContain('{state.findingsTabBadgeCount()}');
expect(patrolWorkspaceSource).toContain('{state.displayRunHistory().length}');
@@ -546,7 +543,9 @@ describe('aiFindingPresentation', () => {
});
it('uses canonical finding recency presentation instead of raw detected timestamps for active rows', () => {
- expect(findingsPanelSource).toContain('const recency = getFindingRecencyPresentation(finding);');
+ expect(findingsPanelSource).toContain(
+ 'const recency = getFindingRecencyPresentation(finding);',
+ );
expect(findingsPanelSource).toContain('{subject.label} - {recency.label} ');
expect(findingsPanelSource).toContain('{formatTime(recency.timestamp)}');
});
@@ -568,7 +567,9 @@ describe('aiFindingPresentation', () => {
});
it('uses the shared finding subject presentation instead of raw patrol service resource tokens', () => {
- expect(findingsPanelSource).toContain('const subject = getFindingSubjectPresentation(finding);');
+ expect(findingsPanelSource).toContain(
+ 'const subject = getFindingSubjectPresentation(finding);',
+ );
expect(findingsPanelSource).toContain('{subject.label} - {recency.label}');
expect(findingsPanelSource).not.toContain('{finding.resourceName} ({finding.resourceType})');
});
@@ -671,13 +672,13 @@ describe('aiFindingPresentation', () => {
it('promotes queued fixes without a pending approval into the needs-attention bucket', () => {
expect(
hasPendingInvestigationFixApproval('finding-1', [
- {
- status: 'pending',
- toolId: 'investigation_fix',
- targetId: 'finding-1',
- expiresAt: '2026-04-30T00:06:00Z',
- },
- ] as never),
+ {
+ status: 'pending',
+ toolId: 'investigation_fix',
+ targetId: 'finding-1',
+ expiresAt: '2026-04-30T00:06:00Z',
+ },
+ ] as never),
).toBe(true);
expect(
@@ -703,7 +704,7 @@ describe('aiFindingPresentation', () => {
status: 'pending',
toolId: 'investigation_fix',
targetId: 'finding-1',
- expiresAt: '2026-04-30T00:06:00Z',
+ expiresAt: '2026-04-30T00:06:00Z',
},
] as never,
),
@@ -724,9 +725,7 @@ describe('aiFindingPresentation', () => {
),
).toBe(false);
- expect(isPatrolInvestigationFixApproval({ toolId: 'investigation_fix' } as never)).toBe(
- true,
- );
+ expect(isPatrolInvestigationFixApproval({ toolId: 'investigation_fix' } as never)).toBe(true);
expect(isPatrolInvestigationFixApproval({ toolId: 'run_command' } as never)).toBe(false);
});
});
diff --git a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
index 06aff30392..98239f5fa4 100644
--- a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
@@ -467,15 +467,12 @@ describe('AISettings provider setup flow', () => {
cleanup();
});
- it('keeps quickstart-only installs on the provider setup path', async () => {
+ it('keeps legacy quickstart-only installs on the provider setup path', async () => {
getSettingsMock.mockResolvedValue({
...baseSettings(),
configured: true,
enabled: false,
model: 'quickstart:pulse-hosted',
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 25,
- quickstart_credits_available: true,
});
renderComponent();
@@ -497,16 +494,11 @@ describe('AISettings provider setup flow', () => {
).not.toBeInTheDocument();
});
- it('keeps activation-required quickstart guidance out of default provider setup', async () => {
+ it('keeps retired hosted quickstart guidance out of default provider setup', async () => {
getSettingsMock.mockResolvedValue({
...baseSettings(),
configured: false,
enabled: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
- quickstart_credits_available: false,
- quickstart_blocked_reason:
- 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.',
});
renderComponent();
@@ -528,17 +520,12 @@ describe('AISettings provider setup flow', () => {
expect(screen.queryByRole('button', { name: /open hosted handoff/i })).not.toBeInTheDocument();
});
- it('keeps activation-required quickstart guidance hidden when upgrade prompts are disabled', async () => {
+ it('keeps retired hosted quickstart guidance hidden when upgrade prompts are disabled', async () => {
presentationPolicyHidesUpgradePromptsMock.mockReturnValue(true);
getSettingsMock.mockResolvedValue({
...baseSettings(),
configured: false,
enabled: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
- quickstart_credits_available: false,
- quickstart_blocked_reason:
- 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.',
});
renderComponent();
diff --git a/frontend-modern/src/features/dashboardOverview/__tests__/ActionRequiredPanel.test.tsx b/frontend-modern/src/features/dashboardOverview/__tests__/ActionRequiredPanel.test.tsx
index ffd02ae680..4f2d0553e2 100644
--- a/frontend-modern/src/features/dashboardOverview/__tests__/ActionRequiredPanel.test.tsx
+++ b/frontend-modern/src/features/dashboardOverview/__tests__/ActionRequiredPanel.test.tsx
@@ -20,7 +20,7 @@ describe('ActionRequiredPanel', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
label: 'Runtime issue',
@@ -67,16 +67,16 @@ describe('ActionRequiredPanel', () => {
getFindingTitlePresentation({
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
- label: 'Insufficient API credits',
+ label: 'Provider billing or quota issue',
});
expect(
getFindingPrimaryActionPresentation({
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
label: 'Open Patrol provider settings',
@@ -86,7 +86,7 @@ describe('ActionRequiredPanel', () => {
getFindingManualControlsPresentation({
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
}),
).toEqual({
acknowledge: false,
diff --git a/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts b/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts
index 85a4712888..6e6cb24de5 100644
--- a/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts
@@ -134,8 +134,8 @@ describe('useDashboardActions', () => {
resource_id: 'ai-service',
resource_name: 'Pulse Patrol Service',
resource_type: 'service',
- title: 'Pulse Patrol: Insufficient API credits',
- description: 'Provider credits are exhausted.',
+ title: 'Pulse Patrol: Provider billing or quota issue',
+ description: 'Provider billing or quota needs attention.',
detected_at: '2026-03-01T00:01:00Z',
last_seen_at: '2026-03-01T00:05:00Z',
status: 'active',
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index c9cabfb63f..6beb0f60db 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -310,9 +310,6 @@ vi.mock('@/components/Brand/PulsePatrolLogo', () => ({
const defaultPatrolStatus = (overrides: Record<string, unknown> = {}) => ({
runtime_state: 'active',
running: false,
- using_quickstart: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
license_required: false,
blocked_reason: '',
blocked_at: '',
@@ -742,9 +739,6 @@ describe('AIIntelligence entitlement gating', () => {
getPatrolStatusMock.mockResolvedValue(
defaultPatrolStatus({
runtime_state: 'blocked',
- using_quickstart: true,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 0,
blocked_reason:
'Quickstart credits exhausted. Connect your API key to continue using Patrol.',
last_patrol_at: '2026-03-12T09:57:00Z',
@@ -801,9 +795,6 @@ describe('AIIntelligence entitlement gating', () => {
getPatrolStatusMock.mockResolvedValue(
defaultPatrolStatus({
runtime_state: 'active',
- using_quickstart: false,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 0,
last_patrol_at: '2026-03-12T09:57:00Z',
}),
);
@@ -852,9 +843,6 @@ describe('AIIntelligence entitlement gating', () => {
getPatrolStatusMock.mockResolvedValue(
defaultPatrolStatus({
runtime_state: 'blocked',
- using_quickstart: false,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 0,
blocked_reason:
'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.',
}),
@@ -880,9 +868,6 @@ describe('AIIntelligence entitlement gating', () => {
getPatrolStatusMock.mockResolvedValue(
defaultPatrolStatus({
runtime_state: 'active',
- using_quickstart: true,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 12,
last_patrol_at: '2026-03-12T09:57:00Z',
}),
);
@@ -1128,7 +1113,7 @@ describe('AIIntelligence entitlement gating', () => {
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
resourceType: 'service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
detectedAt: '2026-03-12T09:57:00Z',
},
];
@@ -1175,7 +1160,7 @@ describe('AIIntelligence entitlement gating', () => {
expect(screen.getByText('Patrol runtime issue')).toBeInTheDocument();
expect(
screen.getByText(
- 'Patrol has an active runtime issue: Insufficient API credits. Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.',
+ 'Patrol has an active runtime issue: Provider billing or quota issue. Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.',
),
).toBeInTheDocument();
expect(screen.getByText('Runtime issues')).toBeInTheDocument();
@@ -1354,7 +1339,7 @@ describe('AIIntelligence entitlement gating', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
},
];
runHistoryState.selection = {
@@ -1490,7 +1475,7 @@ describe('AIIntelligence entitlement gating', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
},
];
runHistoryState.selection = {
diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
index 2a34b08364..2a6d2b960f 100644
--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
@@ -494,8 +494,8 @@ describe('aiIntelligenceStore', () => {
resource_id: 'ai-service',
resource_name: 'Pulse Patrol Service',
resource_type: 'service',
- title: 'Pulse Patrol: Insufficient API credits',
- description: 'Provider credits are exhausted.',
+ title: 'Pulse Patrol: Provider billing or quota issue',
+ description: 'Provider billing or quota needs attention.',
detected_at: '2026-03-01T00:01:00Z',
last_seen_at: '2026-03-01T00:05:00Z',
status: 'active',
diff --git a/frontend-modern/src/types/ai.ts b/frontend-modern/src/types/ai.ts
index 53eb199978..e1f1d98bd6 100644
--- a/frontend-modern/src/types/ai.ts
+++ b/frontend-modern/src/types/ai.ts
@@ -54,14 +54,6 @@ export interface AISettings {
// AI Discovery settings
discovery_enabled?: boolean;
discovery_interval_hours?: number;
-
- // Server-authoritative Patrol quickstart inventory surfaced in AI settings for activated installs.
- quickstart_credits_total?: number;
- quickstart_credits_used?: number;
- quickstart_credits_remaining?: number;
- quickstart_credits_available?: boolean; // true when this install can currently use Patrol quickstart without BYOK
- using_quickstart?: boolean; // true when Patrol is currently using the quickstart provider on an activated install
- quickstart_blocked_reason?: string; // canonical reason when quickstart is not currently available
}
export interface AISettingsUpdateRequest {
diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
index ca3d16f795..acebd51ed6 100644
--- a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
@@ -136,14 +136,14 @@ describe('getPatrolSummaryPresentation', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
},
] as never,
}),
).toEqual({
title: 'Patrol runtime issue',
description:
- 'Patrol has an active runtime issue: Insufficient API credits. Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.',
+ 'Patrol has an active runtime issue: Provider billing or quota issue. Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.',
eyebrow: 'Patrol assessment',
compactLabel: 'Patrol runtime issue',
tone: 'warning',
@@ -173,7 +173,7 @@ describe('getPatrolSummaryPresentation', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
},
] as never,
}),
@@ -189,7 +189,7 @@ describe('getPatrolSummaryPresentation', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
},
] as never,
}),
@@ -205,8 +205,7 @@ describe('getPatrolSummaryPresentation', () => {
badgeClass:
'border-amber-200 bg-amber-100/80 text-amber-700 dark:border-amber-800 dark:bg-amber-900/40 dark:text-amber-200',
iconClass: 'text-amber-600 dark:text-amber-300',
- iconContainerClass:
- 'border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/40',
+ iconContainerClass: 'border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/40',
});
});
@@ -216,8 +215,7 @@ describe('getPatrolSummaryPresentation', () => {
badgeClass:
'border-blue-200 bg-blue-100/80 text-blue-700 dark:border-blue-800 dark:bg-blue-900/40 dark:text-blue-200',
iconClass: 'text-blue-600 dark:text-blue-300',
- iconContainerClass:
- 'border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950/40',
+ iconContainerClass: 'border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950/40',
});
});
@@ -246,7 +244,7 @@ describe('getPatrolSummaryPresentation', () => {
severity: 'warning',
resourceId: 'ai-service',
resourceName: 'Pulse Patrol Service',
- title: 'Pulse Patrol: Insufficient API credits',
+ title: 'Pulse Patrol: Provider billing or quota issue',
},
] as never,
fixedCount: 0,
diff --git a/frontend-modern/src/utils/aiFindingPresentation.ts b/frontend-modern/src/utils/aiFindingPresentation.ts
index 2e289eb907..674a5171f8 100644
--- a/frontend-modern/src/utils/aiFindingPresentation.ts
+++ b/frontend-modern/src/utils/aiFindingPresentation.ts
@@ -301,18 +301,34 @@ export const getPatrolFindingsBadgePresentation = (
findings: Pick<UnifiedFinding, 'status' | 'severity' | 'resourceId' | 'resourceName' | 'title'>[],
): PatrolFindingsBadgePresentation => {
const activeFindings = findings.filter((finding) => finding.status === 'active');
- if (activeFindings.some((finding) => finding.severity === 'critical' && !isPatrolRuntimeFinding(finding))) {
+ if (
+ activeFindings.some(
+ (finding) => finding.severity === 'critical' && !isPatrolRuntimeFinding(finding),
+ )
+ ) {
return { toneClasses: getFindingSeverityToneClasses('critical') };
}
- if (activeFindings.some((finding) => finding.severity === 'critical' && isPatrolRuntimeFinding(finding))) {
+ if (
+ activeFindings.some(
+ (finding) => finding.severity === 'critical' && isPatrolRuntimeFinding(finding),
+ )
+ ) {
return {
toneClasses: 'bg-sky-100 text-sky-700 dark:bg-sky-900 dark:text-sky-300',
};
}
- if (activeFindings.some((finding) => finding.severity === 'warning' && !isPatrolRuntimeFinding(finding))) {
+ if (
+ activeFindings.some(
+ (finding) => finding.severity === 'warning' && !isPatrolRuntimeFinding(finding),
+ )
+ ) {
return { toneClasses: getFindingSeverityToneClasses('warning') };
}
- if (activeFindings.some((finding) => finding.severity === 'warning' && isPatrolRuntimeFinding(finding))) {
+ if (
+ activeFindings.some(
+ (finding) => finding.severity === 'warning' && isPatrolRuntimeFinding(finding),
+ )
+ ) {
return {
toneClasses: 'bg-sky-100 text-sky-700 dark:bg-sky-900 dark:text-sky-300',
};
@@ -345,9 +361,15 @@ export const getFindingCompactBadgePresentation = (
export const isPatrolRuntimeFinding = (
finding: Pick<UnifiedFinding, 'resourceId' | 'resourceName' | 'title'>,
): boolean => {
- const resourceId = String(finding.resourceId || '').trim().toLowerCase();
- const resourceName = String(finding.resourceName || '').trim().toLowerCase();
- const title = String(finding.title || '').trim().toLowerCase();
+ const resourceId = String(finding.resourceId || '')
+ .trim()
+ .toLowerCase();
+ const resourceName = String(finding.resourceName || '')
+ .trim()
+ .toLowerCase();
+ const title = String(finding.title || '')
+ .trim()
+ .toLowerCase();
return (
resourceId === 'ai-service' ||
@@ -356,6 +378,17 @@ export const isPatrolRuntimeFinding = (
);
};
+export const normalizePatrolRuntimeFindingLabel = (title: string | undefined): string => {
+ const rawTitle = String(title || '').trim();
+ const normalizedTitle = rawTitle.replace(/^Pulse Patrol:\s*/i, '').trim();
+
+ if (/^insufficient api credits$/i.test(normalizedTitle)) {
+ return 'Provider billing or quota issue';
+ }
+
+ return normalizedTitle || rawTitle;
+};
+
export const getPatrolFindingClassification = (
finding: Pick<UnifiedFinding, 'resourceId' | 'resourceName' | 'title'>,
): PatrolFindingClassification =>
@@ -379,7 +412,8 @@ export const getFindingSubjectPresentation = (
return { label: 'Patrol runtime' };
}
- const resourceName = String(finding.resourceName || '').trim() || String(finding.resourceId || '').trim();
+ const resourceName =
+ String(finding.resourceName || '').trim() || String(finding.resourceId || '').trim();
const resourceType = String(finding.resourceType || '').trim();
if (!resourceType) {
@@ -399,7 +433,7 @@ export const getFindingTitlePresentation = (
return { label: rawTitle };
}
- const normalizedTitle = rawTitle.replace(/^Pulse Patrol:\s*/i, '').trim();
+ const normalizedTitle = normalizePatrolRuntimeFindingLabel(rawTitle);
return {
label: normalizedTitle || rawTitle || 'Patrol runtime issue',
};
@@ -433,9 +467,7 @@ export const getFindingManualControlsPresentation = (
dismiss: true,
};
-export const sortFindingsForAttentionQueue = (
- findings: UnifiedFinding[],
-): UnifiedFinding[] =>
+export const sortFindingsForAttentionQueue = (findings: UnifiedFinding[]): UnifiedFinding[] =>
[...findings].sort((a, b) => {
const aOutcome =
a.status === 'active' && a.investigationOutcome
@@ -484,11 +516,11 @@ export const getInvestigationStatusLabel = (status: InvestigationStatus | string
export const getInvestigationOutcomeBadgeClasses = (
outcome: InvestigationOutcome | string,
-): string => INVESTIGATION_OUTCOME_CLASSES[outcome as InvestigationOutcome] || DEFAULT_BADGE_CLASSES;
+): string =>
+ INVESTIGATION_OUTCOME_CLASSES[outcome as InvestigationOutcome] || DEFAULT_BADGE_CLASSES;
-export const getInvestigationOutcomeLabel = (
- outcome: InvestigationOutcome | string,
-): string => INVESTIGATION_OUTCOME_LABELS[outcome as InvestigationOutcome] || String(outcome);
+export const getInvestigationOutcomeLabel = (outcome: InvestigationOutcome | string): string =>
+ INVESTIGATION_OUTCOME_LABELS[outcome as InvestigationOutcome] || String(outcome);
export const getInvestigationOutcomeSortOrder = (
outcome: InvestigationOutcome | string | undefined,
@@ -502,14 +534,17 @@ export const getInvestigationOutcomeSortOrder = (
export const hasFindingInvestigationDetails = (
finding: Pick<
UnifiedFinding,
- 'investigationSessionId' | 'investigationStatus' | 'investigationOutcome' | 'investigationAttempts'
+ | 'investigationSessionId'
+ | 'investigationStatus'
+ | 'investigationOutcome'
+ | 'investigationAttempts'
>,
): boolean =>
Boolean(
finding.investigationSessionId?.trim() ||
- finding.investigationStatus ||
- finding.investigationOutcome ||
- (finding.investigationAttempts ?? 0) > 0,
+ finding.investigationStatus ||
+ finding.investigationOutcome ||
+ (finding.investigationAttempts ?? 0) > 0,
);
const ATTENTION_OUTCOMES = new Set([
@@ -565,10 +600,7 @@ export const formatFindingLifecycleType = (value: string): string =>
FINDING_LIFECYCLE_LABELS[value] || formatIdentifierLabel(value);
export const getFindingResolutionReason = (
- finding: Pick<
- UnifiedFinding,
- 'isThreshold' | 'source' | 'alertType' | 'investigationOutcome'
- >,
+ finding: Pick<UnifiedFinding, 'isThreshold' | 'source' | 'alertType' | 'investigationOutcome'>,
resolvedTime: string,
): string => {
if (finding.isThreshold || finding.source === 'threshold') {
diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.ts
index cadfe71a5e..de67fad25b 100644
--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts
+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts
@@ -1,7 +1,10 @@
import type { PatrolRunRecord, PatrolRuntimeState } from '@/api/patrol';
import type { UnifiedFinding } from '@/stores/aiIntelligence';
import type { IntelligenceHealthScore } from '@/types/aiIntelligence';
-import { isPatrolRuntimeFinding } from '@/utils/aiFindingPresentation';
+import {
+ isPatrolRuntimeFinding,
+ normalizePatrolRuntimeFindingLabel,
+} from '@/utils/aiFindingPresentation';
import {
formatPatrolActivityBreakdown,
getPatrolActivityBreakdown,
@@ -112,24 +115,21 @@ const ASSESSMENT_SHELL_PRESENTATION: Record<SemanticTone, PatrolAssessmentShellP
badgeClass:
'border-amber-200 bg-amber-100/80 text-amber-700 dark:border-amber-800 dark:bg-amber-900/40 dark:text-amber-200',
iconClass: 'text-amber-600 dark:text-amber-300',
- iconContainerClass:
- 'border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/40',
+ iconContainerClass: 'border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/40',
},
error: {
headerClass: 'bg-red-50/70 dark:bg-red-950/30',
badgeClass:
'border-red-200 bg-red-100/80 text-red-700 dark:border-red-800 dark:bg-red-900/40 dark:text-red-200',
iconClass: 'text-red-600 dark:text-red-300',
- iconContainerClass:
- 'border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950/40',
+ iconContainerClass: 'border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950/40',
},
info: {
headerClass: 'bg-blue-50/70 dark:bg-blue-950/30',
badgeClass:
'border-blue-200 bg-blue-100/80 text-blue-700 dark:border-blue-800 dark:bg-blue-900/40 dark:text-blue-200',
iconClass: 'text-blue-600 dark:text-blue-300',
- iconContainerClass:
- 'border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950/40',
+ iconContainerClass: 'border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950/40',
},
};
@@ -174,8 +174,7 @@ function getRuntimeFindingSummaryLabel(finding: PatrolAssessmentFinding | undefi
return 'a Patrol runtime issue';
}
- const trimmedTitle = title.replace(/^pulse patrol:\s*/i, '').trim();
- return trimmedTitle || title;
+ return normalizePatrolRuntimeFindingLabel(title) || title;
}
function classifyActiveFindings(activeFindings: PatrolAssessmentFinding[] | undefined) {
diff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.go
index b77543a9b7..7dd865d61d 100644
--- a/internal/ai/chat/service.go
+++ b/internal/ai/chat/service.go
@@ -958,9 +958,7 @@ func (s *Service) createProviderForModel(modelStr string) (providers.StreamingPr
baseURL := s.cfg.GetBaseURLForProvider(config.AIProviderOllama)
return providers.NewOllamaClient(modelName, baseURL, s.cfg.OllamaUsername, s.cfg.OllamaPassword, timeout)
case config.AIProviderQuickstart:
- // Quickstart uses the hosted proxy — no API key needed.
- // The licenseID is embedded in the client via orgID.
- return providers.NewQuickstartClient(s.orgID), nil
+ return nil, fmt.Errorf("quickstart provider is retired; configure a provider API key or Ollama")
default:
return nil, fmt.Errorf("unsupported provider: %s", providerName)
}
diff --git a/internal/ai/chat/service_explore.go b/internal/ai/chat/service_explore.go
index ffe76bc5b3..6fd3d79ce5 100644
--- a/internal/ai/chat/service_explore.go
+++ b/internal/ai/chat/service_explore.go
@@ -249,9 +249,7 @@ func (s *Service) createProviderForExplore(modelStr string) (providers.Streaming
baseURL := s.cfg.GetBaseURLForProvider(config.AIProviderOllama)
return providers.NewOllamaClient(modelName, baseURL, s.cfg.OllamaUsername, s.cfg.OllamaPassword, exploreHTTPTimeout)
case config.AIProviderQuickstart:
- // Quickstart uses the hosted proxy and does not require a BYOK key.
- // The orgID carries the hosted workspace identity for credit accounting.
- return providers.NewQuickstartClient(s.orgID), nil
+ return nil, fmt.Errorf("quickstart provider is retired; configure a provider API key or Ollama")
default:
return nil, fmt.Errorf("unsupported provider: %s", providerName)
}
diff --git a/internal/ai/chat/service_explore_test.go b/internal/ai/chat/service_explore_test.go
index 8107b764c9..0e2a8e7a8d 100644
--- a/internal/ai/chat/service_explore_test.go
+++ b/internal/ai/chat/service_explore_test.go
@@ -360,7 +360,7 @@ func TestResolveExploreProvider_FallsBackToNextExplicitModel(t *testing.T) {
}
}
-func TestResolveExploreProvider_SupportsQuickstartModel(t *testing.T) {
+func TestResolveExploreProvider_RetiresQuickstartModel(t *testing.T) {
svc := NewService(Config{
AIConfig: &config.AIConfig{
Enabled: true,
@@ -372,14 +372,11 @@ func TestResolveExploreProvider_SupportsQuickstartModel(t *testing.T) {
svc.orgID = "t-hosted"
provider, model := svc.resolveExploreProvider("", "", nil)
- if provider == nil {
- t.Fatal("expected explore provider resolution to succeed for quickstart")
- }
- if model != "quickstart:pulse-hosted" {
- t.Fatalf("expected quickstart explore model, got %q", model)
+ if provider != nil {
+ t.Fatalf("expected retired quickstart explore provider to be unavailable, got %q", provider.Name())
}
- if provider.Name() != config.AIProviderQuickstart {
- t.Fatalf("expected quickstart provider, got %q", provider.Name())
+ if model != "" {
+ t.Fatalf("expected retired quickstart explore model to clear, got %q", model)
}
}
diff --git a/internal/ai/model_resolution.go b/internal/ai/model_resolution.go
index 9b6766b0be..b04201adb5 100644
--- a/internal/ai/model_resolution.go
+++ b/internal/ai/model_resolution.go
@@ -57,7 +57,7 @@ func ResolveConfiguredProviderModel(ctx context.Context, cfg *config.AIConfig, p
return "", fmt.Errorf("provider is required")
}
if provider == config.AIProviderQuickstart {
- return config.DefaultModelForProvider(provider), nil
+ return "", fmt.Errorf("quickstart provider is retired; configure a provider API key or Ollama")
}
if !cfg.HasProvider(provider) {
return "", fmt.Errorf("%s provider is not configured", provider)
@@ -151,7 +151,7 @@ func isModelUsableWithConfig(cfg *config.AIConfig, model string) bool {
}
provider, _ := config.ParseModelString(model)
if provider == config.AIProviderQuickstart {
- return true
+ return false
}
return cfg != nil && cfg.HasProvider(provider)
}
diff --git a/internal/ai/patrol_ai_intelligence_test.go b/internal/ai/patrol_ai_intelligence_test.go
index 9ccde3d8e2..da0abf12d8 100644
--- a/internal/ai/patrol_ai_intelligence_test.go
+++ b/internal/ai/patrol_ai_intelligence_test.go
@@ -664,7 +664,7 @@ func TestSeedFindingsAndContext_KeepsSyntheticPatrolServiceFindings(t *testing.T
ResourceID: "ai-service",
ResourceName: "Pulse Patrol Service",
ResourceType: "service",
- Title: "Pulse Patrol: Insufficient API credits",
+ Title: "Pulse Patrol: Provider billing or quota issue",
Severity: FindingSeverityWarning,
Category: FindingCategoryReliability,
DetectedAt: time.Now().Add(-2 * time.Hour),
diff --git a/internal/ai/patrol_findings_additional_test.go b/internal/ai/patrol_findings_additional_test.go
index 6c26883b87..9c77f26d13 100644
--- a/internal/ai/patrol_findings_additional_test.go
+++ b/internal/ai/patrol_findings_additional_test.go
@@ -100,7 +100,7 @@ func TestPatrolService_DismissFinding_RejectsPatrolRuntimeFinding(t *testing.T)
ResourceID: patrolRuntimeResourceID,
ResourceName: "Pulse Patrol Service",
ResourceType: "service",
- Title: "Pulse Patrol: Insufficient API credits",
+ Title: "Pulse Patrol: Provider billing or quota issue",
}
ps.findings.Add(f)
diff --git a/internal/ai/patrol_run.go b/internal/ai/patrol_run.go
index ca137d9089..7834b01eb9 100644
--- a/internal/ai/patrol_run.go
+++ b/internal/ai/patrol_run.go
@@ -420,9 +420,9 @@ func (p *PatrolService) runPatrolWithTrigger(ctx context.Context, trigger Trigge
description = "Pulse Patrol cannot reach the quickstart proxy server. Quickstart credits require an internet connection."
recommendation = patrolQuickstartUnavailableReason
} else if strings.Contains(errMsg, "Insufficient Balance") || strings.Contains(errMsg, "402") {
- title = "Pulse Patrol: Insufficient API credits"
- description = "Pulse Patrol cannot analyze your infrastructure because your provider account has insufficient credits."
- recommendation = "Add credits to your provider account (DeepSeek, OpenAI, etc.) or switch to a different provider in Pulse Assistant settings."
+ title = "Pulse Patrol: Provider billing or quota issue"
+ description = "Pulse Patrol cannot analyze your infrastructure because the configured AI provider rejected the request for billing or quota reasons."
+ recommendation = "Resolve the billing or quota issue with your AI provider, or switch to a different provider or local model in Pulse Assistant settings."
} else if strings.Contains(errMsg, "401") || strings.Contains(errMsg, "Unauthorized") {
title = "Pulse Patrol: Invalid API key"
description = "Pulse Patrol cannot analyze your infrastructure because the API key is invalid or expired."
diff --git a/internal/ai/providers/factory.go b/internal/ai/providers/factory.go
index 6dda3cd187..e17de560e8 100644
--- a/internal/ai/providers/factory.go
+++ b/internal/ai/providers/factory.go
@@ -92,12 +92,7 @@ func NewForProvider(cfg *config.AIConfig, provider, model string) (Provider, err
return NewGeminiClient(apiKey, model, baseURL, timeout), nil
case config.AIProviderQuickstart:
- // Quickstart uses the hosted proxy — no API key needed.
- // Note: license_id is empty here; the primary quickstart paths
- // (chat/service.go and quickstart.go) inject the real org ID.
- // This factory fallback is used by ListModels/TestConnection where
- // workspace attribution is not critical.
- return NewQuickstartClient(""), nil
+ return nil, fmt.Errorf("quickstart provider is retired; configure a provider API key or Ollama")
default:
return nil, fmt.Errorf("unknown provider: %s", provider)
diff --git a/internal/ai/service.go b/internal/ai/service.go
index a03610dbe0..645fc9ad31 100644
--- a/internal/ai/service.go
+++ b/internal/ai/service.go
@@ -5,7 +5,6 @@ import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
- "errors"
"fmt"
"io"
"net"
@@ -1515,7 +1514,6 @@ func approvalNeededFromToolCall(req ExecuteRequest, tc providers.ToolCall, resul
func (s *Service) LoadConfig() error {
s.mu.RLock()
persistence := s.persistence
- quickstartCredits := s.quickstartCredits
orgID := s.orgID
s.mu.RUnlock()
@@ -1540,31 +1538,6 @@ func (s *Service) LoadConfig() error {
// Don't initialize provider if AI is not enabled or not configured
if cfg == nil || !cfg.Enabled || !cfg.IsConfigured() {
- // Check if quickstart can fill the Patrol gap (enabled but no BYOK).
- if cfg != nil && cfg.Enabled && quickstartCredits != nil {
- if err := quickstartCredits.EnsureBootstrap(context.Background()); err != nil {
- blockedReason = quickstartBlockedReasonFromError(err)
- log.Warn().Err(err).Str("orgID", orgID).Msg("Quickstart bootstrap failed during AI service load")
- }
- qp := quickstartCredits.GetProvider()
- if qp != nil {
- providerClient = qp
- usingQuickstart = true
- // Force all model strings to quickstart so chat.Service creates the right provider.
- quickstartModelStr := config.DefaultModelForProvider(config.AIProviderQuickstart)
- cfg.Model = quickstartModelStr
- cfg.PatrolModel = quickstartModelStr
- cfg.ChatModel = quickstartModelStr
- log.Info().
- Int("credits_remaining", quickstartCredits.CreditsRemaining()).
- Msg("AI service initialized via quickstart credits (no BYOK)")
- }
- if providerClient == nil && blockedReason == "" && !quickstartCredits.HasCredits() {
- blockedReason = patrolQuickstartCreditsExhaustedReason
- } else if providerClient == nil && blockedReason == "" {
- blockedReason = patrolQuickstartUnavailableReason
- }
- }
} else {
selectedModel, resolveErr := ResolveConfiguredModel(modelResolutionCtx, cfg)
if resolveErr != nil {
@@ -1573,27 +1546,6 @@ func (s *Service) LoadConfig() error {
cfg.Model = selectedModel
selectedProvider, _ := config.ParseModelString(selectedModel)
- // BYOK transition: if the user added their own API key while the model
- // was still set to quickstart, switch to the BYOK provider's default.
- if selectedProvider == config.AIProviderQuickstart && cfg.IsConfigured() {
- var byokDefault string
- configuredProviders := cfg.GetConfiguredProviders()
- if len(configuredProviders) > 0 {
- byokDefault, _ = ResolveConfiguredProviderModel(modelResolutionCtx, cfg, configuredProviders[0])
- }
- if byokDefault != "" {
- log.Info().
- Str("from", selectedModel).
- Str("to", byokDefault).
- Msg("AI service: BYOK configured, switching from quickstart model")
- selectedModel = byokDefault
- selectedProvider, _ = config.ParseModelString(selectedModel)
- cfg.Model = selectedModel
- cfg.PatrolModel = "" // Let it inherit from Model
- cfg.ChatModel = "" // Let it inherit from Model
- }
- }
-
nextProvider, providerErr := providers.NewForModel(cfg, selectedModel)
if providerErr != nil {
// Smart fallback: if selected provider isn't configured but OTHER providers are,
@@ -1669,18 +1621,6 @@ func (s *Service) IsEnabled() bool {
s.mu.RLock()
defer s.mu.RUnlock()
if s.cfg != nil && s.cfg.Enabled && s.provider != nil {
- // When running on quickstart credits, verify credits still remain.
- if s.usingQuickstart && s.quickstartCredits != nil && !s.quickstartCredits.HasCredits() {
- return false
- }
- return true
- }
- // Also enabled if quickstart credits are available (even without BYOK)
- if s.cfg != nil &&
- s.cfg.Enabled &&
- s.quickstartCredits != nil &&
- s.quickstartCredits.HasCredits() &&
- strings.TrimSpace(s.quickstartBlockedReason) == "" {
return true
}
return false
@@ -1734,54 +1674,25 @@ func (s *Service) configurePatrolQuickstartProviderFactoryLocked() {
func (s *Service) createPatrolProviderForModel(modelStr string) (providers.StreamingProvider, error) {
s.mu.RLock()
cfg := s.cfg
- quickstartMgr := s.quickstartCredits
defaultProvider := s.provider
s.mu.RUnlock()
providerName, _ := config.ParseModelString(modelStr)
- if providerName != config.AIProviderQuickstart {
- provider, err := providers.NewForModel(cfg, modelStr)
- if err != nil {
- if streaming, ok := defaultProvider.(providers.StreamingProvider); ok {
- return streaming, nil
- }
- return nil, err
- }
- streaming, ok := provider.(providers.StreamingProvider)
- if !ok {
- return nil, fmt.Errorf("patrol provider %q does not support streaming", provider.Name())
- }
- return streaming, nil
+ if providerName == config.AIProviderQuickstart {
+ return nil, fmt.Errorf("quickstart provider is retired; configure a provider API key or Ollama")
}
- if quickstartMgr == nil {
- return nil, fmt.Errorf("quickstart is not configured")
- }
- if err := quickstartMgr.EnsureBootstrap(context.Background()); err != nil {
- s.mu.Lock()
- s.quickstartBlockedReason = quickstartBlockedReasonFromError(err)
- s.mu.Unlock()
- return nil, err
- }
- provider := quickstartMgr.GetProvider()
- if provider == nil {
- reason := patrolQuickstartUnavailableReason
- if !quickstartMgr.HasCredits() {
- reason = patrolQuickstartCreditsExhaustedReason
+ provider, err := providers.NewForModel(cfg, modelStr)
+ if err != nil {
+ if streaming, ok := defaultProvider.(providers.StreamingProvider); ok {
+ return streaming, nil
}
- s.mu.Lock()
- s.quickstartBlockedReason = reason
- s.mu.Unlock()
- return nil, errors.New(reason)
+ return nil, err
}
streaming, ok := provider.(providers.StreamingProvider)
if !ok {
- return nil, fmt.Errorf("quickstart provider does not support streaming")
+ return nil, fmt.Errorf("patrol provider %q does not support streaming", provider.Name())
}
-
- s.mu.Lock()
- s.quickstartBlockedReason = ""
- s.mu.Unlock()
return streaming, nil
}
diff --git a/internal/ai/service_quickstart_test.go b/internal/ai/service_quickstart_test.go
index 7dea78fe3d..4284300bd6 100644
--- a/internal/ai/service_quickstart_test.go
+++ b/internal/ai/service_quickstart_test.go
@@ -63,7 +63,7 @@ func TestServiceLoadConfig_PrefersBYOKProviderOverQuickstart(t *testing.T) {
}
}
-func TestServiceLoadConfig_TracksQuickstartBootstrapFailure(t *testing.T) {
+func TestServiceLoadConfig_IgnoresQuickstartBootstrapFailureWhenNoBYOK(t *testing.T) {
dir := t.TempDir()
persistence := config.NewConfigPersistence(dir)
cfg := config.NewDefaultAIConfig()
@@ -80,15 +80,15 @@ func TestServiceLoadConfig_TracksQuickstartBootstrapFailure(t *testing.T) {
if err := svc.LoadConfig(); err != nil {
t.Fatalf("LoadConfig(): %v", err)
}
- if svc.QuickstartBlockedReason() != patrolQuickstartUnavailableReason {
- t.Fatalf("QuickstartBlockedReason() = %q, want %q", svc.QuickstartBlockedReason(), patrolQuickstartUnavailableReason)
+ if svc.QuickstartBlockedReason() != "" {
+ t.Fatalf("QuickstartBlockedReason() = %q, want empty for retired quickstart", svc.QuickstartBlockedReason())
}
if svc.IsEnabled() {
- t.Fatal("expected AI service to remain disabled when bootstrap failed and no BYOK exists")
+ t.Fatal("expected AI service to remain disabled when no BYOK/local provider exists")
}
}
-func TestServiceLoadConfig_TracksQuickstartActivationRequirement(t *testing.T) {
+func TestServiceLoadConfig_IgnoresQuickstartActivationRequirementWhenNoBYOK(t *testing.T) {
dir := t.TempDir()
persistence := config.NewConfigPersistence(dir)
cfg := config.NewDefaultAIConfig()
@@ -105,10 +105,10 @@ func TestServiceLoadConfig_TracksQuickstartActivationRequirement(t *testing.T) {
if err := svc.LoadConfig(); err != nil {
t.Fatalf("LoadConfig(): %v", err)
}
- if svc.QuickstartBlockedReason() != patrolQuickstartActivationRequiredReason {
- t.Fatalf("QuickstartBlockedReason() = %q, want %q", svc.QuickstartBlockedReason(), patrolQuickstartActivationRequiredReason)
+ if svc.QuickstartBlockedReason() != "" {
+ t.Fatalf("QuickstartBlockedReason() = %q, want empty for retired quickstart", svc.QuickstartBlockedReason())
}
if svc.IsEnabled() {
- t.Fatal("expected AI service to remain disabled when activation is required and no BYOK exists")
+ t.Fatal("expected AI service to remain disabled when no BYOK/local provider exists")
}
}
diff --git a/internal/api/ai_handler_test.go b/internal/api/ai_handler_test.go
index 70eb23803e..777fc30956 100644
--- a/internal/api/ai_handler_test.go
+++ b/internal/api/ai_handler_test.go
@@ -1100,7 +1100,7 @@ func TestGetService_MultiTenantUsesTenantReadState(t *testing.T) {
mockSvc.AssertExpectations(t)
}
-func TestGetService_HostedTenantAutoBootstrapsAndStartsService(t *testing.T) {
+func TestGetService_HostedTenantDoesNotAutoBootstrapQuickstartService(t *testing.T) {
oldNewService := newChatService
defer func() { newChatService = oldNewService }()
@@ -1115,32 +1115,20 @@ func TestGetService_HostedTenantAutoBootstrapsAndStartsService(t *testing.T) {
h := NewAIHandler(mtp, nil, nil)
h.hostedMode = true
- mockSvc := new(MockAIService)
- mockSvc.On("Start", mock.Anything).Return(nil).Once()
-
- var gotCfg chat.Config
newChatService = func(cfg chat.Config) AIService {
- gotCfg = cfg
- return mockSvc
+ t.Fatalf("newChatService must not be called without explicit BYOK/local AI config: %#v", cfg.AIConfig)
+ return nil
}
ctx := context.WithValue(context.Background(), OrgIDContextKey, "t-tenant")
svc := h.GetService(ctx)
- assert.Same(t, mockSvc, svc)
-
- if gotCfg.AIConfig == nil {
- t.Fatal("expected tenant chat service to receive hosted-aware AI config")
- }
- assert.True(t, gotCfg.AIConfig.Enabled)
- assert.Equal(t, config.DefaultModelForProvider(config.AIProviderQuickstart), gotCfg.AIConfig.GetChatModel())
+ assert.Nil(t, svc)
persistence, err := mtp.GetPersistence("t-tenant")
if err != nil {
t.Fatalf("GetPersistence(t-tenant): %v", err)
}
- assert.True(t, persistence.HasAIConfig())
-
- mockSvc.AssertExpectations(t)
+ assert.False(t, persistence.HasAIConfig())
}
func TestGetService_MultiTenantStartFailureDoesNotCacheDeadService(t *testing.T) {
diff --git a/internal/api/ai_handlers.go b/internal/api/ai_handlers.go
index a4f82b51ed..0744926f11 100644
--- a/internal/api/ai_handlers.go
+++ b/internal/api/ai_handlers.go
@@ -225,18 +225,7 @@ func NewAISettingsHandler(mtp *config.MultiTenantPersistence, mtm *monitoring.Mu
defaultAIService = ai.NewService(defaultPersistence, agentServer)
defaultAIService.SetOrgID("default")
defaultAIService.SetAlertAnalyzerFactory(getCreateAlertAnalyzer())
- // Wire quickstart credit manager before LoadConfig so the quickstart
- // provider path is available during initial configuration.
if defaultPersistence != nil {
- qsMgr := ai.NewPersistentQuickstartCreditManager(
- defaultPersistence,
- "default",
- func() *config.AIConfig {
- cfg, _ := handler.loadAIConfigForPersistence(context.Background(), "default", defaultPersistence)
- return cfg
- },
- )
- defaultAIService.SetQuickstartCredits(qsMgr)
if _, err := handler.loadAIConfigForPersistence(context.Background(), "default", defaultPersistence); err != nil {
log.Warn().Err(err).Msg("Failed to bootstrap Pulse Assistant config on startup")
}
@@ -320,17 +309,6 @@ func (h *AISettingsHandler) GetAIService(ctx context.Context) *ai.Service {
svc = ai.NewService(persistence, h.agentServer)
svc.SetOrgID(orgID)
svc.SetAlertAnalyzerFactory(getCreateAlertAnalyzer())
- // Wire quickstart credit manager before LoadConfig so the quickstart
- // provider path is available during initial configuration.
- qsMgr := ai.NewPersistentQuickstartCreditManager(
- persistence,
- orgID,
- func() *config.AIConfig {
- cfg, _ := h.loadAIConfigForPersistence(context.Background(), orgID, persistence)
- return cfg
- },
- )
- svc.SetQuickstartCredits(qsMgr)
if _, err := h.loadAIConfigForPersistence(context.Background(), orgID, persistence); err != nil {
log.Warn().Str("orgID", orgID).Err(err).Msg("Failed to bootstrap Pulse Assistant config for tenant")
}
@@ -2200,13 +2178,6 @@ type AISettingsResponse struct {
// Discovery settings
DiscoveryEnabled bool `json:"discovery_enabled"` // true if discovery is enabled
DiscoveryIntervalHours int `json:"discovery_interval_hours,omitempty"` // Hours between auto-scans (0 = manual only)
- // Quickstart credits
- QuickstartCreditsTotal int `json:"quickstart_credits_total"` // Total credits granted (25)
- QuickstartCreditsUsed int `json:"quickstart_credits_used"` // Credits consumed
- QuickstartCreditsRemaining int `json:"quickstart_credits_remaining"` // Credits remaining
- QuickstartCreditsAvailable bool `json:"quickstart_credits_available"` // true if quickstart credits are usable
- UsingQuickstart bool `json:"using_quickstart"` // true if currently using quickstart provider
- QuickstartBlockedReason string `json:"quickstart_blocked_reason,omitempty"` // canonical reason when quickstart is not currently usable
}
func EmptyAISettingsResponse() AISettingsResponse {
@@ -2275,45 +2246,6 @@ type AISettingsUpdateRequest struct {
DiscoveryIntervalHours *int `json:"discovery_interval_hours,omitempty"` // Hours between auto-scans (0 = manual only)
}
-// populateQuickstartFields fills quickstart credit info on an AISettingsResponse.
-func (h *AISettingsHandler) populateQuickstartFields(ctx context.Context, resp *AISettingsResponse) {
- aiSvc := h.GetAIService(ctx)
- if aiSvc == nil {
- return
- }
- qsMgr := aiSvc.GetQuickstartCredits()
- if qsMgr == nil {
- return
- }
- var bootstrapErr error
- if err := qsMgr.EnsureBootstrap(ctx); err != nil {
- bootstrapErr = err
- log.Debug().Err(err).Msg("Quickstart bootstrap unavailable while populating AI settings")
- }
- resp.QuickstartCreditsTotal = qsMgr.CreditsTotal()
- remaining := qsMgr.CreditsRemaining()
- resp.QuickstartCreditsRemaining = remaining
- if resp.QuickstartCreditsTotal > remaining {
- resp.QuickstartCreditsUsed = resp.QuickstartCreditsTotal - remaining
- }
- resp.QuickstartCreditsAvailable = qsMgr.HasCredits()
- resp.UsingQuickstart = aiSvc.IsUsingQuickstart()
- if len(resp.ConfiguredProviders) > 0 && !resp.UsingQuickstart {
- resp.QuickstartBlockedReason = ""
- return
- }
- switch {
- case resp.QuickstartCreditsAvailable:
- resp.QuickstartBlockedReason = ""
- case resp.QuickstartCreditsTotal > 0 && remaining <= 0:
- resp.QuickstartBlockedReason = ai.QuickstartCreditsExhaustedReason()
- case bootstrapErr != nil:
- resp.QuickstartBlockedReason = strings.TrimSpace(ai.QuickstartBlockedReasonForError(bootstrapErr))
- default:
- resp.QuickstartBlockedReason = ""
- }
-}
-
// AssistantEnabled reports whether the Pulse Assistant affordance should be
// shown in the authenticated shell without forcing the browser to probe the
// full AI settings API on every route bootstrap.
@@ -2339,11 +2271,7 @@ func (h *AISettingsHandler) AssistantEnabled(ctx context.Context) bool {
return true
}
- response := AISettingsResponse{
- ConfiguredProviders: settings.GetConfiguredProviders(),
- }.NormalizeCollections()
- h.populateQuickstartFields(ctx, &response)
- return response.QuickstartCreditsAvailable
+ return false
}
func aiSettingsRequireModelResolution(settings *config.AIConfig) bool {
@@ -2439,14 +2367,6 @@ func (h *AISettingsHandler) HandleGetAISettings(w http.ResponseWriter, r *http.R
DiscoveryIntervalHours: settings.DiscoveryIntervalHours,
}.NormalizeCollections()
- // Populate quickstart credit info
- h.populateQuickstartFields(ctx, &response)
-
- // If quickstart credits are available, mark as configured even without BYOK
- if response.QuickstartCreditsAvailable && !response.Configured {
- response.Configured = true
- }
-
if err := utils.WriteJSONResponse(w, response); err != nil {
log.Error().Err(err).Msg("Failed to write AI settings response")
}
@@ -2582,44 +2502,13 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
settings.OpenAIBaseURL = strings.TrimSpace(*req.OpenAIBaseURL)
}
- // Track whether we should opportunistically refresh quickstart state after validation.
- refreshQuickstartState := false
if req.Enabled != nil {
- // Only allow enabling if at least one provider is configured OR quickstart credits are available
+ // Only allow enabling if at least one BYOK/local provider is configured.
if *req.Enabled {
configuredProviders := settings.GetConfiguredProviders()
if len(configuredProviders) == 0 {
- // Check if quickstart credits can bridge the gap
- aiSvc := h.GetAIService(r.Context())
- hasQuickstart := false
- var bootstrapErr error
- if aiSvc != nil {
- if qsMgr := aiSvc.GetQuickstartCredits(); qsMgr != nil {
- bootstrapErr = qsMgr.EnsureBootstrap(r.Context())
- hasQuickstart = qsMgr.HasCredits() && qsMgr.GetProvider() != nil
- }
- }
- if !hasQuickstart {
- blockedReason := strings.TrimSpace(ai.QuickstartBlockedReasonForError(bootstrapErr))
- switch blockedReason {
- case ai.QuickstartActivationRequiredReason():
- http.Error(w, blockedReason, http.StatusConflict)
- return
- case ai.QuickstartUnavailableReason():
- http.Error(w, ai.QuickstartUnavailableReason(), http.StatusBadGateway)
- return
- }
- http.Error(w, "Please configure a provider (API key or Ollama URL) before enabling Pulse Assistant", http.StatusBadRequest)
- return
- }
- // Quickstart credits available — allow enabling without BYOK.
- // Persist all model strings so chat.Service restart picks them
- // up from disk. All three must point to quickstart — any stale
- // BYOK model reference would cause the chat service to fail.
- quickstartModelStr := config.DefaultModelForProvider(config.AIProviderQuickstart)
- settings.Model = quickstartModelStr
- settings.PatrolModel = quickstartModelStr
- settings.ChatModel = quickstartModelStr
+ http.Error(w, "Please configure a provider (API key or Ollama URL) before enabling Pulse Assistant", http.StatusBadRequest)
+ return
} else {
if aiSettingsRequireModelResolution(settings) {
resolvedModel, resolveErr := ai.ResolveConfiguredModel(r.Context(), settings)
@@ -2629,9 +2518,6 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
}
settings.Model = resolvedModel
}
- // BYOK is configured — refresh quickstart state best-effort so the
- // Patrol status API can still report the current server snapshot.
- refreshQuickstartState = true
}
}
settings.Enabled = *req.Enabled
@@ -2762,17 +2648,6 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
settings.DiscoveryIntervalHours = 24
}
- // Refresh quickstart bootstrap state now that validation has passed.
- if refreshQuickstartState {
- if aiSvc := h.GetAIService(r.Context()); aiSvc != nil {
- if qsMgr := aiSvc.GetQuickstartCredits(); qsMgr != nil {
- if err := qsMgr.EnsureBootstrap(r.Context()); err != nil {
- log.Warn().Err(err).Msg("Failed to refresh quickstart bootstrap state")
- }
- }
- }
- }
-
if aiSettingsRequireModelResolution(settings) {
resolvedModel, resolveErr := ai.ResolveConfiguredModel(r.Context(), settings)
if resolveErr != nil {
@@ -2875,14 +2750,6 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
DiscoveryIntervalHours: settings.DiscoveryIntervalHours,
}.NormalizeCollections()
- // Populate quickstart credit info
- h.populateQuickstartFields(r.Context(), &response)
-
- // If quickstart credits are available, mark as configured even without BYOK
- if response.QuickstartCreditsAvailable && !response.Configured {
- response.Configured = true
- }
-
if err := utils.WriteJSONResponse(w, response); err != nil {
log.Error().Err(err).Msg("Failed to write AI settings update response")
}
@@ -4883,10 +4750,6 @@ type PatrolStatusResponse struct {
FixedCount int `json:"fixed_count"` // Number of issues remediated by Patrol
BlockedReason string `json:"blocked_reason,omitempty"`
BlockedAt *time.Time `json:"blocked_at,omitempty"`
- // Quickstart credit info for Patrol quickstart mode
- QuickstartCreditsRemaining int `json:"quickstart_credits_remaining"`
- QuickstartCreditsTotal int `json:"quickstart_credits_total"`
- UsingQuickstart bool `json:"using_quickstart"`
// License status for Pro feature gating
LicenseRequired bool `json:"license_required"` // True if Pro license needed for full features
LicenseStatus string `json:"license_status"` // "active", "expired", "grace_period", "none"
@@ -4911,6 +4774,23 @@ func writePatrolServiceUnavailableResponse(w http.ResponseWriter) {
writeErrorResponse(w, http.StatusServiceUnavailable, "service_unavailable", "Pulse Patrol service not available", nil)
}
+func retireQuickstartPatrolStatus(status ai.PatrolStatus) ai.PatrolStatus {
+ switch strings.TrimSpace(status.BlockedReason) {
+ case ai.QuickstartCreditsExhaustedReason(), ai.QuickstartActivationRequiredReason():
+ status.BlockedReason = ""
+ status.BlockedAt = nil
+ if status.RuntimeState == ai.PatrolRuntimeStateBlocked {
+ if status.Enabled {
+ status.RuntimeState = ai.PatrolRuntimeStateActive
+ } else {
+ status.RuntimeState = ai.PatrolRuntimeStateUnavailable
+ }
+ status.Healthy = true
+ }
+ }
+ return status
+}
+
// HandleGetPatrolStatus returns the current patrol status (GET /api/ai/patrol/status)
func (h *AISettingsHandler) HandleGetPatrolStatus(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
@@ -4958,7 +4838,7 @@ func (h *AISettingsHandler) HandleGetPatrolStatus(w http.ResponseWriter, r *http
return
}
- status := patrol.GetStatus()
+ status := retireQuickstartPatrolStatus(patrol.GetStatus())
summary := patrol.GetFindingsSummary()
// Determine license status for Pro feature gating
@@ -4974,27 +4854,24 @@ func (h *AISettingsHandler) HandleGetPatrolStatus(w http.ResponseWriter, r *http
}
response := PatrolStatusResponse{
- RuntimeState: status.RuntimeState,
- Running: status.Running,
- Enabled: status.Enabled,
- LastPatrolAt: status.LastPatrolAt,
- LastActivityAt: status.LastActivityAt,
- TriggerStatus: status.TriggerStatus,
- NextPatrolAt: status.NextPatrolAt,
- LastDurationMs: status.LastDuration.Milliseconds(),
- ResourcesChecked: status.ResourcesChecked,
- FindingsCount: status.FindingsCount,
- ErrorCount: status.ErrorCount,
- Healthy: status.Healthy,
- IntervalMs: status.IntervalMs,
- FixedCount: fixedCount,
- BlockedReason: status.BlockedReason,
- BlockedAt: status.BlockedAt,
- QuickstartCreditsRemaining: status.QuickstartCreditsRemaining,
- QuickstartCreditsTotal: status.QuickstartCreditsTotal,
- UsingQuickstart: status.UsingQuickstart,
- LicenseRequired: !hasAutoFixFeature,
- LicenseStatus: licenseStatus,
+ RuntimeState: status.RuntimeState,
+ Running: status.Running,
+ Enabled: status.Enabled,
+ LastPatrolAt: status.LastPatrolAt,
+ LastActivityAt: status.LastActivityAt,
+ TriggerStatus: status.TriggerStatus,
+ NextPatrolAt: status.NextPatrolAt,
+ LastDurationMs: status.LastDuration.Milliseconds(),
+ ResourcesChecked: status.ResourcesChecked,
+ FindingsCount: status.FindingsCount,
+ ErrorCount: status.ErrorCount,
+ Healthy: status.Healthy,
+ IntervalMs: status.IntervalMs,
+ FixedCount: fixedCount,
+ BlockedReason: status.BlockedReason,
+ BlockedAt: status.BlockedAt,
+ LicenseRequired: !hasAutoFixFeature,
+ LicenseStatus: licenseStatus,
}
if !hasAutoFixFeature {
response.UpgradeURL = upgradeURLForFeatureFromLicensing(featureAIAutoFixValue)
diff --git a/internal/api/ai_handlers_patrol_actions_additional_test.go b/internal/api/ai_handlers_patrol_actions_additional_test.go
index f7a9585acc..bb71ee66f8 100644
--- a/internal/api/ai_handlers_patrol_actions_additional_test.go
+++ b/internal/api/ai_handlers_patrol_actions_additional_test.go
@@ -86,8 +86,8 @@ func addPatrolRuntimeFinding(t *testing.T, patrol *ai.PatrolService, id string,
Key: "ai-patrol-error",
Severity: ai.FindingSeverityWarning,
Category: ai.FindingCategoryReliability,
- Title: "Pulse Patrol: Insufficient API credits",
- Description: "Patrol could not complete because provider credits are exhausted",
+ Title: "Pulse Patrol: Provider billing or quota issue",
+ Description: "Patrol could not complete because provider billing or quota needs attention",
ResourceID: "ai-service",
ResourceName: "Pulse Patrol Service",
ResourceType: "service",
@@ -107,8 +107,8 @@ func addUnifiedRuntimeFinding(store *unified.UnifiedStore, id string, detectedAt
ResourceID: "ai-service",
ResourceName: "Pulse Patrol Service",
ResourceType: "service",
- Title: "Pulse Patrol: Insufficient API credits",
- Description: "Patrol could not complete because provider credits are exhausted",
+ Title: "Pulse Patrol: Provider billing or quota issue",
+ Description: "Patrol could not complete because provider billing or quota needs attention",
DetectedAt: detectedAt,
}
store.AddFromAI(finding)
@@ -141,7 +141,7 @@ func (m *stubQuickstartCreditManager) GetProvider() providers.Provider {
return providers.NewQuickstartClientWithToken("qst_live_test", nil, nil)
}
-func TestHandleGetPatrolStatus_IncludesQuickstartFields(t *testing.T) {
+func TestHandleGetPatrolStatus_DoesNotExposeQuickstartFields(t *testing.T) {
handler, _, _, _ := setupAIHandlerWithPatrol(t)
handler.defaultAIService.SetQuickstartCredits(&stubQuickstartCreditManager{remaining: 7})
@@ -161,18 +161,13 @@ func TestHandleGetPatrolStatus_IncludesQuickstartFields(t *testing.T) {
t.Fatalf("decode response: %v", err)
}
- if resp.QuickstartCreditsRemaining != 7 {
- t.Fatalf("quickstart credits remaining = %d, want 7", resp.QuickstartCreditsRemaining)
- }
- if resp.QuickstartCreditsTotal != pkglicensing.QuickstartCreditsTotal {
- t.Fatalf("quickstart credits total = %d, want %d", resp.QuickstartCreditsTotal, pkglicensing.QuickstartCreditsTotal)
- }
- if !resp.UsingQuickstart {
- t.Fatal("expected using_quickstart to be true")
+ body := rec.Body.String()
+ if strings.Contains(body, "quickstart_credits") || strings.Contains(body, "using_quickstart") {
+ t.Fatalf("patrol status must not expose retired quickstart fields: %s", body)
}
}
-func TestHandleGetPatrolStatus_DerivesBlockedRuntimeStateForExhaustedQuickstartCredits(t *testing.T) {
+func TestHandleGetPatrolStatus_DoesNotSurfaceExhaustedQuickstartCredits(t *testing.T) {
handler, _, _, _ := setupAIHandlerWithPatrol(t)
handler.defaultAIService.SetQuickstartCredits(&stubQuickstartCreditManager{remaining: 0})
@@ -191,14 +186,14 @@ func TestHandleGetPatrolStatus_DerivesBlockedRuntimeStateForExhaustedQuickstartC
t.Fatalf("decode response: %v", err)
}
- if resp.RuntimeState != ai.PatrolRuntimeStateBlocked {
- t.Fatalf("runtime_state = %q, want %q", resp.RuntimeState, ai.PatrolRuntimeStateBlocked)
+ if resp.RuntimeState == ai.PatrolRuntimeStateBlocked {
+ t.Fatalf("runtime_state = %q, want non-blocked for retired quickstart", resp.RuntimeState)
}
- if resp.BlockedReason != "Quickstart credits exhausted. Connect your API key to continue using AI Patrol." {
- t.Fatalf("blocked_reason = %q", resp.BlockedReason)
+ if strings.Contains(strings.ToLower(resp.BlockedReason), "quickstart") {
+ t.Fatalf("blocked_reason must not expose retired quickstart copy, got %q", resp.BlockedReason)
}
- if resp.Healthy {
- t.Fatal("expected blocked patrol response to report healthy=false")
+ if !resp.Healthy {
+ t.Fatal("expected retired quickstart state to remain healthy on the public status surface")
}
}
diff --git a/internal/api/ai_handlers_test.go b/internal/api/ai_handlers_test.go
index 4629839e4b..01e633b60a 100644
--- a/internal/api/ai_handlers_test.go
+++ b/internal/api/ai_handlers_test.go
@@ -250,16 +250,8 @@ func TestAISettingsResponse_UsesCanonicalEmptyCollections(t *testing.T) {
}
}
-func TestAISettingsHandler_GetHostedSettings_AutoBootstrapsQuickstart(t *testing.T) {
+func TestAISettingsHandler_GetHostedSettings_DoesNotBootstrapQuickstart(t *testing.T) {
t.Setenv("PULSE_HOSTED_MODE", "true")
- useTestQuickstartBootstrapServer(t, func(r *http.Request, reqBody map[string]any) {
- authHeader := strings.TrimSpace(r.Header.Get("Authorization"))
- assert.True(t, strings.HasPrefix(authHeader, "Bearer "))
- assert.Len(t, strings.Split(strings.TrimSpace(strings.TrimPrefix(authHeader, "Bearer ")), "."), 3)
- _, hasFingerprint := reqBody["instance_fingerprint"]
- assert.False(t, hasFingerprint)
- assert.Equal(t, "patrol", reqBody["use_case"])
- })
tmp := t.TempDir()
mtp := config.NewMultiTenantPersistence(tmp)
@@ -279,27 +271,14 @@ func TestAISettingsHandler_GetHostedSettings_AutoBootstrapsQuickstart(t *testing
var resp AISettingsResponse
require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &resp))
- assert.True(t, resp.Enabled)
- assert.True(t, resp.Configured)
- assert.Equal(t, "quickstart:pulse-hosted", resp.Model)
- assert.Equal(t, config.DefaultModelForProvider(config.AIProviderQuickstart), resp.Model)
- assert.Equal(t, 25, resp.QuickstartCreditsTotal)
- assert.Equal(t, 25, resp.QuickstartCreditsRemaining)
- assert.True(t, resp.QuickstartCreditsAvailable)
- assert.Empty(t, resp.QuickstartBlockedReason)
- assert.True(t, persistence.HasAIConfig())
+ assert.False(t, resp.Enabled)
+ assert.False(t, resp.Configured)
+ assert.Empty(t, resp.Model)
+ assert.False(t, persistence.HasAIConfig())
}
-func TestAISettingsHandler_GetHostedTenantSettings_InheritsDefaultHostedBillingState(t *testing.T) {
+func TestAISettingsHandler_GetHostedTenantSettings_DoesNotBootstrapQuickstartFromDefaultBillingState(t *testing.T) {
t.Setenv("PULSE_HOSTED_MODE", "true")
- useTestQuickstartBootstrapServer(t, func(r *http.Request, reqBody map[string]any) {
- authHeader := strings.TrimSpace(r.Header.Get("Authorization"))
- assert.True(t, strings.HasPrefix(authHeader, "Bearer "))
- assert.Len(t, strings.Split(strings.TrimSpace(strings.TrimPrefix(authHeader, "Bearer ")), "."), 3)
- _, hasFingerprint := reqBody["instance_fingerprint"]
- assert.False(t, hasFingerprint)
- assert.Equal(t, "patrol", reqBody["use_case"])
- })
tmp := t.TempDir()
mtp := config.NewMultiTenantPersistence(tmp)
@@ -320,18 +299,13 @@ func TestAISettingsHandler_GetHostedTenantSettings_InheritsDefaultHostedBillingS
var resp AISettingsResponse
require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &resp))
- assert.True(t, resp.Enabled)
- assert.True(t, resp.Configured)
- assert.Equal(t, "quickstart:pulse-hosted", resp.Model)
- assert.Equal(t, config.DefaultModelForProvider(config.AIProviderQuickstart), resp.Model)
- assert.Equal(t, 25, resp.QuickstartCreditsTotal)
- assert.Equal(t, 25, resp.QuickstartCreditsRemaining)
- assert.True(t, resp.QuickstartCreditsAvailable)
- assert.Empty(t, resp.QuickstartBlockedReason)
- assert.True(t, persistence.HasAIConfig())
+ assert.False(t, resp.Enabled)
+ assert.False(t, resp.Configured)
+ assert.Empty(t, resp.Model)
+ assert.False(t, persistence.HasAIConfig())
}
-func TestAISettingsHandler_GetSettings_NormalizesLegacyQuickstartAliases(t *testing.T) {
+func TestAISettingsHandler_GetSettings_RetiresLegacyQuickstartAliases(t *testing.T) {
tmp := t.TempDir()
mtp := config.NewMultiTenantPersistence(tmp)
persistence, err := mtp.GetPersistence("default")
@@ -358,14 +332,13 @@ func TestAISettingsHandler_GetSettings_NormalizesLegacyQuickstartAliases(t *test
var resp AISettingsResponse
require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &resp))
- want := config.DefaultModelForProvider(config.AIProviderQuickstart)
- assert.Equal(t, want, resp.Model)
- assert.Equal(t, want, resp.ChatModel)
- assert.Equal(t, want, resp.PatrolModel)
- assert.Equal(t, want, resp.AutoFixModel)
+ assert.Empty(t, resp.Model)
+ assert.Empty(t, resp.ChatModel)
+ assert.Empty(t, resp.PatrolModel)
+ assert.Empty(t, resp.AutoFixModel)
}
-func TestAISettingsHandler_GetSettings_QuickstartActivationRequiredSurface(t *testing.T) {
+func TestAISettingsHandler_GetSettings_DoesNotExposeQuickstartSurface(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
persistence := config.NewConfigPersistence(tmp)
@@ -384,22 +357,16 @@ func TestAISettingsHandler_GetSettings_QuickstartActivationRequiredSurface(t *te
var resp AISettingsResponse
require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &resp))
- assert.False(t, resp.QuickstartCreditsAvailable)
- assert.Equal(t, 0, resp.QuickstartCreditsTotal)
- assert.Equal(t, 0, resp.QuickstartCreditsRemaining)
- assert.Equal(t, ai.QuickstartActivationRequiredReason(), resp.QuickstartBlockedReason)
+ assert.False(t, resp.Configured)
+ assert.NotContains(t, rec.Body.String(), "quickstart_")
+ assert.NotContains(t, rec.Body.String(), "using_quickstart")
}
-func TestAISettingsHandler_UpdateSettings_QuickstartRequiresActivationBeforeEnable(t *testing.T) {
+func TestAISettingsHandler_UpdateSettings_RequiresProviderBeforeEnable(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
persistence := config.NewConfigPersistence(tmp)
handler := newTestAISettingsHandler(cfg, persistence, nil)
- handler.defaultAIService.SetQuickstartCredits(ai.NewPersistentQuickstartCreditManager(
- persistence,
- "default",
- func() *config.AIConfig { return &config.AIConfig{Enabled: true} },
- ))
body, _ := json.Marshal(AISettingsUpdateRequest{
Enabled: ptr(true),
@@ -408,31 +375,17 @@ func TestAISettingsHandler_UpdateSettings_QuickstartRequiresActivationBeforeEnab
rec := httptest.NewRecorder()
handler.HandleUpdateAISettings(rec, req)
- require.Equal(t, http.StatusConflict, rec.Code, "body=%s", rec.Body.String())
- assert.Contains(t, rec.Body.String(), ai.QuickstartActivationRequiredReason())
+ require.Equal(t, http.StatusBadRequest, rec.Code, "body=%s", rec.Body.String())
+ assert.Contains(t, rec.Body.String(), "Please configure a provider")
}
-func TestAISettingsHandler_UpdateSettings_QuickstartBootstrapBeforeEnableUsesActivationIdentity(t *testing.T) {
+func TestAISettingsHandler_UpdateSettings_DoesNotBootstrapQuickstartWithActivationIdentity(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
persistence := config.NewConfigPersistence(tmp)
persistQuickstartActivationState(t, persistence)
- useTestQuickstartBootstrapServer(t, func(r *http.Request, reqBody map[string]any) {
- assert.Equal(t, "Bearer pit_live_test", strings.TrimSpace(r.Header.Get("Authorization")))
- instanceFingerprint, _ := reqBody["instance_fingerprint"].(string)
- assert.Equal(t, "fp-live-test", instanceFingerprint)
- assert.Equal(t, "patrol", reqBody["use_case"])
- })
handler := newTestAISettingsHandler(cfg, persistence, nil)
- handler.defaultAIService.SetQuickstartCredits(ai.NewPersistentQuickstartCreditManager(
- persistence,
- "default",
- func() *config.AIConfig {
- cfg, _ := persistence.LoadAIConfig()
- return cfg
- },
- ))
body, _ := json.Marshal(AISettingsUpdateRequest{
Enabled: ptr(true),
@@ -441,17 +394,8 @@ func TestAISettingsHandler_UpdateSettings_QuickstartBootstrapBeforeEnableUsesAct
rec := httptest.NewRecorder()
handler.HandleUpdateAISettings(rec, req)
- require.Equal(t, http.StatusOK, rec.Code, "body=%s", rec.Body.String())
-
- var resp AISettingsResponse
- require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &resp))
- assert.True(t, resp.Enabled)
- assert.Equal(t, "quickstart:pulse-hosted", resp.Model)
- assert.Equal(t, config.DefaultModelForProvider(config.AIProviderQuickstart), resp.Model)
- assert.True(t, resp.UsingQuickstart)
- assert.Equal(t, 25, resp.QuickstartCreditsRemaining)
- assert.Equal(t, 25, resp.QuickstartCreditsTotal)
- assert.Empty(t, resp.QuickstartBlockedReason)
+ require.Equal(t, http.StatusBadRequest, rec.Code, "body=%s", rec.Body.String())
+ assert.Contains(t, rec.Body.String(), "Please configure a provider")
}
func TestAISettingsHandler_UpdateSettings_ResolvesProviderModelWhenOmitted(t *testing.T) {
diff --git a/internal/api/ai_hosted_runtime.go b/internal/api/ai_hosted_runtime.go
index bc1d9dbfff..a5effe295c 100644
--- a/internal/api/ai_hosted_runtime.go
+++ b/internal/api/ai_hosted_runtime.go
@@ -17,65 +17,20 @@ func loadHostedAwareAIConfig(hostedMode bool, billingBaseDir, orgID string, pers
if err != nil {
return nil, err
}
- if !shouldAutoBootstrapHostedAIConfig(hostedMode, persistence) {
- return cfg, nil
- }
-
- state, err := ensureHostedAIQuickstartBillingState(billingBaseDir, orgID)
- if err != nil {
- return nil, err
- }
- if !hostedAIAutoBootstrapEligible(state) {
- return cfg, nil
- }
-
- bootstrapped := config.NewDefaultAIConfig()
- bootstrapped.Enabled = true
- quickstartModel := config.DefaultModelForProvider(config.AIProviderQuickstart)
- bootstrapped.Model = quickstartModel
- bootstrapped.ChatModel = quickstartModel
- bootstrapped.PatrolModel = quickstartModel
- if err := persistence.SaveAIConfig(*bootstrapped); err != nil {
- return nil, fmt.Errorf("persist hosted Pulse Assistant bootstrap config: %w", err)
- }
- return bootstrapped, nil
+ return cfg, nil
}
func shouldAutoBootstrapHostedAIConfig(hostedMode bool, persistence *config.ConfigPersistence) bool {
- return hostedMode && persistence != nil && !persistence.HasAIConfig()
+ return false
}
func ensureHostedAIQuickstartBillingState(billingBaseDir, orgID string) (*billingState, error) {
- state, effectiveOrgID, err := config.LoadEffectiveEntitlementBillingState(billingBaseDir, orgID)
- if err != nil || state == nil {
- return state, err
- }
- if !hostedAIAutoBootstrapEligible(state) || state.QuickstartCreditsGranted {
- return state, nil
- }
-
- updated := normalizeBillingStateFromLicensing(state)
- billingStore := config.NewFileBillingStore(strings.TrimSpace(billingBaseDir))
- updated.GrantQuickstartCredits()
- if err := billingStore.SaveBillingState(effectiveOrgID, updated); err != nil {
- return nil, fmt.Errorf("save hosted Pulse Assistant quickstart billing state: %w", err)
- }
- return updated, nil
+ state, _, err := config.LoadEffectiveEntitlementBillingState(billingBaseDir, orgID)
+ return state, err
}
func hostedAIAutoBootstrapEligible(state *billingState) bool {
- if state == nil {
- return false
- }
- if strings.TrimSpace(state.EntitlementJWT) == "" && strings.TrimSpace(state.EntitlementRefreshToken) == "" {
- return false
- }
- switch state.SubscriptionState {
- case subscriptionStateActiveValue, subscriptionStateGraceValue, subscriptionStateTrialValue:
- default:
- return false
- }
- return hasBillingCapability(state, featureAIPatrolValue) || hasBillingCapability(state, featureAIAutoFixValue)
+ return false
}
func hasBillingCapability(state *billingState, feature string) bool {
diff --git a/internal/api/ai_hosted_runtime_test.go b/internal/api/ai_hosted_runtime_test.go
index e35a19ffc0..3c430b061a 100644
--- a/internal/api/ai_hosted_runtime_test.go
+++ b/internal/api/ai_hosted_runtime_test.go
@@ -9,10 +9,9 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/ai/chat"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
pkglicensing "github.com/rcourtman/pulse-go-rewrite/pkg/licensing"
- "github.com/stretchr/testify/mock"
)
-func TestLoadHostedAwareAIConfig_AutoBootstrapsHostedQuickstart(t *testing.T) {
+func TestLoadHostedAwareAIConfig_DoesNotAutoBootstrapHostedQuickstart(t *testing.T) {
baseDir := t.TempDir()
mtp := config.NewMultiTenantPersistence(baseDir)
persistence, err := mtp.GetPersistence("default")
@@ -27,17 +26,16 @@ func TestLoadHostedAwareAIConfig_AutoBootstrapsHostedQuickstart(t *testing.T) {
t.Fatalf("loadHostedAwareAIConfig(): %v", err)
}
if loaded == nil {
- t.Fatal("expected hosted Pulse Assistant config")
+ t.Fatal("expected default Pulse Assistant config")
}
- if !loaded.Enabled {
- t.Fatal("expected hosted Pulse Assistant config to be enabled")
+ if loaded.Enabled {
+ t.Fatal("expected hosted Pulse Assistant config to stay disabled until BYOK/local setup")
}
- quickstartModel := config.DefaultModelForProvider(config.AIProviderQuickstart)
- if loaded.Model != quickstartModel || loaded.ChatModel != quickstartModel || loaded.PatrolModel != quickstartModel {
- t.Fatalf("expected quickstart models, got model=%q chat=%q patrol=%q", loaded.Model, loaded.ChatModel, loaded.PatrolModel)
+ if loaded.Model != "" || loaded.ChatModel != "" || loaded.PatrolModel != "" {
+ t.Fatalf("expected no quickstart models, got model=%q chat=%q patrol=%q", loaded.Model, loaded.ChatModel, loaded.PatrolModel)
}
- if !persistence.HasAIConfig() {
- t.Fatal("expected hosted AI bootstrap to persist ai config")
+ if persistence.HasAIConfig() {
+ t.Fatal("expected hosted AI loader not to persist an implicit quickstart config")
}
billingStore := config.NewFileBillingStore(mtp.BaseDataDir())
@@ -45,8 +43,11 @@ func TestLoadHostedAwareAIConfig_AutoBootstrapsHostedQuickstart(t *testing.T) {
if err != nil {
t.Fatalf("GetBillingState(default): %v", err)
}
- if state == nil || !state.QuickstartCreditsGranted {
- t.Fatal("expected hosted AI bootstrap to backfill quickstart credits")
+ if state == nil {
+ t.Fatal("expected hosted billing state to remain readable")
+ }
+ if state.QuickstartCreditsGranted {
+ t.Fatal("expected hosted AI loader not to grant quickstart credits")
}
}
@@ -96,11 +97,14 @@ func TestLoadHostedAwareAIConfig_HostedTenantFallsBackToDefaultBillingState(t *t
if err != nil {
t.Fatalf("loadHostedAwareAIConfig(): %v", err)
}
- if loaded == nil || !loaded.Enabled {
- t.Fatalf("expected hosted tenant AI config to auto-bootstrap, got %#v", loaded)
+ if loaded == nil {
+ t.Fatal("expected default tenant AI config")
}
- if !persistence.HasAIConfig() {
- t.Fatal("expected hosted tenant AI bootstrap to persist tenant ai config")
+ if loaded.Enabled {
+ t.Fatalf("expected hosted tenant AI config to stay disabled until BYOK/local setup, got %#v", loaded)
+ }
+ if persistence.HasAIConfig() {
+ t.Fatal("expected hosted tenant AI loader not to persist an implicit quickstart config")
}
billingStore := config.NewFileBillingStore(mtp.BaseDataDir())
@@ -108,8 +112,11 @@ func TestLoadHostedAwareAIConfig_HostedTenantFallsBackToDefaultBillingState(t *t
if err != nil {
t.Fatalf("GetBillingState(default): %v", err)
}
- if defaultState == nil || !defaultState.QuickstartCreditsGranted {
- t.Fatal("expected hosted tenant AI bootstrap to reuse default hosted billing state")
+ if defaultState == nil {
+ t.Fatal("expected hosted tenant AI loader to keep default hosted billing state readable")
+ }
+ if defaultState.QuickstartCreditsGranted {
+ t.Fatal("expected hosted tenant AI loader not to grant quickstart credits")
}
tenantState, err := billingStore.GetBillingState("t-tenant")
if err != nil {
@@ -120,13 +127,13 @@ func TestLoadHostedAwareAIConfig_HostedTenantFallsBackToDefaultBillingState(t *t
}
}
-func TestAIHandlerStart_HostedAutoBootstrapStartsService(t *testing.T) {
+func TestAIHandlerStart_DoesNotAutoBootstrapHostedQuickstartService(t *testing.T) {
oldNewService := newChatService
defer func() { newChatService = oldNewService }()
- mockSvc := new(MockAIService)
- newChatService = func(cfg chat.Config) AIService {
- return mockSvc
+ newChatService = func(chat.Config) AIService {
+ t.Fatal("newChatService must not be called without explicit BYOK/local AI config")
+ return nil
}
baseDir := t.TempDir()
@@ -141,13 +148,11 @@ func TestAIHandlerStart_HostedAutoBootstrapStartsService(t *testing.T) {
handler.defaultPersistence = persistence
handler.hostedMode = true
- mockSvc.On("Start", mock.Anything).Return(nil).Once()
-
if err := handler.Start(context.Background(), nil); err != nil {
t.Fatalf("Start(): %v", err)
}
- if handler.defaultService != mockSvc {
- t.Fatal("expected hosted auto-bootstrap to start AI service")
+ if handler.defaultService != nil {
+ t.Fatal("expected hosted start not to create a quickstart-backed service")
}
}
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 5daf2688a0..4cab281de6 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -254,70 +254,35 @@ func TestContract_ChatServiceAdapterPatrolForwardsExecutionID(t *testing.T) {
}
}
-func TestContract_AIQuickstartPayloadFieldsRemainCanonical(t *testing.T) {
+func TestContract_AIQuickstartPayloadFieldsAreRetired(t *testing.T) {
settingsBody, err := json.Marshal(AISettingsResponse{
- QuickstartCreditsRemaining: 7,
- QuickstartCreditsTotal: 25,
- UsingQuickstart: true,
+ Enabled: true,
+ Configured: false,
})
if err != nil {
t.Fatalf("marshal AI settings response: %v", err)
}
- if !bytes.Contains(settingsBody, []byte(`"quickstart_credits_remaining":7`)) {
- t.Fatalf("expected AI settings payload to expose quickstart_credits_remaining, got %s", settingsBody)
- }
- if !bytes.Contains(settingsBody, []byte(`"quickstart_credits_total":25`)) {
- t.Fatalf("expected AI settings payload to expose quickstart_credits_total, got %s", settingsBody)
- }
- if !bytes.Contains(settingsBody, []byte(`"using_quickstart":true`)) {
- t.Fatalf("expected AI settings payload to expose using_quickstart, got %s", settingsBody)
+ if bytes.Contains(settingsBody, []byte(`quickstart`)) {
+ t.Fatalf("expected AI settings payload not to expose retired quickstart fields, got %s", settingsBody)
}
statusBody, err := json.Marshal(PatrolStatusResponse{
- QuickstartCreditsRemaining: 7,
- QuickstartCreditsTotal: 25,
- UsingQuickstart: true,
+ RuntimeState: ai.PatrolRuntimeStateActive,
+ Healthy: true,
})
if err != nil {
t.Fatalf("marshal patrol status response: %v", err)
}
- if !bytes.Contains(statusBody, []byte(`"quickstart_credits_remaining":7`)) {
- t.Fatalf("expected patrol status payload to expose quickstart_credits_remaining, got %s", statusBody)
- }
- if !bytes.Contains(statusBody, []byte(`"quickstart_credits_total":25`)) {
- t.Fatalf("expected patrol status payload to expose quickstart_credits_total, got %s", statusBody)
- }
- if !bytes.Contains(statusBody, []byte(`"using_quickstart":true`)) {
- t.Fatalf("expected patrol status payload to expose using_quickstart, got %s", statusBody)
+ if bytes.Contains(statusBody, []byte(`quickstart`)) {
+ t.Fatalf("expected patrol status payload not to expose retired quickstart fields, got %s", statusBody)
}
}
-func TestContract_AISettingsUpdateQuickstartBootstrapJSONSnapshot(t *testing.T) {
+func TestContract_AISettingsUpdateRequiresProviderBeforeEnable(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
persistence := config.NewConfigPersistence(tmp)
- persistQuickstartActivationState(t, persistence)
- useTestQuickstartBootstrapServer(t, func(r *http.Request, reqBody map[string]any) {
- if got := strings.TrimSpace(r.Header.Get("Authorization")); got != "Bearer pit_live_test" {
- t.Fatalf("authorization=%q want Bearer pit_live_test", got)
- }
- instanceFingerprint, _ := reqBody["instance_fingerprint"].(string)
- if instanceFingerprint != "fp-live-test" {
- t.Fatalf("instance_fingerprint=%q want fp-live-test", instanceFingerprint)
- }
- if reqBody["use_case"] != "patrol" {
- t.Fatalf("use_case=%v want patrol", reqBody["use_case"])
- }
- })
handler := newTestAISettingsHandler(cfg, persistence, nil)
- handler.defaultAIService.SetQuickstartCredits(ai.NewPersistentQuickstartCreditManager(
- persistence,
- "default",
- func() *config.AIConfig {
- cfg, _ := persistence.LoadAIConfig()
- return cfg
- },
- ))
req := newLoopbackRequest(http.MethodPut, "/api/settings/ai/update", strings.NewReader(`{
"enabled": true
@@ -326,48 +291,15 @@ func TestContract_AISettingsUpdateQuickstartBootstrapJSONSnapshot(t *testing.T)
rec := httptest.NewRecorder()
handler.HandleUpdateAISettings(rec, req)
- if rec.Code != http.StatusOK {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusOK, rec.Body.String())
+ if rec.Code != http.StatusBadRequest {
+ t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String())
+ }
+ if strings.Contains(strings.ToLower(rec.Body.String()), "quickstart") {
+ t.Fatalf("provider-required response must not mention retired quickstart, got %s", rec.Body.String())
+ }
+ if !strings.Contains(rec.Body.String(), "Please configure a provider") {
+ t.Fatalf("expected provider-required response, got %s", rec.Body.String())
}
-
- const want = `{
- "enabled":true,
- "model":"quickstart:pulse-hosted",
- "chat_model":"quickstart:pulse-hosted",
- "patrol_model":"quickstart:pulse-hosted",
- "configured":true,
- "custom_context":"",
- "auth_method":"api_key",
- "oauth_connected":false,
- "patrol_interval_minutes":360,
- "patrol_enabled":true,
- "patrol_auto_fix":false,
- "alert_triggered_analysis":true,
- "patrol_event_triggers_enabled":true,
- "patrol_alert_triggers_enabled":true,
- "patrol_anomaly_triggers_enabled":true,
- "use_proactive_thresholds":false,
- "available_models":[],
- "anthropic_configured":false,
- "openai_configured":false,
- "openrouter_configured":false,
- "deepseek_configured":false,
- "gemini_configured":false,
- "ollama_configured":false,
- "ollama_base_url":"http://localhost:11434",
- "ollama_password_set":false,
- "configured_providers":[],
- "control_level":"read_only",
- "protected_guests":[],
- "discovery_enabled":false,
- "quickstart_credits_total":25,
- "quickstart_credits_used":0,
- "quickstart_credits_remaining":25,
- "quickstart_credits_available":true,
- "using_quickstart":true
- }`
-
- assertJSONSnapshot(t, rec.Body.Bytes(), want)
}
func TestContract_AISettingsUpdateProviderResolutionJSONSnapshot(t *testing.T) {
@@ -427,21 +359,16 @@ func TestContract_AISettingsUpdateProviderResolutionJSONSnapshot(t *testing.T) {
"ollama_configured":true,
"ollama_base_url":%q,
"ollama_password_set":false,
- "configured_providers":["ollama"],
- "control_level":"read_only",
- "protected_guests":[],
- "discovery_enabled":false,
- "quickstart_credits_total":0,
- "quickstart_credits_used":0,
- "quickstart_credits_remaining":0,
- "quickstart_credits_available":false,
- "using_quickstart":false
- }`, ollama.URL)
+ "configured_providers":["ollama"],
+ "control_level":"read_only",
+ "protected_guests":[],
+ "discovery_enabled":false
+ }`, ollama.URL)
assertJSONSnapshot(t, rec.Body.Bytes(), want)
}
-func TestContract_PatrolStatusActivationRequiredSurface(t *testing.T) {
+func TestContract_PatrolStatusDoesNotSurfaceQuickstartActivation(t *testing.T) {
handler, _, _, _ := setupAIHandlerWithPatrol(t)
persistence := handler.defaultPersistence
aiCfg := config.NewDefaultAIConfig()
@@ -474,27 +401,21 @@ func TestContract_PatrolStatusActivationRequiredSurface(t *testing.T) {
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
t.Fatalf("decode patrol status: %v", err)
}
- if resp.RuntimeState != ai.PatrolRuntimeStateBlocked {
- t.Fatalf("runtime_state=%q want %q", resp.RuntimeState, ai.PatrolRuntimeStateBlocked)
+ if resp.RuntimeState == ai.PatrolRuntimeStateBlocked {
+ t.Fatalf("runtime_state=%q, want non-blocked for retired quickstart", resp.RuntimeState)
}
if !resp.Enabled {
t.Fatal("expected patrol status to remain enabled while activation is required")
}
- if resp.Healthy {
- t.Fatal("expected activation-required patrol status to report healthy=false")
- }
- if resp.BlockedReason != ai.QuickstartActivationRequiredReason() {
- t.Fatalf("blocked_reason=%q want %q", resp.BlockedReason, ai.QuickstartActivationRequiredReason())
- }
- if resp.QuickstartCreditsRemaining != 0 || resp.QuickstartCreditsTotal != 0 {
- t.Fatalf("quickstart credits=%d/%d want 0/0", resp.QuickstartCreditsRemaining, resp.QuickstartCreditsTotal)
+ if !resp.Healthy {
+ t.Fatal("expected retired quickstart activation state to stay healthy on the public status surface")
}
- if resp.UsingQuickstart {
- t.Fatal("expected using_quickstart=false while activation is required")
+ if strings.Contains(strings.ToLower(resp.BlockedReason), "quickstart") {
+ t.Fatalf("blocked_reason must not expose retired quickstart copy, got %q", resp.BlockedReason)
}
}
-func TestContract_AISettingsActivationRequiredSurface(t *testing.T) {
+func TestContract_AISettingsDoesNotExposeQuickstartActivation(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
persistence := config.NewConfigPersistence(tmp)
@@ -517,25 +438,15 @@ func TestContract_AISettingsActivationRequiredSurface(t *testing.T) {
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
t.Fatalf("decode ai settings: %v", err)
}
- if resp.QuickstartBlockedReason != ai.QuickstartActivationRequiredReason() {
- t.Fatalf(
- "quickstart_blocked_reason=%q want %q",
- resp.QuickstartBlockedReason,
- ai.QuickstartActivationRequiredReason(),
- )
- }
- if resp.QuickstartCreditsRemaining != 0 || resp.QuickstartCreditsTotal != 0 {
- t.Fatalf("quickstart credits=%d/%d want 0/0", resp.QuickstartCreditsRemaining, resp.QuickstartCreditsTotal)
- }
- if resp.QuickstartCreditsAvailable {
- t.Fatal("expected quickstart_credits_available=false while activation is required")
+ if resp.Configured {
+ t.Fatal("expected AI settings to remain unconfigured without BYOK/local provider")
}
- if !bytes.Contains(rec.Body.Bytes(), []byte(`"quickstart_blocked_reason":"`+ai.QuickstartActivationRequiredReason()+`"`)) {
- t.Fatalf("expected AI settings payload to expose quickstart_blocked_reason, got %s", rec.Body.Bytes())
+ if bytes.Contains(bytes.ToLower(rec.Body.Bytes()), []byte("quickstart")) {
+ t.Fatalf("AI settings payload must not expose retired quickstart fields, got %s", rec.Body.Bytes())
}
}
-func TestContract_AISettingsBYOKOverrideRetainsQuickstartInventoryJSONSnapshot(t *testing.T) {
+func TestContract_AISettingsBYOKOverrideDoesNotExposeQuickstartInventoryJSONSnapshot(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
persistence := config.NewConfigPersistence(tmp)
@@ -586,16 +497,11 @@ func TestContract_AISettingsBYOKOverrideRetainsQuickstartInventoryJSONSnapshot(t
"ollama_configured":false,
"ollama_base_url":"http://localhost:11434",
"ollama_password_set":false,
- "configured_providers":["openai"],
- "control_level":"read_only",
- "protected_guests":[],
- "discovery_enabled":false,
- "quickstart_credits_total":25,
- "quickstart_credits_used":13,
- "quickstart_credits_remaining":12,
- "quickstart_credits_available":true,
- "using_quickstart":false
- }`
+ "configured_providers":["openai"],
+ "control_level":"read_only",
+ "protected_guests":[],
+ "discovery_enabled":false
+ }`
assertJSONSnapshot(t, rec.Body.Bytes(), want)
}
@@ -2382,23 +2288,8 @@ func TestContract_BillingStateQuickstartJSONSnapshot(t *testing.T) {
assertJSONSnapshot(t, got, want)
}
-func TestContract_HostedAISettingsAutoBootstrapJSONSnapshot(t *testing.T) {
+func TestContract_HostedAISettingsDoesNotAutoBootstrapQuickstartJSONSnapshot(t *testing.T) {
t.Setenv("PULSE_HOSTED_MODE", "true")
- useTestQuickstartBootstrapServer(t, func(r *http.Request, reqBody map[string]any) {
- authHeader := strings.TrimSpace(r.Header.Get("Authorization"))
- if !strings.HasPrefix(authHeader, "Bearer ") {
- t.Fatalf("expected Bearer auth, got %q", authHeader)
- }
- if parts := strings.Split(strings.TrimSpace(strings.TrimPrefix(authHeader, "Bearer ")), "."); len(parts) != 3 {
- t.Fatalf("expected entitlement JWT bearer token, got %q", authHeader)
- }
- if _, hasFingerprint := reqBody["instance_fingerprint"]; hasFingerprint {
- t.Fatalf("expected hosted quickstart bootstrap to omit instance_fingerprint, got %v", reqBody)
- }
- if got := reqBody["use_case"]; got != "patrol" {
- t.Fatalf("use_case=%v want patrol", got)
- }
- })
baseDir := t.TempDir()
mtp := config.NewMultiTenantPersistence(baseDir)
@@ -2419,16 +2310,14 @@ func TestContract_HostedAISettingsAutoBootstrapJSONSnapshot(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusOK, rec.Body.String())
}
- if !persistence.HasAIConfig() {
- t.Fatal("expected hosted AI settings contract to persist canonical ai.enc bootstrap")
+ if persistence.HasAIConfig() {
+ t.Fatal("expected hosted AI settings contract not to persist implicit quickstart bootstrap")
}
const want = `{
- "enabled":true,
- "model":"quickstart:pulse-hosted",
- "chat_model":"quickstart:pulse-hosted",
- "patrol_model":"quickstart:pulse-hosted",
- "configured":true,
+ "enabled":false,
+ "model":"",
+ "configured":false,
"custom_context":"",
"auth_method":"api_key",
"oauth_connected":false,
@@ -2452,18 +2341,13 @@ func TestContract_HostedAISettingsAutoBootstrapJSONSnapshot(t *testing.T) {
"configured_providers":[],
"control_level":"read_only",
"protected_guests":[],
- "discovery_enabled":false,
- "quickstart_credits_total":25,
- "quickstart_credits_used":0,
- "quickstart_credits_remaining":25,
- "quickstart_credits_available":true,
- "using_quickstart":true
+ "discovery_enabled":false
}`
assertJSONSnapshot(t, rec.Body.Bytes(), want)
}
-func TestContract_AISettingsLegacyQuickstartAliasJSONSnapshot(t *testing.T) {
+func TestContract_AISettingsRetiredQuickstartAliasJSONSnapshot(t *testing.T) {
tmp := t.TempDir()
cfg := &config.Config{DataPath: tmp}
persistence := config.NewConfigPersistence(tmp)
@@ -2491,10 +2375,7 @@ func TestContract_AISettingsLegacyQuickstartAliasJSONSnapshot(t *testing.T) {
const want = `{
"enabled":true,
- "model":"quickstart:pulse-hosted",
- "chat_model":"quickstart:pulse-hosted",
- "patrol_model":"quickstart:pulse-hosted",
- "auto_fix_model":"quickstart:pulse-hosted",
+ "model":"",
"configured":false,
"custom_context":"",
"auth_method":"api_key",
@@ -2519,16 +2400,11 @@ func TestContract_AISettingsLegacyQuickstartAliasJSONSnapshot(t *testing.T) {
"configured_providers":[],
"control_level":"read_only",
"protected_guests":[],
- "discovery_enabled":false,
- "quickstart_credits_total":0,
- "quickstart_credits_used":0,
- "quickstart_credits_remaining":0,
- "quickstart_credits_available":false,
- "using_quickstart":false
+ "discovery_enabled":false
}`
assertJSONSnapshot(t, rec.Body.Bytes(), want)
- if bytes.Contains(rec.Body.Bytes(), []byte("quickstart:minimax-2.5m")) {
+ if bytes.Contains(bytes.ToLower(rec.Body.Bytes()), []byte("quickstart")) {
t.Fatalf("expected AI settings payload to suppress legacy hosted quickstart aliases, got %s", rec.Body.Bytes())
}
}
@@ -2585,16 +2461,11 @@ func TestContract_AISettingsOllamaAuthJSONSnapshot(t *testing.T) {
"ollama_base_url":"http://ollama.example:11434",
"ollama_username":"unai",
"ollama_password_set":true,
- "configured_providers":["ollama"],
- "control_level":"read_only",
- "protected_guests":[],
- "discovery_enabled":false,
- "quickstart_credits_total":0,
- "quickstart_credits_used":0,
- "quickstart_credits_remaining":0,
- "quickstart_credits_available":false,
- "using_quickstart":false
- }`
+ "configured_providers":["ollama"],
+ "control_level":"read_only",
+ "protected_guests":[],
+ "discovery_enabled":false
+ }`
assertJSONSnapshot(t, rec.Body.Bytes(), want)
}
@@ -3001,23 +2872,8 @@ func TestContract_ReportingInvalidFormatErrorsUseCatalogDefinitions(t *testing.T
}
}
-func TestContract_HostedTenantAISettingsFallbackJSONSnapshot(t *testing.T) {
+func TestContract_HostedTenantAISettingsDoesNotAutoBootstrapQuickstartJSONSnapshot(t *testing.T) {
t.Setenv("PULSE_HOSTED_MODE", "true")
- useTestQuickstartBootstrapServer(t, func(r *http.Request, reqBody map[string]any) {
- authHeader := strings.TrimSpace(r.Header.Get("Authorization"))
- if !strings.HasPrefix(authHeader, "Bearer ") {
- t.Fatalf("expected Bearer auth, got %q", authHeader)
- }
- if parts := strings.Split(strings.TrimSpace(strings.TrimPrefix(authHeader, "Bearer ")), "."); len(parts) != 3 {
- t.Fatalf("expected entitlement JWT bearer token, got %q", authHeader)
- }
- if _, hasFingerprint := reqBody["instance_fingerprint"]; hasFingerprint {
- t.Fatalf("expected hosted quickstart bootstrap to omit instance_fingerprint, got %v", reqBody)
- }
- if got := reqBody["use_case"]; got != "patrol" {
- t.Fatalf("use_case=%v want patrol", got)
- }
- })
baseDir := t.TempDir()
mtp := config.NewMultiTenantPersistence(baseDir)
@@ -3039,16 +2895,14 @@ func TestContract_HostedTenantAISettingsFallbackJSONSnapshot(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusOK, rec.Body.String())
}
- if !persistence.HasAIConfig() {
- t.Fatal("expected hosted tenant AI settings contract to persist tenant ai.enc bootstrap")
+ if persistence.HasAIConfig() {
+ t.Fatal("expected hosted tenant AI settings contract not to persist implicit quickstart bootstrap")
}
const want = `{
- "enabled":true,
- "model":"quickstart:pulse-hosted",
- "chat_model":"quickstart:pulse-hosted",
- "patrol_model":"quickstart:pulse-hosted",
- "configured":true,
+ "enabled":false,
+ "model":"",
+ "configured":false,
"custom_context":"",
"auth_method":"api_key",
"oauth_connected":false,
@@ -3072,12 +2926,7 @@ func TestContract_HostedTenantAISettingsFallbackJSONSnapshot(t *testing.T) {
"configured_providers":[],
"control_level":"read_only",
"protected_guests":[],
- "discovery_enabled":false,
- "quickstart_credits_total":25,
- "quickstart_credits_used":0,
- "quickstart_credits_remaining":25,
- "quickstart_credits_available":true,
- "using_quickstart":true
+ "discovery_enabled":false
}`
assertJSONSnapshot(t, rec.Body.Bytes(), want)
@@ -9417,22 +9266,19 @@ func TestContract_PatrolStatusResponseJSONSnapshot(t *testing.T) {
AlertTriggersEnabled: true,
AnomalyTriggersEnabled: false,
},
- NextPatrolAt: &nextPatrolAt,
- LastDurationMs: 12345,
- ResourcesChecked: 18,
- FindingsCount: 3,
- ErrorCount: 1,
- Healthy: false,
- IntervalMs: 21600000,
- FixedCount: 2,
- BlockedReason: "Awaiting AI provider configuration",
- BlockedAt: &blockedAt,
- QuickstartCreditsRemaining: 7,
- QuickstartCreditsTotal: pkglicensing.QuickstartCreditsTotal,
- UsingQuickstart: true,
- LicenseRequired: true,
- LicenseStatus: "none",
- UpgradeURL: "https://pulserelay.pro/upgrade?feature=ai_autofix",
+ NextPatrolAt: &nextPatrolAt,
+ LastDurationMs: 12345,
+ ResourcesChecked: 18,
+ FindingsCount: 3,
+ ErrorCount: 1,
+ Healthy: false,
+ IntervalMs: 21600000,
+ FixedCount: 2,
+ BlockedReason: "Awaiting AI provider configuration",
+ BlockedAt: &blockedAt,
+ LicenseRequired: true,
+ LicenseStatus: "none",
+ UpgradeURL: "https://pulserelay.pro/upgrade?feature=ai_autofix",
}
payload.Summary.Critical = 1
payload.Summary.Warning = 2
@@ -9461,9 +9307,6 @@ func TestContract_PatrolStatusResponseJSONSnapshot(t *testing.T) {
"fixed_count":2,
"blocked_reason":"Awaiting AI provider configuration",
"blocked_at":"2026-03-12T09:45:00Z",
- "quickstart_credits_remaining":7,
- "quickstart_credits_total":25,
- "using_quickstart":true,
"license_required":true,
"license_status":"none",
"upgrade_url":"https://pulserelay.pro/upgrade?feature=ai_autofix",
diff --git a/internal/api/hosted_entitlement_refresh.go b/internal/api/hosted_entitlement_refresh.go
index ebf21b581c..a57c612678 100644
--- a/internal/api/hosted_entitlement_refresh.go
+++ b/internal/api/hosted_entitlement_refresh.go
@@ -380,7 +380,6 @@ func (h *LicenseHandlers) refreshHostedEntitlementLeaseOnce(orgID string, servic
updated.TrialStartedAt = leaseClaims.TrialStartedAt
updated.TrialEndsAt = nil
updated.TrialExtendedAt = nil
- updated.GrantQuickstartCredits()
if err := billingStore.SaveBillingState(effectiveOrgID, updated); err != nil {
return false, false, fmt.Errorf("save refreshed entitlement lease: %w", err)
}
diff --git a/internal/api/hosted_entitlement_refresh_quickstart_test.go b/internal/api/hosted_entitlement_refresh_quickstart_test.go
index 63a16c672b..4dd12d90a7 100644
--- a/internal/api/hosted_entitlement_refresh_quickstart_test.go
+++ b/internal/api/hosted_entitlement_refresh_quickstart_test.go
@@ -13,7 +13,7 @@ import (
entitlements "github.com/rcourtman/pulse-go-rewrite/pkg/licensing"
)
-func TestRefreshHostedEntitlementLeaseOnce_GrantsQuickstartCredits(t *testing.T) {
+func TestRefreshHostedEntitlementLeaseOnce_DoesNotGrantQuickstartCredits(t *testing.T) {
baseDir := t.TempDir()
mtp := config.NewMultiTenantPersistence(baseDir)
@@ -66,10 +66,10 @@ func TestRefreshHostedEntitlementLeaseOnce_GrantsQuickstartCredits(t *testing.T)
if state == nil {
t.Fatal("expected billing state after hosted entitlement refresh")
}
- if !state.QuickstartCreditsGranted {
- t.Fatal("expected hosted entitlement refresh to grant quickstart credits")
+ if state.QuickstartCreditsGranted {
+ t.Fatal("expected hosted entitlement refresh not to grant quickstart credits")
}
- if state.QuickstartCreditsGrantedAt == nil {
- t.Fatal("expected hosted entitlement refresh to record quickstart grant timestamp")
+ if state.QuickstartCreditsGrantedAt != nil {
+ t.Fatal("expected hosted entitlement refresh not to record quickstart grant timestamp")
}
}
diff --git a/internal/api/hosted_lifecycle_integration_test.go b/internal/api/hosted_lifecycle_integration_test.go
index 0eea9adc57..289c12c394 100644
--- a/internal/api/hosted_lifecycle_integration_test.go
+++ b/internal/api/hosted_lifecycle_integration_test.go
@@ -74,11 +74,11 @@ func TestHostedLifecycle(t *testing.T) {
if stored.TrialEndsAt == nil {
t.Fatal("expected trial_ends_at to be populated")
}
- if !stored.QuickstartCreditsGranted {
- t.Fatal("expected hosted signup billing state to grant quickstart credits")
+ if stored.QuickstartCreditsGranted {
+ t.Fatal("expected hosted signup billing state not to grant quickstart credits")
}
- if stored.QuickstartCreditsGrantedAt == nil {
- t.Fatal("expected hosted signup quickstart grant timestamp to be populated")
+ if stored.QuickstartCreditsGrantedAt != nil {
+ t.Fatal("expected hosted signup quickstart grant timestamp to stay empty")
}
expectedCaps := append([]string(nil), cloudCapabilitiesFromLicensing()...)
diff --git a/internal/config/ai.go b/internal/config/ai.go
index 6f3139c5f2..88c9064a76 100644
--- a/internal/config/ai.go
+++ b/internal/config/ai.go
@@ -101,7 +101,7 @@ const (
AIProviderOllama = "ollama"
AIProviderDeepSeek = "deepseek"
AIProviderGemini = "gemini"
- AIProviderQuickstart = "quickstart" // Pulse-hosted proxy for free quickstart credits
+ AIProviderQuickstart = "quickstart" // Retired Pulse-hosted proxy marker retained only for legacy config migration.
)
// AI Control Level constants
@@ -136,8 +136,8 @@ const (
)
const (
- // DefaultAIModelQuickstart is a Pulse-owned stable alias. The hosted
- // quickstart backend chooses the real upstream vendor model server-side.
+ // DefaultAIModelQuickstart is retained only to recognize and retire legacy
+ // Pulse-hosted model aliases from pre-GA config.
DefaultAIModelQuickstart = "pulse-hosted"
DefaultOllamaBaseURL = "http://localhost:11434"
DefaultOpenRouterBaseURL = "https://openrouter.ai/api/v1/chat/completions"
@@ -325,19 +325,19 @@ func FormatModelString(provider, modelName string) string {
return provider + ":" + modelName
}
-// NormalizeQuickstartModelString canonicalizes legacy quickstart model strings to
-// Pulse's owned hosted alias. The server chooses the real upstream vendor model.
+// NormalizeQuickstartModelString retires legacy Pulse-hosted quickstart model
+// strings. Self-hosted v6 GA requires BYOK or a local model for AI runtime use.
func NormalizeQuickstartModelString(model string) string {
model = strings.TrimSpace(model)
if model == "" {
return ""
}
if strings.EqualFold(model, DefaultAIModelQuickstart) || strings.EqualFold(model, AIProviderQuickstart) {
- return DefaultModelForProvider(AIProviderQuickstart)
+ return ""
}
provider, _ := ParseModelString(model)
if provider == AIProviderQuickstart {
- return DefaultModelForProvider(AIProviderQuickstart)
+ return ""
}
return model
}
@@ -359,7 +359,7 @@ func DefaultModelForProvider(provider string) string {
case AIProviderOllama:
return FormatModelString(AIProviderOllama, "llama3.2")
case AIProviderQuickstart:
- return FormatModelString(AIProviderQuickstart, DefaultAIModelQuickstart)
+ return ""
default:
return ""
}
@@ -373,8 +373,8 @@ func (c *AIConfig) GetModel() string {
return NormalizeQuickstartModelString(c.Model)
}
-// NormalizeQuickstartModelAliases rewrites any legacy quickstart model strings in-place
-// to the owned Pulse alias. Returns true when a field changed.
+// NormalizeQuickstartModelAliases removes retired quickstart model strings in-place.
+// Self-hosted v6 GA does not silently fall back to Pulse-hosted AI.
func (c *AIConfig) NormalizeQuickstartModelAliases() bool {
if c == nil {
return false
@@ -400,8 +400,8 @@ func (c *AIConfig) NormalizeQuickstartModelAliases() bool {
}
// GetPreferredModelForProvider returns the most relevant configured model for a provider.
-// It prefers explicitly selected models for that provider before falling back to the
-// provider-owned quickstart alias when applicable.
+// It prefers explicitly selected models for that provider and does not invent a model
+// for retired providers.
func (c *AIConfig) GetPreferredModelForProvider(provider string) string {
for _, candidate := range []string{c.Model, c.ChatModel, c.PatrolModel, c.AutoFixModel, c.DiscoveryModel} {
candidate = NormalizeQuickstartModelString(candidate)
@@ -414,9 +414,6 @@ func (c *AIConfig) GetPreferredModelForProvider(provider string) string {
}
}
- if provider == AIProviderQuickstart {
- return DefaultModelForProvider(provider)
- }
return ""
}
diff --git a/internal/config/ai_additional_test.go b/internal/config/ai_additional_test.go
index 9b8e49907e..9edd401b77 100644
--- a/internal/config/ai_additional_test.go
+++ b/internal/config/ai_additional_test.go
@@ -175,9 +175,9 @@ func TestDefaultModelForProvider(t *testing.T) {
want: FormatModelString(AIProviderOllama, "llama3.2"),
},
{
- name: "quickstart",
+ name: "retired quickstart",
provider: AIProviderQuickstart,
- want: FormatModelString(AIProviderQuickstart, DefaultAIModelQuickstart),
+ want: "",
},
{
name: "unknown provider",
diff --git a/internal/config/ai_config_test.go b/internal/config/ai_config_test.go
index 36d90ffde2..a2ad8876c1 100644
--- a/internal/config/ai_config_test.go
+++ b/internal/config/ai_config_test.go
@@ -195,7 +195,7 @@ func TestDefaultModelForProvider_UsesCanonicalProviderFallbacks(t *testing.T) {
{provider: AIProviderDeepSeek, expected: "deepseek:deepseek-chat"},
{provider: AIProviderGemini, expected: "gemini:gemini-1.5-pro"},
{provider: AIProviderOllama, expected: "ollama:llama3.2"},
- {provider: AIProviderQuickstart, expected: "quickstart:" + DefaultAIModelQuickstart},
+ {provider: AIProviderQuickstart, expected: ""},
{provider: "unknown", expected: ""},
}
@@ -247,14 +247,13 @@ func TestAIConfig_GetConfiguredProviders(t *testing.T) {
}
}
-func TestDefaultModelForProvider_Quickstart(t *testing.T) {
+func TestDefaultModelForProvider_RetiredQuickstart(t *testing.T) {
if DefaultAIModelQuickstart != "pulse-hosted" {
t.Fatalf("DefaultAIModelQuickstart = %q, want pulse-hosted", DefaultAIModelQuickstart)
}
got := DefaultModelForProvider(AIProviderQuickstart)
- want := FormatModelString(AIProviderQuickstart, DefaultAIModelQuickstart)
- if got != want {
- t.Fatalf("DefaultModelForProvider(%q) = %q, want %q", AIProviderQuickstart, got, want)
+ if got != "" {
+ t.Fatalf("DefaultModelForProvider(%q) = %q, want empty for retired quickstart", AIProviderQuickstart, got)
}
}
@@ -480,9 +479,9 @@ func TestAIConfig_GetModel(t *testing.T) {
expected: "",
},
{
- name: "legacy quickstart model normalizes to owned alias",
+ name: "legacy quickstart model is retired",
config: AIConfig{Model: "quickstart:minimax-2.5m"},
- expected: DefaultModelForProvider(AIProviderQuickstart),
+ expected: "",
},
}
@@ -516,13 +515,13 @@ func TestAIConfig_GetChatModel(t *testing.T) {
}
})
- t.Run("normalizes legacy quickstart chat model", func(t *testing.T) {
+ t.Run("retires legacy quickstart chat model", func(t *testing.T) {
config := AIConfig{
Model: "openai:gpt-4o-mini",
ChatModel: "quickstart:minimax-2.5m",
}
- if result := config.GetChatModel(); result != DefaultModelForProvider(AIProviderQuickstart) {
- t.Errorf("GetChatModel() = %q, want %q", result, DefaultModelForProvider(AIProviderQuickstart))
+ if result := config.GetChatModel(); result != "" {
+ t.Errorf("GetChatModel() = %q, want empty for retired quickstart", result)
}
})
}
@@ -541,9 +540,8 @@ func TestAIConfig_NormalizeQuickstartModelAliases(t *testing.T) {
t.Fatal("expected quickstart alias normalization to report a change")
}
- want := DefaultModelForProvider(AIProviderQuickstart)
- if config.Model != want || config.ChatModel != want || config.PatrolModel != want || config.AutoFixModel != want {
- t.Fatalf("NormalizeQuickstartModelAliases() = %#v, want all quickstart fields normalized to %q", config, want)
+ if config.Model != "" || config.ChatModel != "" || config.PatrolModel != "" || config.AutoFixModel != "" {
+ t.Fatalf("NormalizeQuickstartModelAliases() = %#v, want all quickstart fields cleared", config)
}
if config.DiscoveryModel != "" {
t.Fatalf("expected empty discovery model to remain empty, got %q", config.DiscoveryModel)
diff --git a/internal/config/persistence_ai_branches_test.go b/internal/config/persistence_ai_branches_test.go
index 59eb28bba9..8973cbe231 100644
--- a/internal/config/persistence_ai_branches_test.go
+++ b/internal/config/persistence_ai_branches_test.go
@@ -69,7 +69,7 @@ func TestLoadAIConfig_Branches(t *testing.T) {
assert.NotContains(t, string(rewritten), "secret-key")
}
-func TestLoadAIConfig_MigratesLegacyQuickstartAlias(t *testing.T) {
+func TestLoadAIConfig_RetiresLegacyQuickstartAlias(t *testing.T) {
tempDir := t.TempDir()
cp := NewConfigPersistence(tempDir)
aiFile := filepath.Join(tempDir, "ai.enc")
@@ -92,11 +92,10 @@ func TestLoadAIConfig_MigratesLegacyQuickstartAlias(t *testing.T) {
settings, err := cp.LoadAIConfig()
assert.NoError(t, err)
- want := DefaultModelForProvider(AIProviderQuickstart)
- assert.Equal(t, want, settings.Model)
- assert.Equal(t, want, settings.ChatModel)
- assert.Equal(t, want, settings.PatrolModel)
- assert.Equal(t, want, settings.AutoFixModel)
+ assert.Empty(t, settings.Model)
+ assert.Empty(t, settings.ChatModel)
+ assert.Empty(t, settings.PatrolModel)
+ assert.Empty(t, settings.AutoFixModel)
rewritten, err := os.ReadFile(aiFile)
assert.NoError(t, err)
diff --git a/pkg/licensing/trial_start.go b/pkg/licensing/trial_start.go
index 97332139a1..98985fa547 100644
--- a/pkg/licensing/trial_start.go
+++ b/pkg/licensing/trial_start.go
@@ -86,7 +86,7 @@ func BuildTrialBillingStateWithPlan(now time.Time, capabilities []string, planVe
planVersion = string(SubStateTrial)
}
- state := &BillingState{
+ return &BillingState{
Capabilities: append([]string(nil), capabilities...),
Limits: map[string]int64{},
MetersEnabled: []string{},
@@ -95,6 +95,4 @@ func BuildTrialBillingStateWithPlan(now time.Time, capabilities []string, planVe
TrialStartedAt: &startedAt,
TrialEndsAt: &endsAt,
}
- state.GrantQuickstartCredits()
- return state
}
diff --git a/pkg/licensing/trial_start_test.go b/pkg/licensing/trial_start_test.go
index 689da2a265..841b30b214 100644
--- a/pkg/licensing/trial_start_test.go
+++ b/pkg/licensing/trial_start_test.go
@@ -234,10 +234,10 @@ func TestBuildTrialBillingStateWithPlan(t *testing.T) {
if *state.TrialEndsAt != now.Add(72*time.Hour).Unix() {
t.Fatalf("trial_ends_at=%d, want %d", *state.TrialEndsAt, now.Add(72*time.Hour).Unix())
}
- if !state.QuickstartCreditsGranted {
- t.Fatal("expected quickstart credits to be granted for new trial workspaces")
+ if state.QuickstartCreditsGranted {
+ t.Fatal("expected quickstart credits not to be granted for new trial workspaces")
}
- if state.QuickstartCreditsGrantedAt == nil {
- t.Fatal("expected quickstart credits grant timestamp to be populated")
+ if state.QuickstartCreditsGrantedAt != nil {
+ t.Fatal("expected quickstart credits grant timestamp to stay empty")
}
}
diff --git a/tests/integration/tests/10-v6-license-activation.spec.ts b/tests/integration/tests/10-v6-license-activation.spec.ts
index 76d7daa421..c818040705 100644
--- a/tests/integration/tests/10-v6-license-activation.spec.ts
+++ b/tests/integration/tests/10-v6-license-activation.spec.ts
@@ -1,5 +1,5 @@
-import { test, expect } from '@playwright/test';
-import { apiRequest, ensureAuthenticated } from './helpers';
+import { test, expect } from "@playwright/test";
+import { apiRequest, ensureAuthenticated } from "./helpers";
/**
* V6 License Activation E2E Test
@@ -14,10 +14,10 @@ import { apiRequest, ensureAuthenticated } from './helpers';
*/
const LICENSE_SERVER_URL = (
- process.env.PULSE_LICENSE_SERVER_URL || 'https://license.pulserelay.pro'
-).replace(/\/+$/, '');
+ process.env.PULSE_LICENSE_SERVER_URL || "https://license.pulserelay.pro"
+).replace(/\/+$/, "");
-const ADMIN_TOKEN = process.env.PULSE_LICENSE_ADMIN_TOKEN || '';
+const ADMIN_TOKEN = process.env.PULSE_LICENSE_ADMIN_TOKEN || "";
type IssuedLicense = {
license: { license_id: string };
@@ -31,31 +31,29 @@ type EntitlementPayload = {
is_lifetime?: boolean;
licensed_email?: string;
days_remaining?: number;
- limits?: Array<{ key: string; limit: number; current: number; state: string }>;
+ limits?: Array<{
+ key: string;
+ limit: number;
+ current: number;
+ state: string;
+ }>;
};
type AISettingsPayload = {
enabled?: boolean;
model?: string;
patrol_model?: string;
- quickstart_credits_total?: number;
- quickstart_credits_remaining?: number;
- quickstart_credits_available?: boolean;
- quickstart_blocked_reason?: string;
};
type PatrolStatusPayload = {
- using_quickstart?: boolean;
- quickstart_credits_total?: number;
- quickstart_credits_remaining?: number;
runtime_state?: string;
};
-test.describe.serial('V6 license activation flow', () => {
+test.describe.serial("V6 license activation flow", () => {
/** Issued license ID — used for cleanup/revocation. */
- let issuedLicenseId = '';
+ let issuedLicenseId = "";
/** The activation key string (ppk_live_*). */
- let activationKey = '';
+ let activationKey = "";
test.afterAll(async ({ browser }) => {
// Best-effort cleanup: clear license in Pulse and revoke on the server.
@@ -66,7 +64,9 @@ test.describe.serial('V6 license activation flow', () => {
await ensureAuthenticated(page);
// Clear the license in Pulse (ignore errors — may already be cleared).
- await apiRequest(page, '/api/license/clear', { method: 'POST' }).catch(() => {});
+ await apiRequest(page, "/api/license/clear", { method: "POST" }).catch(
+ () => {},
+ );
} catch {
// If Pulse is unreachable, nothing to clean up locally.
}
@@ -77,12 +77,12 @@ test.describe.serial('V6 license activation flow', () => {
await page.request.fetch(
`${LICENSE_SERVER_URL}/v1/licenses/${issuedLicenseId}/revoke`,
{
- method: 'POST',
+ method: "POST",
headers: {
- 'Content-Type': 'application/json',
- 'X-API-Token': ADMIN_TOKEN,
+ "Content-Type": "application/json",
+ "X-API-Token": ADMIN_TOKEN,
},
- data: { reason: 'E2E test cleanup', reason_code: 'test_cleanup' },
+ data: { reason: "E2E test cleanup", reason_code: "test_cleanup" },
},
);
} catch {
@@ -93,29 +93,38 @@ test.describe.serial('V6 license activation flow', () => {
await context.close();
});
- test('issues a v6 test license via admin API', async ({ page }, testInfo) => {
- test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set — skipping v6 activation tests');
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only license workflow');
-
- const response = await page.request.fetch(`${LICENSE_SERVER_URL}/v1/licenses/issue`, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- 'X-API-Token': ADMIN_TOKEN,
- },
- data: {
- generation: 'v6',
- email: '[email protected]',
- tier: 'pro',
- plan_key: 'pro_monthly',
- billing_model: 'manual',
- duration_days: 1,
- max_monitored_systems: 0,
- max_guests: 5,
- max_installations: 3,
- send_email: false,
+ test("issues a v6 test license via admin API", async ({ page }, testInfo) => {
+ test.skip(
+ !ADMIN_TOKEN,
+ "PULSE_LICENSE_ADMIN_TOKEN not set — skipping v6 activation tests",
+ );
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop-only license workflow",
+ );
+
+ const response = await page.request.fetch(
+ `${LICENSE_SERVER_URL}/v1/licenses/issue`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "X-API-Token": ADMIN_TOKEN,
+ },
+ data: {
+ generation: "v6",
+ email: "[email protected]",
+ tier: "pro",
+ plan_key: "pro_monthly",
+ billing_model: "manual",
+ duration_days: 1,
+ max_monitored_systems: 0,
+ max_guests: 5,
+ max_installations: 3,
+ send_email: false,
+ },
},
- });
+ );
expect(
[200, 201].includes(response.status()),
@@ -131,192 +140,231 @@ test.describe.serial('V6 license activation flow', () => {
activationKey = body.activation_key.activation_key;
});
- test('clears any existing license for a clean slate', async ({ page }, testInfo) => {
- test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set');
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only');
+ test("clears any existing license for a clean slate", async ({
+ page,
+ }, testInfo) => {
+ test.skip(!ADMIN_TOKEN, "PULSE_LICENSE_ADMIN_TOKEN not set");
+ test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only");
await ensureAuthenticated(page);
- const clearRes = await apiRequest(page, '/api/license/clear', { method: 'POST' });
- expect(clearRes.ok(), `Clear license failed: ${clearRes.status()}`).toBeTruthy();
+ const clearRes = await apiRequest(page, "/api/license/clear", {
+ method: "POST",
+ });
+ expect(
+ clearRes.ok(),
+ `Clear license failed: ${clearRes.status()}`,
+ ).toBeTruthy();
// Verify we're on the free tier now.
- const entRes = await apiRequest(page, '/api/license/entitlements');
+ const entRes = await apiRequest(page, "/api/license/entitlements");
expect(entRes.ok()).toBeTruthy();
const ent = (await entRes.json()) as EntitlementPayload;
- expect(ent.tier).toBe('free');
+ expect(ent.tier).toBe("free");
});
- test('activates v6 license via the Settings UI', async ({ page }, testInfo) => {
- test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set');
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only');
- test.skip(!activationKey, 'No activation key from previous step');
+ test("activates v6 license via the Settings UI", async ({
+ page,
+ }, testInfo) => {
+ test.skip(!ADMIN_TOKEN, "PULSE_LICENSE_ADMIN_TOKEN not set");
+ test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only");
+ test.skip(!activationKey, "No activation key from previous step");
await ensureAuthenticated(page);
- await page.goto('/settings/system/billing');
- await expect(page.getByRole('heading', { name: 'Plans & Activation' }).first()).toBeVisible();
- await expect(page.getByRole('heading', { name: 'Activation & Recovery' })).toBeVisible();
+ await page.goto("/settings/system/billing");
+ await expect(
+ page.getByRole("heading", { name: "Plans & Activation" }).first(),
+ ).toBeVisible();
+ await expect(
+ page.getByRole("heading", { name: "Activation & Recovery" }),
+ ).toBeVisible();
// Fill in the activation key.
- const textarea = page.locator('#pulse-pro-license-key');
+ const textarea = page.locator("#pulse-pro-license-key");
await expect(textarea).toBeVisible();
await textarea.fill(activationKey);
// Click Activate.
- const activateButton = page.getByRole('button', { name: 'Activate License' });
+ const activateButton = page.getByRole("button", {
+ name: "Activate License",
+ });
await expect(activateButton).toBeEnabled();
await activateButton.click();
// Wait for activation to complete: poll entitlements until active, which is
// more reliable than matching a transient toast.
- await expect.poll(async () => {
- const res = await apiRequest(page, '/api/license/entitlements');
- if (!res.ok()) return '';
- const ent = (await res.json()) as EntitlementPayload;
- return ent.subscription_state;
- }, { timeout: 30_000, message: 'License did not activate within timeout' }).toBe('active');
+ await expect
+ .poll(
+ async () => {
+ const res = await apiRequest(page, "/api/license/entitlements");
+ if (!res.ok()) return "";
+ const ent = (await res.json()) as EntitlementPayload;
+ return ent.subscription_state;
+ },
+ { timeout: 30_000, message: "License did not activate within timeout" },
+ )
+ .toBe("active");
});
- test('verifies activated license in UI and API', async ({ page }, testInfo) => {
- test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set');
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only');
- test.skip(!activationKey, 'No activation key from previous step');
+ test("verifies activated license in UI and API", async ({
+ page,
+ }, testInfo) => {
+ test.skip(!ADMIN_TOKEN, "PULSE_LICENSE_ADMIN_TOKEN not set");
+ test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only");
+ test.skip(!activationKey, "No activation key from previous step");
await ensureAuthenticated(page);
- await page.goto('/settings/system/billing');
- await expect(page.getByRole('heading', { name: 'Plans & Activation' }).first()).toBeVisible();
- await expect(page.getByRole('heading', { name: 'Current plan' })).toBeVisible();
- await expect(page.getByText('Current plan: Pulse Pro')).toBeVisible();
- await expect(page.getByText(/^Active$/).first()).toBeVisible({ timeout: 10_000 });
- await expect(page.getByText('No Pro license is active.')).toHaveCount(0);
- await expect(page.getByText('Unlimited').first()).toBeVisible();
+ await page.goto("/settings/system/billing");
+ await expect(
+ page.getByRole("heading", { name: "Plans & Activation" }).first(),
+ ).toBeVisible();
+ await expect(
+ page.getByRole("heading", { name: "Current plan" }),
+ ).toBeVisible();
+ await expect(page.getByText("Current plan: Pulse Pro")).toBeVisible();
+ await expect(page.getByText(/^Active$/).first()).toBeVisible({
+ timeout: 10_000,
+ });
+ await expect(page.getByText("No Pro license is active.")).toHaveCount(0);
+ await expect(page.getByText("Unlimited").first()).toBeVisible();
// Verify entitlements API agrees.
- const entRes = await apiRequest(page, '/api/license/entitlements');
- expect(entRes.ok(), `Entitlements request failed: ${entRes.status()}`).toBeTruthy();
+ const entRes = await apiRequest(page, "/api/license/entitlements");
+ expect(
+ entRes.ok(),
+ `Entitlements request failed: ${entRes.status()}`,
+ ).toBeTruthy();
const ent = (await entRes.json()) as EntitlementPayload;
- expect(ent.tier).toBe('pro');
- expect(ent.subscription_state).toBe('active');
+ expect(ent.tier).toBe("pro");
+ expect(ent.subscription_state).toBe("active");
expect(ent.valid).toBe(true);
- expect(ent.licensed_email).toBe('[email protected]');
+ expect(ent.licensed_email).toBe("[email protected]");
// Core monitoring is unlimited for self-hosted v6 plans.
- const agentLimit = ent.limits?.find((l) => l.key === 'max_monitored_systems');
+ const agentLimit = ent.limits?.find(
+ (l) => l.key === "max_monitored_systems",
+ );
expect(agentLimit).toBeUndefined();
// Check max_guests limit.
- const guestLimit = ent.limits?.find((l) => l.key === 'max_guests');
- expect(guestLimit, 'max_guests limit not found in entitlements').toBeTruthy();
+ const guestLimit = ent.limits?.find((l) => l.key === "max_guests");
+ expect(
+ guestLimit,
+ "max_guests limit not found in entitlements",
+ ).toBeTruthy();
expect(guestLimit!.limit).toBe(5);
});
- test('surfaces activated-install quickstart readiness without requiring BYOK', async ({
+ test("keeps activated installs on BYOK or local AI setup without quickstart", async ({
page,
}, testInfo) => {
- test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set');
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only');
- test.skip(!activationKey, 'No activation key from previous step');
+ test.skip(!ADMIN_TOKEN, "PULSE_LICENSE_ADMIN_TOKEN not set");
+ test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only");
+ test.skip(!activationKey, "No activation key from previous step");
await ensureAuthenticated(page);
- const entRes = await apiRequest(page, '/api/license/entitlements');
- expect(entRes.ok(), `Entitlements request failed: ${entRes.status()}`).toBeTruthy();
+ const entRes = await apiRequest(page, "/api/license/entitlements");
+ expect(
+ entRes.ok(),
+ `Entitlements request failed: ${entRes.status()}`,
+ ).toBeTruthy();
const ent = (await entRes.json()) as EntitlementPayload;
- expect(ent.subscription_state).toBe('active');
+ expect(ent.subscription_state).toBe("active");
- await page.goto('/settings/system-ai');
- await expect(page.getByRole('heading', { name: 'Assistant & Patrol' }).first()).toBeVisible();
+ await page.goto("/settings/system-ai");
+ await expect(
+ page.getByRole("heading", { name: "Assistant & Patrol" }).first(),
+ ).toBeVisible();
- const preSettingsRes = await apiRequest(page, '/api/settings/ai');
- expect(preSettingsRes.ok(), `AI settings request failed: ${preSettingsRes.status()}`).toBeTruthy();
+ const preSettingsRes = await apiRequest(page, "/api/settings/ai");
+ expect(
+ preSettingsRes.ok(),
+ `AI settings request failed: ${preSettingsRes.status()}`,
+ ).toBeTruthy();
const preSettings = (await preSettingsRes.json()) as AISettingsPayload;
- expect(preSettings.quickstart_credits_available).toBe(true);
- expect(preSettings.quickstart_credits_total).toBe(25);
- expect(preSettings.quickstart_credits_remaining).toBe(25);
- expect(preSettings.quickstart_blocked_reason || '').toBe('');
+ expect(preSettings).not.toHaveProperty("quickstart_credits_available");
+ expect(preSettings).not.toHaveProperty("quickstart_credits_total");
+ expect(preSettings).not.toHaveProperty("quickstart_credits_remaining");
+ expect(preSettings).not.toHaveProperty("quickstart_blocked_reason");
- const enableAI = page.getByRole('button', { name: 'Enable Assistant and Patrol' });
+ const enableAI = page.getByRole("button", {
+ name: "Enable Assistant and Patrol",
+ });
await expect(enableAI).toBeVisible();
if (await page.getByText(/^Disabled$/).isVisible()) {
await enableAI.click();
}
- await expect
- .poll(async () => {
- const res = await apiRequest(page, '/api/settings/ai');
- if (!res.ok()) return null;
- const body = (await res.json()) as AISettingsPayload;
- return {
- enabled: body.enabled === true,
- model: body.model || '',
- quickstart_credits_available: body.quickstart_credits_available === true,
- quickstart_credits_remaining: body.quickstart_credits_remaining ?? -1,
- };
- }, { timeout: 30_000 })
- .toEqual({
- enabled: true,
- model: 'quickstart:pulse-hosted',
- quickstart_credits_available: true,
- quickstart_credits_remaining: 25,
- });
-
await expect(
- page.getByText(/Patrol quickstart ready • 25\/25 runs left • no API key needed yet/i),
+ page.getByText("Connect a provider to power Pulse Assistant and Patrol."),
).toBeVisible();
+ await expect(page.getByText(/Patrol quickstart/i)).toHaveCount(0);
- await page.goto('/ai');
- await expect(page.getByRole('heading', { name: 'Patrol' }).first()).toBeVisible();
- await expect(page.getByText('Patrol quickstart: 25/25 runs left')).toBeVisible();
- await expect(page.getByRole('button', { name: 'Run Patrol' })).toBeEnabled();
+ await page.goto("/ai");
+ await expect(
+ page.getByRole("heading", { name: "Patrol" }).first(),
+ ).toBeVisible();
+ await expect(page.getByText(/Patrol quickstart/i)).toHaveCount(0);
- const patrolStatusRes = await apiRequest(page, '/api/ai/patrol/status');
+ const patrolStatusRes = await apiRequest(page, "/api/ai/patrol/status");
expect(
patrolStatusRes.ok(),
`Patrol status request failed: ${patrolStatusRes.status()}`,
).toBeTruthy();
const patrolStatus = (await patrolStatusRes.json()) as PatrolStatusPayload;
- expect(patrolStatus.using_quickstart).toBe(true);
- expect(patrolStatus.quickstart_credits_total).toBe(25);
- expect(patrolStatus.quickstart_credits_remaining).toBe(25);
- expect(patrolStatus.runtime_state).toBe('active');
+ expect(patrolStatus).not.toHaveProperty("using_quickstart");
+ expect(patrolStatus).not.toHaveProperty("quickstart_credits_total");
+ expect(patrolStatus).not.toHaveProperty("quickstart_credits_remaining");
});
- test('clears license via UI and verifies free tier', async ({ page }, testInfo) => {
- test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set');
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only');
- test.skip(!activationKey, 'No activation key from previous step');
+ test("clears license via UI and verifies free tier", async ({
+ page,
+ }, testInfo) => {
+ test.skip(!ADMIN_TOKEN, "PULSE_LICENSE_ADMIN_TOKEN not set");
+ test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only");
+ test.skip(!activationKey, "No activation key from previous step");
await ensureAuthenticated(page);
- await page.goto('/settings/system/billing');
- await expect(page.getByRole('heading', { name: 'Plans & Activation' }).first()).toBeVisible();
- await expect(page.getByRole('heading', { name: 'Activation & Recovery' })).toBeVisible();
+ await page.goto("/settings/system/billing");
+ await expect(
+ page.getByRole("heading", { name: "Plans & Activation" }).first(),
+ ).toBeVisible();
+ await expect(
+ page.getByRole("heading", { name: "Activation & Recovery" }),
+ ).toBeVisible();
// Set up one-shot dialog handler for the native confirm() prompt.
- page.once('dialog', (dialog) => dialog.accept());
+ page.once("dialog", (dialog) => dialog.accept());
// Click Clear License.
- const clearButton = page.getByRole('button', { name: 'Clear License' });
+ const clearButton = page.getByRole("button", { name: "Clear License" });
await expect(clearButton).toBeEnabled({ timeout: 5_000 });
await clearButton.click();
// Wait for success toast.
- await expect(
- page.locator('text=/License cleared/i').first(),
- ).toBeVisible({ timeout: 10_000 });
+ await expect(page.locator("text=/License cleared/i").first()).toBeVisible({
+ timeout: 10_000,
+ });
// Verify entitlements API reverts to free tier.
- await expect.poll(async () => {
- const res = await apiRequest(page, '/api/license/entitlements');
- if (!res.ok()) return '';
- const ent = (await res.json()) as EntitlementPayload;
- return ent.tier;
- }, { timeout: 10_000 }).toBe('free');
+ await expect
+ .poll(
+ async () => {
+ const res = await apiRequest(page, "/api/license/entitlements");
+ if (!res.ok()) return "";
+ const ent = (await res.json()) as EntitlementPayload;
+ return ent.tier;
+ },
+ { timeout: 10_000 },
+ )
+ .toBe("free");
// Verify UI shows "No Pro license is active" or free-tier state.
await page.reload();
await expect(
- page.locator('text=/No Pro license is active/i').first(),
+ page.locator("text=/No Pro license is active/i").first(),
).toBeVisible({ timeout: 10_000 });
});
});
diff --git a/tests/integration/tests/18-patrol-runtime-state.spec.ts b/tests/integration/tests/18-patrol-runtime-state.spec.ts
index 3ef772cd00..7f178d2147 100644
--- a/tests/integration/tests/18-patrol-runtime-state.spec.ts
+++ b/tests/integration/tests/18-patrol-runtime-state.spec.ts
@@ -3,7 +3,7 @@ import { expect, test, type Page } from "@playwright/test";
import { ensureAuthenticated, trackBrowserRequests } from "./helpers";
const PATROL_BLOCK_REASON =
- "Quickstart credits exhausted. Connect your API key to continue using Patrol.";
+ "Connect a provider to power Pulse Assistant and Patrol.";
function todayAt(hours: number, minutes: number): string {
const value = new Date();
@@ -34,9 +34,6 @@ const blockedPatrolStatus = {
watch: 0,
info: 0,
},
- using_quickstart: true,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 0,
};
const staleHealthySummary = {
@@ -222,9 +219,6 @@ const scopedTriggerPatrolStatus = {
watch: 0,
info: 0,
},
- using_quickstart: true,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 12,
};
async function mockBlockedPatrolRuntimeState(page: Page): Promise<void> {
@@ -506,7 +500,7 @@ test.describe("Patrol runtime-state browser contract", () => {
await expect(
page.getByRole("button", { name: "Run Patrol" }),
).toBeDisabled();
- await expect(page.getByText("Patrol quickstart exhausted")).toBeVisible();
+ await expect(page.getByText(/Patrol quickstart/i)).toHaveCount(0);
await expect(page.getByText("Health A · 100/100")).toHaveCount(0);
expect(commercialPostureRequests.count()).toBe(0);
expect(entitlementsRequests.count()).toBe(0);
diff --git a/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts b/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts
index 6e13d95f6b..54409c2f02 100644
--- a/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts
+++ b/tests/integration/tests/29-truenas-patrol-finding-links.spec.ts
@@ -1,9 +1,9 @@
-import fs from 'node:fs';
-import path from 'node:path';
-import { fileURLToPath } from 'node:url';
-import { test as base, expect } from '@playwright/test';
+import fs from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { test as base, expect } from "@playwright/test";
-import { createAuthenticatedStorageState } from './helpers';
+import { createAuthenticatedStorageState } from "./helpers";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -11,82 +11,87 @@ type WorkerFixtures = {
authStorageStatePath: string;
};
-const SCREENSHOT_PATH = '/tmp/truenas-patrol-finding-links.png';
+const SCREENSHOT_PATH = "/tmp/truenas-patrol-finding-links.png";
const test = base.extend<{}, WorkerFixtures>({
storageState: async ({ authStorageStatePath }, use) => {
await use(authStorageStatePath);
},
- authStorageStatePath: [async ({ browser }, use, workerInfo) => {
- const storageStatePath = path.resolve(
- __dirname,
- '..',
- '..',
- 'tmp',
- 'playwright-auth',
- `truenas-patrol-finding-links-${workerInfo.project.name}.json`,
- );
- fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
- await createAuthenticatedStorageState(browser, storageStatePath);
- try {
- await use(storageStatePath);
- } finally {
- fs.rmSync(storageStatePath, { force: true });
- }
- }, { scope: 'worker' }],
+ authStorageStatePath: [
+ async ({ browser }, use, workerInfo) => {
+ const storageStatePath = path.resolve(
+ __dirname,
+ "..",
+ "..",
+ "tmp",
+ "playwright-auth",
+ `truenas-patrol-finding-links-${workerInfo.project.name}.json`,
+ );
+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
+ await createAuthenticatedStorageState(browser, storageStatePath);
+ try {
+ await use(storageStatePath);
+ } finally {
+ fs.rmSync(storageStatePath, { force: true });
+ }
+ },
+ { scope: "worker" },
+ ],
});
-test.describe('TrueNAS patrol finding links', () => {
+test.describe("TrueNAS patrol finding links", () => {
test.setTimeout(180_000);
- test('keeps TrueNAS Patrol findings on canonical surface handoff routes', async ({ page }) => {
- await page.route('**/api/resources**', async (route) => {
+ test("keeps TrueNAS Patrol findings on canonical surface handoff routes", async ({
+ page,
+ }) => {
+ await page.route("**/api/resources**", async (route) => {
const requestUrl = new URL(route.request().url());
- if (requestUrl.pathname !== '/api/resources') {
+ if (requestUrl.pathname !== "/api/resources") {
await route.continue();
return;
}
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
data: [
{
- id: 'truenas-main',
- type: 'agent',
- name: 'truenas-main',
- displayName: 'TrueNAS Main',
- platformId: 'truenas-main',
- platformType: 'truenas',
- sourceType: 'hybrid',
- sources: ['agent', 'truenas'],
- status: 'online',
- lastSeen: '2026-03-30T10:00:00Z',
+ id: "truenas-main",
+ type: "agent",
+ name: "truenas-main",
+ displayName: "TrueNAS Main",
+ platformId: "truenas-main",
+ platformType: "truenas",
+ sourceType: "hybrid",
+ sources: ["agent", "truenas"],
+ status: "online",
+ lastSeen: "2026-03-30T10:00:00Z",
canonicalIdentity: {
- displayName: 'TrueNAS Main',
- hostname: 'truenas-main',
- platformId: 'truenas-main',
+ displayName: "TrueNAS Main",
+ hostname: "truenas-main",
+ platformId: "truenas-main",
},
platformData: {
- sources: ['agent', 'truenas'],
+ sources: ["agent", "truenas"],
},
},
{
- id: 'app-container:truenas-main:nextcloud',
- type: 'app-container',
- name: 'nextcloud',
- displayName: 'Nextcloud',
- parentId: 'truenas-main',
- parentName: 'TrueNAS Main',
- platformId: 'truenas-main',
- platformType: 'truenas',
- sourceType: 'api',
- sources: ['truenas'],
- status: 'running',
- lastSeen: '2026-03-30T10:00:00Z',
+ id: "app-container:truenas-main:nextcloud",
+ type: "app-container",
+ name: "nextcloud",
+ displayName: "Nextcloud",
+ parentId: "truenas-main",
+ parentName: "TrueNAS Main",
+ platformId: "truenas-main",
+ platformType: "truenas",
+ sourceType: "api",
+ sources: ["truenas"],
+ status: "running",
+ lastSeen: "2026-03-30T10:00:00Z",
platformData: {
- sources: ['truenas'],
+ sources: ["truenas"],
},
},
],
@@ -100,17 +105,17 @@ test.describe('TrueNAS patrol finding links', () => {
});
});
- await page.route('**/api/ai/patrol/status', async (route) => {
+ await page.route("**/api/ai/patrol/status", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- runtime_state: 'active',
+ runtime_state: "active",
running: false,
enabled: true,
- last_patrol_at: '2026-03-30T09:00:00Z',
- last_activity_at: '2026-03-30T10:05:00Z',
- next_patrol_at: '2026-03-30T15:00:00Z',
+ last_patrol_at: "2026-03-30T09:00:00Z",
+ last_activity_at: "2026-03-30T10:05:00Z",
+ next_patrol_at: "2026-03-30T15:00:00Z",
last_duration_ms: 180000,
resources_checked: 42,
findings_count: 2,
@@ -118,40 +123,37 @@ test.describe('TrueNAS patrol finding links', () => {
healthy: false,
interval_ms: 21600000,
fixed_count: 0,
- blocked_reason: '',
- blocked_at: '',
+ blocked_reason: "",
+ blocked_at: "",
license_required: false,
- license_status: 'active',
+ license_status: "active",
summary: {
critical: 1,
warning: 1,
watch: 0,
info: 0,
},
- using_quickstart: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
}),
});
});
- await page.route('**/api/ai/patrol/runs*', async (route) => {
+ await page.route("**/api/ai/patrol/runs*", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify([
{
- id: 'run-truenas-links',
- started_at: '2026-03-30T09:00:00Z',
- completed_at: '2026-03-30T09:03:00Z',
+ id: "run-truenas-links",
+ started_at: "2026-03-30T09:00:00Z",
+ completed_at: "2026-03-30T09:03:00Z",
duration_ms: 180000,
- type: 'full',
- trigger_reason: 'scheduled',
+ type: "full",
+ trigger_reason: "scheduled",
resources_checked: 42,
- findings_summary: '2 findings',
- finding_ids: ['finding-truenas-system', 'finding-truenas-app'],
+ findings_summary: "2 findings",
+ finding_ids: ["finding-truenas-system", "finding-truenas-app"],
error_count: 0,
- status: 'warning',
+ status: "warning",
triage_flags: 0,
tool_call_count: 0,
},
@@ -159,12 +161,12 @@ test.describe('TrueNAS patrol finding links', () => {
});
});
- await page.route('**/api/ai/patrol/autonomy', async (route) => {
+ await page.route("**/api/ai/patrol/autonomy", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- autonomy_level: 'monitor',
+ autonomy_level: "monitor",
full_mode_unlocked: false,
investigation_budget: 15,
investigation_timeout_sec: 300,
@@ -172,66 +174,68 @@ test.describe('TrueNAS patrol finding links', () => {
});
});
- await page.route('**/api/ai/models', async (route) => {
+ await page.route("**/api/ai/models", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ models: [] }),
});
});
- await page.route('**/api/settings/ai', async (route) => {
+ await page.route("**/api/settings/ai", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
patrol_enabled: true,
patrol_interval_minutes: 360,
- patrol_model: '',
- model: '',
+ patrol_model: "",
+ model: "",
alert_triggered_analysis: true,
patrol_alert_triggers_enabled: true,
patrol_anomaly_triggers_enabled: true,
patrol_event_triggers_enabled: true,
patrol_auto_fix: false,
- auto_fix_model: '',
+ auto_fix_model: "",
}),
});
});
- await page.route('**/api/ai/unified/findings*', async (route) => {
+ await page.route("**/api/ai/unified/findings*", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
findings: [
{
- id: 'finding-truenas-system',
- severity: 'critical',
- category: 'availability',
- resource_id: 'truenas-main',
- resource_name: 'TrueNAS Main',
- resource_type: 'agent',
- title: 'TrueNAS system offline',
- description: 'Pulse Patrol detected that the TrueNAS appliance stopped reporting.',
- detected_at: '2026-03-30T09:10:00Z',
- last_seen_at: '2026-03-30T10:05:00Z',
+ id: "finding-truenas-system",
+ severity: "critical",
+ category: "availability",
+ resource_id: "truenas-main",
+ resource_name: "TrueNAS Main",
+ resource_type: "agent",
+ title: "TrueNAS system offline",
+ description:
+ "Pulse Patrol detected that the TrueNAS appliance stopped reporting.",
+ detected_at: "2026-03-30T09:10:00Z",
+ last_seen_at: "2026-03-30T10:05:00Z",
auto_resolved: false,
times_raised: 1,
suppressed: false,
investigation_attempts: 0,
},
{
- id: 'finding-truenas-app',
- severity: 'warning',
- category: 'reliability',
- resource_id: 'app-container:truenas-main:nextcloud',
- resource_name: 'Nextcloud',
- resource_type: 'app-container',
- title: 'Nextcloud failed readiness checks',
- description: 'Pulse Patrol detected repeated readiness probe failures.',
- detected_at: '2026-03-30T09:20:00Z',
- last_seen_at: '2026-03-30T10:05:00Z',
+ id: "finding-truenas-app",
+ severity: "warning",
+ category: "reliability",
+ resource_id: "app-container:truenas-main:nextcloud",
+ resource_name: "Nextcloud",
+ resource_type: "app-container",
+ title: "Nextcloud failed readiness checks",
+ description:
+ "Pulse Patrol detected repeated readiness probe failures.",
+ detected_at: "2026-03-30T09:20:00Z",
+ last_seen_at: "2026-03-30T10:05:00Z",
auto_resolved: false,
times_raised: 1,
suppressed: false,
@@ -244,26 +248,26 @@ test.describe('TrueNAS patrol finding links', () => {
});
});
- await page.route('**/api/ai/intelligence/correlations*', async (route) => {
+ await page.route("**/api/ai/intelligence/correlations*", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ correlations: [], count: 0 }),
});
});
- await page.route('**/api/ai/intelligence', async (route) => {
+ await page.route("**/api/ai/intelligence", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- timestamp: '2026-03-30T10:05:00Z',
+ timestamp: "2026-03-30T10:05:00Z",
overall_health: {
score: 71,
- grade: 'C',
- trend: 'stable',
+ grade: "C",
+ trend: "stable",
factors: [],
- prediction: 'TrueNAS resources need attention.',
+ prediction: "TrueNAS resources need attention.",
},
findings_count: {
critical: 1,
@@ -287,12 +291,12 @@ test.describe('TrueNAS patrol finding links', () => {
});
});
- await page.route('**/api/ai/circuit/status', async (route) => {
+ await page.route("**/api/ai/circuit/status", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- state: 'closed',
+ state: "closed",
can_patrol: true,
consecutive_failures: 0,
total_successes: 42,
@@ -301,61 +305,69 @@ test.describe('TrueNAS patrol finding links', () => {
});
});
- await page.route('**/api/ai/approvals', async (route) => {
+ await page.route("**/api/ai/approvals", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ approvals: [] }),
});
});
- await page.route('**/api/ai/remediation/plans', async (route) => {
+ await page.route("**/api/ai/remediation/plans", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ plans: [] }),
});
});
- await page.goto('/ai', { waitUntil: 'domcontentloaded' });
+ await page.goto("/ai", { waitUntil: "domcontentloaded" });
- await expect(page.getByRole('button', { name: 'Findings' })).toBeVisible();
+ await expect(page.getByRole("button", { name: "Findings" })).toBeVisible();
- await page.getByText('TrueNAS system offline').click();
- const systemFinding = page.locator('#finding-finding-truenas-system');
+ await page.getByText("TrueNAS system offline").click();
+ const systemFinding = page.locator("#finding-finding-truenas-system");
await expect(
- systemFinding.getByRole('link', {
- name: 'Open related infrastructure for TrueNAS Main',
+ systemFinding.getByRole("link", {
+ name: "Open related infrastructure for TrueNAS Main",
}),
- ).toHaveAttribute('href', '/infrastructure?resource=truenas-main');
+ ).toHaveAttribute("href", "/infrastructure?resource=truenas-main");
await expect(
- systemFinding.getByRole('link', { name: 'Open related workloads for TrueNAS Main' }),
+ systemFinding.getByRole("link", {
+ name: "Open related workloads for TrueNAS Main",
+ }),
).toHaveAttribute(
- 'href',
- '/workloads?type=app-container&platform=truenas&agent=truenas-main',
+ "href",
+ "/workloads?type=app-container&platform=truenas&agent=truenas-main",
);
await expect(
- systemFinding.getByRole('link', { name: 'Open related storage for TrueNAS Main' }),
- ).toHaveAttribute('href', '/storage?source=truenas&node=truenas-main');
+ systemFinding.getByRole("link", {
+ name: "Open related storage for TrueNAS Main",
+ }),
+ ).toHaveAttribute("href", "/storage?source=truenas&node=truenas-main");
await expect(
- systemFinding.getByRole('link', { name: 'Open related recovery for TrueNAS Main' }),
- ).toHaveAttribute('href', '/recovery?platform=truenas&node=truenas-main');
+ systemFinding.getByRole("link", {
+ name: "Open related recovery for TrueNAS Main",
+ }),
+ ).toHaveAttribute("href", "/recovery?platform=truenas&node=truenas-main");
- await page.getByText('Nextcloud failed readiness checks').click();
- const appFinding = page.locator('#finding-finding-truenas-app');
+ await page.getByText("Nextcloud failed readiness checks").click();
+ const appFinding = page.locator("#finding-finding-truenas-app");
await expect(
- appFinding.getByRole('link', {
- name: 'Open related infrastructure for Nextcloud',
+ appFinding.getByRole("link", {
+ name: "Open related infrastructure for Nextcloud",
}),
).toHaveAttribute(
- 'href',
- '/infrastructure?resource=app-container%3Atruenas-main%3Anextcloud',
+ "href",
+ "/infrastructure?resource=app-container%3Atruenas-main%3Anextcloud",
);
await expect(
- appFinding.getByRole('link', { name: 'Open related workloads for Nextcloud' }),
+ appFinding.getByRole("link", {
+ name: "Open related workloads for Nextcloud",
+ }),
).toHaveAttribute(
- 'href',
- '/workloads?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
+ "href",
+ "/workloads?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud",
);
await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
diff --git a/tests/integration/tests/34-truenas-patrol-history-breakdown.spec.ts b/tests/integration/tests/34-truenas-patrol-history-breakdown.spec.ts
index 790d0fcd0b..8c598c1c2a 100644
--- a/tests/integration/tests/34-truenas-patrol-history-breakdown.spec.ts
+++ b/tests/integration/tests/34-truenas-patrol-history-breakdown.spec.ts
@@ -1,9 +1,9 @@
-import fs from 'node:fs';
-import path from 'node:path';
-import { fileURLToPath } from 'node:url';
-import { test as base, expect } from '@playwright/test';
+import fs from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { test as base, expect } from "@playwright/test";
-import { createAuthenticatedStorageState } from './helpers';
+import { createAuthenticatedStorageState } from "./helpers";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -11,39 +11,44 @@ type WorkerFixtures = {
authStorageStatePath: string;
};
-const SCREENSHOT_PATH = '/tmp/truenas-patrol-run-history.png';
+const SCREENSHOT_PATH = "/tmp/truenas-patrol-run-history.png";
const test = base.extend<{}, WorkerFixtures>({
storageState: async ({ authStorageStatePath }, use) => {
await use(authStorageStatePath);
},
- authStorageStatePath: [async ({ browser }, use, workerInfo) => {
- const storageStatePath = path.resolve(
- __dirname,
- '..',
- '..',
- 'tmp',
- 'playwright-auth',
- `truenas-patrol-history-breakdown-${workerInfo.project.name}.json`,
- );
- fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
- await createAuthenticatedStorageState(browser, storageStatePath);
- try {
- await use(storageStatePath);
- } finally {
- fs.rmSync(storageStatePath, { force: true });
- }
- }, { scope: 'worker' }],
+ authStorageStatePath: [
+ async ({ browser }, use, workerInfo) => {
+ const storageStatePath = path.resolve(
+ __dirname,
+ "..",
+ "..",
+ "tmp",
+ "playwright-auth",
+ `truenas-patrol-history-breakdown-${workerInfo.project.name}.json`,
+ );
+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
+ await createAuthenticatedStorageState(browser, storageStatePath);
+ try {
+ await use(storageStatePath);
+ } finally {
+ fs.rmSync(storageStatePath, { force: true });
+ }
+ },
+ { scope: "worker" },
+ ],
});
-test.describe('TrueNAS patrol run history', () => {
+test.describe("TrueNAS patrol run history", () => {
test.setTimeout(180_000);
- test('keeps TrueNAS patrol counts separate from agent hosts in run history', async ({ page }) => {
- await page.route('**/api/resources**', async (route) => {
+ test("keeps TrueNAS patrol counts separate from agent hosts in run history", async ({
+ page,
+ }) => {
+ await page.route("**/api/resources**", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
data: [],
meta: { page: 1, limit: 200, total: 0, totalPages: 0 },
@@ -51,17 +56,17 @@ test.describe('TrueNAS patrol run history', () => {
});
});
- await page.route('**/api/ai/patrol/status', async (route) => {
+ await page.route("**/api/ai/patrol/status", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- runtime_state: 'active',
+ runtime_state: "active",
running: false,
enabled: true,
- last_patrol_at: '2026-03-30T09:00:00Z',
- last_activity_at: '2026-03-30T09:03:00Z',
- next_patrol_at: '2026-03-30T15:00:00Z',
+ last_patrol_at: "2026-03-30T09:00:00Z",
+ last_activity_at: "2026-03-30T09:03:00Z",
+ next_patrol_at: "2026-03-30T15:00:00Z",
last_duration_ms: 180000,
resources_checked: 2,
findings_count: 0,
@@ -69,35 +74,32 @@ test.describe('TrueNAS patrol run history', () => {
healthy: true,
interval_ms: 21600000,
fixed_count: 0,
- blocked_reason: '',
- blocked_at: '',
+ blocked_reason: "",
+ blocked_at: "",
license_required: false,
- license_status: 'active',
+ license_status: "active",
summary: {
critical: 0,
warning: 0,
watch: 0,
info: 0,
},
- using_quickstart: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
}),
});
});
- await page.route('**/api/ai/patrol/runs*', async (route) => {
+ await page.route("**/api/ai/patrol/runs*", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify([
{
- id: 'run-truenas-breakdown',
- started_at: '2026-03-30T09:00:00Z',
- completed_at: '2026-03-30T09:03:00Z',
+ id: "run-truenas-breakdown",
+ started_at: "2026-03-30T09:00:00Z",
+ completed_at: "2026-03-30T09:03:00Z",
duration_ms: 180000,
- type: 'full',
- trigger_reason: 'scheduled',
+ type: "full",
+ trigger_reason: "scheduled",
resources_checked: 2,
nodes_checked: 0,
guests_checked: 0,
@@ -113,10 +115,10 @@ test.describe('TrueNAS patrol run history', () => {
rejected_findings: 0,
resolved_findings: 0,
auto_fix_count: 0,
- findings_summary: 'TrueNAS patrol complete',
+ findings_summary: "TrueNAS patrol complete",
finding_ids: [],
error_count: 0,
- status: 'healthy',
+ status: "healthy",
triage_flags: 0,
tool_call_count: 0,
},
@@ -124,12 +126,12 @@ test.describe('TrueNAS patrol run history', () => {
});
});
- await page.route('**/api/ai/patrol/autonomy', async (route) => {
+ await page.route("**/api/ai/patrol/autonomy", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- autonomy_level: 'monitor',
+ autonomy_level: "monitor",
full_mode_unlocked: false,
investigation_budget: 15,
investigation_timeout_sec: 300,
@@ -137,37 +139,37 @@ test.describe('TrueNAS patrol run history', () => {
});
});
- await page.route('**/api/ai/models', async (route) => {
+ await page.route("**/api/ai/models", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ models: [] }),
});
});
- await page.route('**/api/settings/ai', async (route) => {
+ await page.route("**/api/settings/ai", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
patrol_enabled: true,
patrol_interval_minutes: 360,
- patrol_model: '',
- model: '',
+ patrol_model: "",
+ model: "",
alert_triggered_analysis: true,
patrol_alert_triggers_enabled: true,
patrol_anomaly_triggers_enabled: true,
patrol_event_triggers_enabled: true,
patrol_auto_fix: false,
- auto_fix_model: '',
+ auto_fix_model: "",
}),
});
});
- await page.route('**/api/ai/unified/findings*', async (route) => {
+ await page.route("**/api/ai/unified/findings*", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
findings: [],
count: 0,
@@ -176,26 +178,27 @@ test.describe('TrueNAS patrol run history', () => {
});
});
- await page.route('**/api/ai/intelligence/correlations*', async (route) => {
+ await page.route("**/api/ai/intelligence/correlations*", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ correlations: [], count: 0 }),
});
});
- await page.route('**/api/ai/intelligence', async (route) => {
+ await page.route("**/api/ai/intelligence", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- timestamp: '2026-03-30T09:03:00Z',
+ timestamp: "2026-03-30T09:03:00Z",
overall_health: {
score: 100,
- grade: 'A',
- trend: 'stable',
+ grade: "A",
+ trend: "stable",
factors: [],
- prediction: 'Infrastructure is healthy with no significant issues detected.',
+ prediction:
+ "Infrastructure is healthy with no significant issues detected.",
},
findings_count: {
critical: 0,
@@ -219,12 +222,12 @@ test.describe('TrueNAS patrol run history', () => {
});
});
- await page.route('**/api/ai/circuit/status', async (route) => {
+ await page.route("**/api/ai/circuit/status", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- state: 'closed',
+ state: "closed",
can_patrol: true,
consecutive_failures: 0,
total_successes: 1,
@@ -233,30 +236,30 @@ test.describe('TrueNAS patrol run history', () => {
});
});
- await page.route('**/api/ai/approvals', async (route) => {
+ await page.route("**/api/ai/approvals", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ approvals: [] }),
});
});
- await page.route('**/api/ai/remediation/plans', async (route) => {
+ await page.route("**/api/ai/remediation/plans", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ plans: [] }),
});
});
- await page.goto('/ai', { waitUntil: 'domcontentloaded' });
+ await page.goto("/ai", { waitUntil: "domcontentloaded" });
- await expect(page.getByRole('button', { name: 'Findings' })).toBeVisible();
- await page.getByRole('button', { name: 'Runs' }).click();
- await page.getByRole('button', { name: /Checked 2 resources/i }).click();
+ await expect(page.getByRole("button", { name: "Findings" })).toBeVisible();
+ await page.getByRole("button", { name: "Runs" }).click();
+ await page.getByRole("button", { name: /Checked 2 resources/i }).click();
- await expect(page.getByText('1 container')).toBeVisible();
- await expect(page.getByText('1 TrueNAS system')).toBeVisible();
+ await expect(page.getByText("1 container")).toBeVisible();
+ await expect(page.getByText("1 TrueNAS system")).toBeVisible();
await expect(page.getByText(/1 agent/)).toHaveCount(0);
await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
diff --git a/tests/integration/tests/51-quickstart-cross-surface.spec.ts b/tests/integration/tests/51-quickstart-cross-surface.spec.ts
index b56de00bb0..fc41bed6a0 100644
--- a/tests/integration/tests/51-quickstart-cross-surface.spec.ts
+++ b/tests/integration/tests/51-quickstart-cross-surface.spec.ts
@@ -2,18 +2,9 @@ import { expect, test, type Page } from "@playwright/test";
import { ensureAuthenticated } from "./helpers";
-const QUICKSTART_EXHAUSTED_REASON =
- "Quickstart credits exhausted. Connect your API key to continue using Patrol.";
-const QUICKSTART_ACTIVATION_REQUIRED_REASON =
- "Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.";
-const QUICKSTART_OFFLINE_REASON =
- "Quickstart credits require internet access. Connect your API key to use Patrol offline.";
-
type AISettingsPayload = {
enabled: boolean;
model: string;
- chat_model?: string;
- patrol_model?: string;
configured: boolean;
custom_context: string;
auth_method: string;
@@ -39,20 +30,14 @@ type AISettingsPayload = {
control_level: string;
protected_guests: string[];
discovery_enabled: boolean;
- quickstart_credits_total: number;
- quickstart_credits_used: number;
- quickstart_credits_remaining: number;
- quickstart_credits_available: boolean;
- using_quickstart: boolean;
- quickstart_blocked_reason?: string;
};
type PatrolStatusPayload = {
runtime_state: string;
running: boolean;
enabled: boolean;
- last_patrol_at: string;
- next_patrol_at: string;
+ last_patrol_at?: string;
+ next_patrol_at?: string;
last_duration_ms: number;
resources_checked: number;
findings_count: number;
@@ -60,8 +45,8 @@ type PatrolStatusPayload = {
healthy: boolean;
interval_ms: number;
fixed_count: number;
- blocked_reason: string;
- blocked_at: string;
+ blocked_reason?: string;
+ blocked_at?: string;
license_required: boolean;
license_status: string;
summary: {
@@ -70,23 +55,12 @@ type PatrolStatusPayload = {
watch: number;
info: number;
};
- using_quickstart: boolean;
- quickstart_credits_total: number;
- quickstart_credits_remaining: number;
-};
-
-type PatrolSurfaceOverrides = {
- settings?: Partial<AISettingsPayload>;
- patrolStatus?: Partial<PatrolStatusPayload>;
- intelligenceSummary?: Record<string, unknown>;
};
const baseAISettings = (): AISettingsPayload => ({
- enabled: true,
- model: "quickstart:pulse-hosted",
- chat_model: "quickstart:pulse-hosted",
- patrol_model: "quickstart:pulse-hosted",
- configured: true,
+ enabled: false,
+ model: "",
+ configured: false,
custom_context: "",
auth_method: "api_key",
oauth_connected: false,
@@ -111,28 +85,20 @@ const baseAISettings = (): AISettingsPayload => ({
control_level: "read_only",
protected_guests: [],
discovery_enabled: false,
- quickstart_credits_total: 25,
- quickstart_credits_used: 0,
- quickstart_credits_remaining: 25,
- quickstart_credits_available: true,
- using_quickstart: true,
});
const basePatrolStatus = (): PatrolStatusPayload => ({
- runtime_state: "active",
+ runtime_state: "blocked",
running: false,
- enabled: true,
- last_patrol_at: "2026-03-25T08:55:00Z",
- next_patrol_at: "2026-03-25T14:55:00Z",
- last_duration_ms: 42000,
- resources_checked: 24,
+ enabled: false,
+ last_duration_ms: 0,
+ resources_checked: 0,
findings_count: 0,
error_count: 0,
healthy: true,
interval_ms: 21600000,
fixed_count: 0,
- blocked_reason: "",
- blocked_at: "",
+ blocked_reason: "Connect a provider to power Pulse Assistant and Patrol.",
license_required: false,
license_status: "active",
summary: {
@@ -141,71 +107,8 @@ const basePatrolStatus = (): PatrolStatusPayload => ({
watch: 0,
info: 0,
},
- using_quickstart: true,
- quickstart_credits_total: 25,
- quickstart_credits_remaining: 25,
});
-const healthyIntelligenceSummary = () => ({
- timestamp: "2026-03-25T09:05:00Z",
- overall_health: {
- score: 100,
- grade: "A",
- trend: "stable",
- factors: [],
- prediction: "Infrastructure is healthy with no significant issues detected.",
- },
- findings_count: {
- critical: 0,
- warning: 0,
- watch: 0,
- info: 0,
- total: 0,
- },
- predictions_count: 0,
- recent_changes_count: 0,
- recent_changes: [],
- learning: {
- resources_with_knowledge: 0,
- total_notes: 0,
- resources_with_baselines: 0,
- patterns_detected: 0,
- correlations_learned: 0,
- incidents_tracked: 0,
- },
-});
-
-const baseRunHistory = () => [
- {
- id: "run-healthy-before-quickstart",
- started_at: "2026-03-25T08:55:00Z",
- completed_at: "2026-03-25T08:55:42Z",
- duration_ms: 42000,
- type: "full",
- trigger_reason: "scheduled",
- resources_checked: 24,
- nodes_checked: 2,
- guests_checked: 8,
- docker_checked: 4,
- storage_checked: 3,
- hosts_checked: 2,
- pbs_checked: 1,
- pmg_checked: 0,
- kubernetes_checked: 4,
- new_findings: 0,
- existing_findings: 0,
- rejected_findings: 0,
- resolved_findings: 0,
- auto_fix_count: 0,
- findings_summary: "No active findings",
- finding_ids: [],
- error_count: 0,
- status: "healthy",
- triage_flags: 0,
- tool_call_count: 0,
- },
-];
-
function clone<T>(value: T): T {
return JSON.parse(JSON.stringify(value)) as T;
}
@@ -235,7 +138,8 @@ async function browserApiRequest(
const response = await fetch(path, {
method: httpMethod,
headers,
- body: requestBody === undefined ? undefined : JSON.stringify(requestBody),
+ body:
+ requestBody === undefined ? undefined : JSON.stringify(requestBody),
});
const text = await response.text();
let body: unknown = text;
@@ -252,7 +156,13 @@ async function browserApiRequest(
);
}
-async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceOverrides = {}) {
+async function mockRetiredQuickstartSurface(
+ page: Page,
+ overrides: {
+ settings?: Partial<AISettingsPayload>;
+ patrolStatus?: Partial<PatrolStatusPayload>;
+ } = {},
+) {
const settings = {
...baseAISettings(),
...clone(overrides.settings ?? {}),
@@ -261,13 +171,7 @@ async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceO
...basePatrolStatus(),
...clone(overrides.patrolStatus ?? {}),
};
- const intelligenceSummary = {
- ...healthyIntelligenceSummary(),
- ...clone(overrides.intelligenceSummary ?? {}),
- };
- const runHistory = baseRunHistory();
const updateRequests: Array<Record<string, unknown>> = [];
- const patrolRunRequests: Array<Record<string, unknown>> = [];
await page.route("**/api/settings/ai", async (route) => {
await route.fulfill({
@@ -278,46 +182,13 @@ async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceO
});
await page.route("**/api/settings/ai/update", async (route) => {
- const body = (route.request().postDataJSON() as Record<string, unknown> | null) ?? {};
+ const body =
+ (route.request().postDataJSON() as Record<string, unknown> | null) ?? {};
updateRequests.push(body);
-
- if (typeof body.enabled === "boolean") {
- settings.enabled = body.enabled;
- settings.patrol_enabled = body.enabled;
- patrolStatus.enabled = body.enabled;
- if (body.enabled && settings.quickstart_credits_available && settings.configured_providers.length === 0) {
- settings.configured = true;
- settings.model = "quickstart:pulse-hosted";
- settings.chat_model = "quickstart:pulse-hosted";
- settings.patrol_model = "quickstart:pulse-hosted";
- settings.using_quickstart = true;
- patrolStatus.runtime_state = "active";
- patrolStatus.using_quickstart = true;
- patrolStatus.blocked_reason = "";
- patrolStatus.blocked_at = "";
- patrolStatus.healthy = true;
- }
- }
-
- if (typeof body.openai_api_key === "string" && body.openai_api_key.trim().length > 0) {
- settings.configured = true;
- settings.model = "openai:gpt-4o";
- settings.chat_model = "";
- settings.patrol_model = "";
- settings.openai_configured = true;
- settings.configured_providers = ["openai"];
- settings.using_quickstart = false;
- patrolStatus.using_quickstart = false;
- patrolStatus.runtime_state = "active";
- patrolStatus.blocked_reason = "";
- patrolStatus.blocked_at = "";
- patrolStatus.healthy = true;
- }
-
await route.fulfill({
- status: 200,
- contentType: "application/json",
- body: JSON.stringify(settings),
+ status: 400,
+ contentType: "text/plain",
+ body: "Please configure a provider (API key or Ollama URL) before enabling Pulse Assistant\n",
});
});
@@ -329,46 +200,11 @@ async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceO
});
});
- await page.route("**/api/ai/patrol/run", async (route) => {
- const body = (route.request().postDataJSON() as Record<string, unknown> | null) ?? {};
- patrolRunRequests.push(body);
-
- if (!patrolStatus.enabled || patrolStatus.runtime_state === "blocked") {
- await route.fulfill({
- status: 403,
- contentType: "application/json",
- body: JSON.stringify({ success: false, message: patrolStatus.blocked_reason }),
- });
- return;
- }
-
- if (patrolStatus.using_quickstart && patrolStatus.quickstart_credits_remaining > 0) {
- patrolStatus.quickstart_credits_remaining -= 1;
- settings.quickstart_credits_remaining = patrolStatus.quickstart_credits_remaining;
- settings.quickstart_credits_used =
- settings.quickstart_credits_total - patrolStatus.quickstart_credits_remaining;
- }
-
- runHistory.unshift({
- ...baseRunHistory()[0],
- id: `run-manual-${patrolRunRequests.length}`,
- started_at: "2026-03-25T09:15:00Z",
- completed_at: "2026-03-25T09:15:36Z",
- trigger_reason: "manual",
- });
-
- await route.fulfill({
- status: 200,
- contentType: "application/json",
- body: JSON.stringify({ success: true, message: "Patrol started" }),
- });
- });
-
await page.route("**/api/ai/patrol/runs*", async (route) => {
await route.fulfill({
status: 200,
contentType: "application/json",
- body: JSON.stringify(runHistory),
+ body: JSON.stringify([]),
});
});
@@ -386,13 +222,10 @@ async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceO
});
await page.route("**/api/ai/models", async (route) => {
- const models = settings.openai_configured
- ? [{ id: "openai:gpt-4o", name: "GPT-4o" }]
- : [];
await route.fulfill({
status: 200,
contentType: "application/json",
- body: JSON.stringify({ models }),
+ body: JSON.stringify({ models: [] }),
});
});
@@ -416,7 +249,35 @@ async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceO
await route.fulfill({
status: 200,
contentType: "application/json",
- body: JSON.stringify(intelligenceSummary),
+ body: JSON.stringify({
+ timestamp: "2026-03-25T09:05:00Z",
+ overall_health: {
+ score: 100,
+ grade: "A",
+ trend: "stable",
+ factors: [],
+ prediction:
+ "Infrastructure is healthy with no significant issues detected.",
+ },
+ findings_count: {
+ critical: 0,
+ warning: 0,
+ watch: 0,
+ info: 0,
+ total: 0,
+ },
+ predictions_count: 0,
+ recent_changes_count: 0,
+ recent_changes: [],
+ learning: {
+ resources_with_knowledge: 0,
+ total_notes: 0,
+ resources_with_baselines: 0,
+ patterns_detected: 0,
+ correlations_learned: 0,
+ incidents_tracked: 0,
+ },
+ }),
});
});
@@ -426,9 +287,9 @@ async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceO
contentType: "application/json",
body: JSON.stringify({
state: "closed",
- can_patrol: patrolStatus.runtime_state !== "blocked",
+ can_patrol: false,
consecutive_failures: 0,
- total_successes: 42,
+ total_successes: 0,
total_failures: 0,
}),
});
@@ -450,169 +311,70 @@ async function mockQuickstartPatrolSurface(page: Page, overrides: PatrolSurfaceO
});
});
- return { settings, patrolStatus, updateRequests, patrolRunRequests };
+ return { settings, patrolStatus, updateRequests };
}
-test.describe("Quickstart cross-surface browser contract", () => {
- test("activated install first AI enable surfaces quickstart-backed Patrol without BYOK", async ({
+test.describe("Retired quickstart browser contract", () => {
+ test("first enable stays on provider setup and does not create quickstart state", async ({
page,
}, testInfo) => {
- test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only quickstart coverage");
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop-only AI settings coverage",
+ );
await ensureAuthenticated(page);
- const surface = await mockQuickstartPatrolSurface(page, {
- settings: {
- enabled: false,
- configured: false,
- model: "",
- chat_model: "",
- patrol_model: "",
- using_quickstart: false,
- },
- patrolStatus: {
- runtime_state: "blocked",
- enabled: false,
- healthy: false,
- using_quickstart: false,
- blocked_reason: "Awaiting AI provider configuration",
- },
- });
+ const surface = await mockRetiredQuickstartSurface(page);
await page.goto("/settings/system-ai", { waitUntil: "domcontentloaded" });
- await expect(page.getByRole("heading", { name: "Assistant & Patrol", level: 1 })).toBeVisible();
-
- const response = await browserApiRequest(page, "/api/settings/ai/update", "PUT", {
- enabled: true,
- });
- expect(response.ok).toBe(true);
- expect(surface.updateRequests).toHaveLength(1);
-
- await page.goto("/ai", { waitUntil: "domcontentloaded" });
- await expect(page.getByText("Patrol enabled")).toBeVisible();
- await expect(page.getByText("Patrol quickstart: 25/25 runs left")).toBeVisible();
- await expect(page.getByRole("button", { name: "Run Patrol" })).toBeEnabled();
- });
-
- test("unactivated Community surfaces activation-or-BYOK messaging instead of quickstart", async ({
- page,
- }, testInfo) => {
- test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only quickstart coverage");
-
- await ensureAuthenticated(page);
- await mockQuickstartPatrolSurface(page, {
- settings: {
- enabled: true,
- configured: false,
- model: "",
- chat_model: "",
- patrol_model: "",
- quickstart_credits_total: 0,
- quickstart_credits_used: 0,
- quickstart_credits_remaining: 0,
- quickstart_credits_available: false,
- using_quickstart: false,
- },
- patrolStatus: {
- runtime_state: "blocked",
+ await expect(
+ page.getByRole("heading", { name: "Assistant & Patrol", level: 1 }),
+ ).toBeVisible();
+
+ await page
+ .getByRole("button", { name: "Enable Assistant and Patrol" })
+ .click();
+ await expect.poll(() => surface.updateRequests.length).toBe(0);
+ await expect(page.getByText("Set Up Assistant & Patrol")).toBeVisible();
+ await expect(
+ page.getByText("Connect a provider to power Pulse Assistant and Patrol."),
+ ).toBeVisible();
+ await expect(page.getByText(/quickstart/i)).toHaveCount(0);
+
+ const response = await browserApiRequest(
+ page,
+ "/api/settings/ai/update",
+ "PUT",
+ {
enabled: true,
- healthy: false,
- using_quickstart: false,
- quickstart_credits_total: 0,
- quickstart_credits_remaining: 0,
- blocked_reason: QUICKSTART_ACTIVATION_REQUIRED_REASON,
- blocked_at: "2026-03-25T09:00:00Z",
- },
- });
-
- await page.goto("/ai", { waitUntil: "domcontentloaded" });
-
- await expect(page.getByText("Patrol paused").first()).toBeVisible();
- await expect(page.getByText(QUICKSTART_ACTIVATION_REQUIRED_REASON).first()).toBeVisible();
- await expect(page.getByRole("button", { name: "Run Patrol" })).toBeDisabled();
- await expect(page.getByText(/Patrol quickstart:/)).toHaveCount(0);
- });
-
- test("successful quickstart Patrol run refreshes the credit badge from server state", async ({
- page,
- }, testInfo) => {
- test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only quickstart coverage");
-
- await ensureAuthenticated(page);
- const surface = await mockQuickstartPatrolSurface(page, {
- settings: {
- quickstart_credits_remaining: 12,
- quickstart_credits_used: 13,
- },
- patrolStatus: {
- quickstart_credits_remaining: 12,
},
- });
-
- await page.goto("/ai", { waitUntil: "domcontentloaded" });
- await expect(page.getByText("Patrol quickstart: 12/25 runs left")).toBeVisible();
-
- const response = await browserApiRequest(page, "/api/ai/patrol/run", "POST", {});
- expect(response.ok).toBe(true);
- expect(surface.patrolRunRequests).toHaveLength(1);
-
- await page.getByRole("button", { name: "Refresh" }).click();
- await expect(page.getByText("Patrol quickstart: 11/25 runs left")).toBeVisible();
- });
-
- test("BYOK override suppresses exhausted quickstart copy once Patrol is no longer using quickstart", async ({
- page,
- }, testInfo) => {
- test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only quickstart coverage");
-
- await ensureAuthenticated(page);
- await mockQuickstartPatrolSurface(page, {
- settings: {
- model: "openai:gpt-4o",
- chat_model: "",
- patrol_model: "",
- openai_configured: true,
- configured_providers: ["openai"],
- using_quickstart: false,
- quickstart_credits_remaining: 0,
- quickstart_credits_used: 25,
- },
- patrolStatus: {
- using_quickstart: false,
- quickstart_credits_remaining: 0,
- healthy: true,
- },
- });
-
- await page.goto("/ai", { waitUntil: "domcontentloaded" });
-
- await expect(page.getByText("Patrol enabled")).toBeVisible();
- await expect(page.getByText("Health A · 100/100")).toBeVisible();
- await expect(page.getByText("Patrol quickstart exhausted")).toHaveCount(0);
- await expect(page.getByText(QUICKSTART_EXHAUSTED_REASON)).toHaveCount(0);
+ );
+ expect(response.ok).toBe(false);
+ expect(response.status).toBe(400);
+ expect(String(response.body).toLowerCase()).not.toContain("quickstart");
+ expect(surface.updateRequests).toHaveLength(1);
});
- test("unreachable quickstart proxy pauses Patrol with accurate offline guidance", async ({
+ test("AI and Patrol surfaces suppress legacy hosted blocked copy", async ({
page,
}, testInfo) => {
- test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only quickstart coverage");
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop-only Patrol coverage",
+ );
await ensureAuthenticated(page);
- await mockQuickstartPatrolSurface(page, {
+ await mockRetiredQuickstartSurface(page, {
settings: {
enabled: true,
- configured: false,
- model: "",
- chat_model: "",
- patrol_model: "",
- using_quickstart: false,
- quickstart_credits_remaining: 25,
- quickstart_credits_used: 0,
+ patrol_enabled: true,
},
patrolStatus: {
runtime_state: "blocked",
+ enabled: true,
healthy: false,
- using_quickstart: false,
- blocked_reason: QUICKSTART_OFFLINE_REASON,
+ blocked_reason:
+ "Quickstart credits exhausted. Connect your API key to continue using Patrol.",
blocked_at: "2026-03-25T09:00:00Z",
},
});
@@ -620,46 +382,16 @@ test.describe("Quickstart cross-surface browser contract", () => {
await page.goto("/ai", { waitUntil: "domcontentloaded" });
await expect(page.getByText("Patrol Paused").first()).toBeVisible();
- await expect(page.getByText("Patrol paused").first()).toBeVisible();
- await expect(page.getByText(QUICKSTART_OFFLINE_REASON).first()).toBeVisible();
- await expect(page.getByRole("button", { name: "Run Patrol" })).toBeDisabled();
- await expect(page.getByText("Patrol quickstart exhausted")).toHaveCount(0);
- await expect(page.getByText("Health A · 100/100")).toHaveCount(0);
- });
-
- test("activated-install first AI enable toggle should not force BYOK setup when quickstart credits are available", async ({
- page,
- }, testInfo) => {
- test.skip(testInfo.project.name.startsWith("mobile-"), "Desktop-only quickstart coverage");
-
- await ensureAuthenticated(page);
- const surface = await mockQuickstartPatrolSurface(page, {
- settings: {
- enabled: false,
- configured: false,
- model: "",
- chat_model: "",
- patrol_model: "",
- using_quickstart: false,
- },
- patrolStatus: {
- runtime_state: "blocked",
- enabled: false,
- healthy: false,
- using_quickstart: false,
- blocked_reason: "Awaiting AI provider configuration",
- },
- });
-
- await page.goto("/settings/system-ai", { waitUntil: "domcontentloaded" });
- await expect(page.getByRole("heading", { name: "Assistant & Patrol", level: 1 })).toBeVisible();
-
- await page.getByRole("button", { name: "Enable Assistant and Patrol" }).click();
-
- await expect.poll(() => surface.updateRequests.length).toBe(1);
- expect(surface.updateRequests[0]).toMatchObject({ enabled: true });
await expect(
- page.getByText("Connect a provider to power Pulse Assistant and Patrol."),
- ).toHaveCount(0);
+ page
+ .getByText(
+ "Connect your own AI provider or local model to use Pulse Patrol.",
+ )
+ .first(),
+ ).toBeVisible();
+ await expect(page.getByText(/Quickstart credits exhausted/i)).toHaveCount(
+ 0,
+ );
+ await expect(page.getByText(/Patrol quickstart/i)).toHaveCount(0);
});
});