Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Let mobile relay tokens reach the Patrol attention routes
rcourtman3c8705da92c9
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex c81b2154f8..9a6651a231 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -2890,6 +2890,13 @@ adjacent setup and install flows may depend on that helper layer, but they mayonly consume the server-owned minting route and the governed compatibilitygates for the mobile runtime endpoints. They must not recreate broaderAI-scoped mobile credentials or invent route-local scope exceptions.+The governed backward-compatible route inventory behind that capability now+includes the Patrol attention read and lifecycle-mutation routes, which+supersede the legacy patrol findings routes the paired device already+consumed. That inventory growth keeps an already-paired phone's credential+working across server upgrades; it does not widen the mobile credential into+general AI chat/execute scope ownership, and lifecycle-adjacent flows must+not read it as license to mint broader-scoped device tokens.That same lifecycle-adjacent setup path now also depends on the hosted relayruntime helper inside `internal/api/`. Hosted Pulse Cloud tenants must notrequire an operator to visit Settings and manually `PUT /api/settings/relay`diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 6f9c5b1725..a2228ca963 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -3482,7 +3482,17 @@ successful targeted check from a queued response alone.`frontend-modern/src/api/patrolAttention.ts` own the typed read transport for`GET /api/ai/patrol/attention`,`GET /api/ai/patrol/attention/summary`, and-`GET /api/ai/patrol/attention/{id}`. All routes require `monitoring:read`.+`GET /api/ai/patrol/attention/{id}`. Read routes require `monitoring:read`,+and — because the attention workbench supersedes the legacy patrol findings+routes that mobile devices already used — they equally accept the+backend-owned `relay:mobile:access` capability and the legacy `ai:execute`+scope through the governed relay mobile runtime route inventory in+`internal/api/relay_mobile_capability.go`. Attention lifecycle mutations+(`POST /api/ai/patrol/attention/{id}/{mutation}`) require `monitoring:write`+under the same inventory-mapped acceptance. Token scope acceptance must not+drift back to a single-scope gate: a registered phone carries only+`relay:mobile:access`, so a `monitoring:read`-only gate silently severs+mobile alert sync on upgrade (v6.1.0-rc.4 regression).Lists use bounded pagination with a maximum of 200 records and one boundedprotection-posture batch. The summary path does not read recovery history.diff --git a/docs/release-control/v6/internal/subsystems/relay-runtime.md b/docs/release-control/v6/internal/subsystems/relay-runtime.mdindex 8bb1e0c5d0..cf29372217 100644--- a/docs/release-control/v6/internal/subsystems/relay-runtime.md+++ b/docs/release-control/v6/internal/subsystems/relay-runtime.md@@ -136,6 +136,19 @@ inventory: `PATCH /api/ai/sessions/{session_id}` may pass throughbrowser-safe session title projection. The relay inventory must not widen thatroute into transcript, provider-context, approval, action-execution, or rawtool-evidence mutation authority.+The Patrol attention workbench routes are part of that same explicit+inventory: `GET /api/ai/patrol/attention`, `GET+/api/ai/patrol/attention/{item_id}`, and `POST+/api/ai/patrol/attention/{item_id}/{mutation}` supersede the legacy patrol+findings/acknowledge routes that mobile devices already consumed, so they map+`relay:mobile:access` alongside `monitoring:read` (reads) and+`monitoring:write` (lifecycle mutations), with `ai:execute` as the enumerated+legacy compatibility scope. Gating any attention route on a single+non-mobile scope severs registered phones' alert sync on server upgrade+(v6.1.0-rc.4 regression) and is a forbidden regression, not a hardening+opportunity. This grants no new mutation authority: attention mutations stay+inside the alert lifecycle acknowledge/suppress surface the legacy routes+already exposed to the mobile credential.The route that mints that dedicated credential is also part of the paid Relayboundary. `POST /api/security/tokens/relay-mobile` lives in the sharedauth/security router, but it must require the paid `relay` entitlement beforediff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex f8abe3c11c..b760cd454d 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -154,6 +154,16 @@ must not be reinterpreted as backup freshness, protection coverage, restorereadiness, or verification truth; those claims continue to require theirdomain-owned typed evidence and deterministic verification paths.+The Patrol attention routes' mobile relay scope acceptance in+`internal/api/relay_mobile_capability.go` and the attention route gates in+`internal/api/router_routes_ai_relay.go` / `internal/api/attention_mutations.go`+are an API auth-surface mapping, not a storage or recovery grant. A+`relay:mobile:access` credential reading attention items — including their+protection-posture presentation fields — gains no backup, restore, snapshot,+or recovery-export authority, and attention lifecycle mutations stay inside+the alert acknowledge/suppress surface; storage and recovery mutations keep+their own governed routes and verification paths.+Unified Agent durable-operation-receipt metadata is likewise an internalmonitoring and agent-lifecycle boundary. The exact current protocol may be afail-closed prerequisite when unified resources derive the boundeddiff --git a/internal/api/attention_mutations.go b/internal/api/attention_mutations.goindex 2f8353e1e9..ced57c2e5c 100644--- a/internal/api/attention_mutations.go+++ b/internal/api/attention_mutations.go@@ -7,7 +7,6 @@ import ("strings""time"- "github.com/rcourtman/pulse-go-rewrite/internal/config""github.com/rcourtman/pulse-go-rewrite/internal/utils""github.com/rcourtman/pulse-go-rewrite/pkg/auth")@@ -62,7 +61,7 @@ func (h *AttentionHandlers) handleAttentionMutation(r *http.Request,path string,) {- if !ensureScope(w, r, config.ScopeMonitoringWrite) {+ if !ensureRelayMobileRuntimeRoute(w, r, relayMobileRouteAttentionMutation) {return}itemID, kind, ok := parseAttentionMutationPath(path)diff --git a/internal/api/attention_relay_mobile_scope_test.go b/internal/api/attention_relay_mobile_scope_test.gonew file mode 100644index 0000000000..7c13df5872--- /dev/null+++ b/internal/api/attention_relay_mobile_scope_test.go@@ -0,0 +1,94 @@+package api++import (+ "net/http"+ "net/http/httptest"+ "strings"+ "testing"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+)++// Regression: v6.1.0-rc.4 shipped the attention workbench gated on+// monitoring:read only, so every mobile relay token (which carries just+// relay:mobile-access) got 403 on alert sync the moment a server upgraded+// (Strasser report, 2026-07-22). The attention routes supersede the legacy+// patrol findings routes and must accept the same mobile relay capability.+func TestAttentionRoutes_AcceptRelayMobileAccessScope(t *testing.T) {+ rawToken := "attention-relay-mobile-scope.12345678"+ record := newTokenRecord(t, rawToken, []string{config.ScopeRelayMobileAccess}, nil)+ cfg := newTestConfigWithTokens(t, record)+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")++ paths := []struct {+ method string+ path string+ }{+ {http.MethodGet, "/api/ai/patrol/attention?filter=all&page=1&limit=20"},+ {http.MethodGet, "/api/ai/patrol/attention/item-1"},+ {http.MethodPost, "/api/ai/patrol/attention/item-1/acknowledge"},+ }++ for _, tc := range paths {+ var req *http.Request+ if tc.method == http.MethodPost {+ req = httptest.NewRequest(tc.method, tc.path, strings.NewReader(`{}`))+ } else {+ req = httptest.NewRequest(tc.method, tc.path, nil)+ }+ req.Header.Set("X-API-Token", rawToken)+ rec := httptest.NewRecorder()+ router.Handler().ServeHTTP(rec, req)+ // With no monitor wired the handler reports the read model as+ // unavailable; the point is that the scope gate no longer rejects+ // the mobile relay token.+ if rec.Code == http.StatusForbidden || rec.Code == http.StatusUnauthorized {+ t.Errorf("%s %s: mobile relay token rejected with %d: %s", tc.method, tc.path, rec.Code, rec.Body.String())+ }+ }+}++func TestAttentionRoutes_AcceptLegacyAIExecuteScope(t *testing.T) {+ rawToken := "attention-legacy-ai-execute.12345678"+ record := newTokenRecord(t, rawToken, []string{config.ScopeAIExecute}, nil)+ cfg := newTestConfigWithTokens(t, record)+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")++ req := httptest.NewRequest(http.MethodGet, "/api/ai/patrol/attention", nil)+ req.Header.Set("X-API-Token", rawToken)+ rec := httptest.NewRecorder()+ router.Handler().ServeHTTP(rec, req)+ if rec.Code == http.StatusForbidden || rec.Code == http.StatusUnauthorized {+ t.Fatalf("ai:execute token rejected with %d: %s", rec.Code, rec.Body.String())+ }+}++func TestAttentionRoutes_RejectUnrelatedScope(t *testing.T) {+ rawToken := "attention-unrelated-scope.12345678"+ record := newTokenRecord(t, rawToken, []string{config.ScopeAIChat}, nil)+ cfg := newTestConfigWithTokens(t, record)+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")++ paths := []struct {+ method string+ path string+ }{+ {http.MethodGet, "/api/ai/patrol/attention"},+ {http.MethodPost, "/api/ai/patrol/attention/item-1/acknowledge"},+ }++ for _, tc := range paths {+ var req *http.Request+ if tc.method == http.MethodPost {+ req = httptest.NewRequest(tc.method, tc.path, strings.NewReader(`{}`))+ } else {+ req = httptest.NewRequest(tc.method, tc.path, nil)+ }+ req.Header.Set("X-API-Token", rawToken)+ rec := httptest.NewRecorder()+ router.Handler().ServeHTTP(rec, req)+ if rec.Code != http.StatusForbidden {+ t.Errorf("%s %s: expected 403 for unrelated scope, got %d: %s", tc.method, tc.path, rec.Code, rec.Body.String())+ }+ }+}diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 46a70e60b0..0e11f8d397 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -277,6 +277,50 @@ func TestContract_UnifiedSeedSourcesIncludesPluralAvailabilityFacets(t *testing.}}+func TestContract_PatrolAttentionRoutesAcceptMobileRelayCapability(t *testing.T) {+ // The attention workbench supersedes the legacy patrol findings routes+ // that registered phones already consumed, so its routes must stay in+ // the governed relay mobile runtime inventory. Gating them on a single+ // non-mobile scope severs mobile alert sync on server upgrade+ // (v6.1.0-rc.4 regression).+ want := map[relayMobileRuntimeRouteID][]string{+ relayMobileRouteAttentionList: {+ config.ScopeRelayMobileAccess,+ config.ScopeMonitoringRead,+ config.ScopeAIExecute,+ },+ relayMobileRouteAttentionDetail: {+ config.ScopeRelayMobileAccess,+ config.ScopeMonitoringRead,+ config.ScopeAIExecute,+ },+ relayMobileRouteAttentionMutation: {+ config.ScopeRelayMobileAccess,+ config.ScopeMonitoringWrite,+ config.ScopeAIExecute,+ },+ }+ for routeID, wantScopes := range want {+ got := relayMobileRuntimeRouteSpecFor(routeID).compatibleScopes()+ if !reflect.DeepEqual(got, wantScopes) {+ t.Errorf("attention route %q compatible scopes = %v, want %v", routeID, got, wantScopes)+ }+ }++ rawToken := "contract-attention-mobile.12345678"+ record := newTokenRecord(t, rawToken, []string{config.ScopeRelayMobileAccess}, nil)+ cfg := newTestConfigWithTokens(t, record)+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")++ req := httptest.NewRequest(http.MethodGet, "/api/ai/patrol/attention?filter=all&page=1&limit=20", nil)+ req.Header.Set("X-API-Token", rawToken)+ rec := httptest.NewRecorder()+ router.Handler().ServeHTTP(rec, req)+ if rec.Code == http.StatusForbidden || rec.Code == http.StatusUnauthorized {+ t.Fatalf("mobile relay token rejected on attention list with %d: %s", rec.Code, rec.Body.String())+ }+}+func TestContract_AlertDeliveryDiagnosisRouteIsReadOnlyMonitoringRead(t *testing.T) {source, err := os.ReadFile("alerts.go")if err != nil {diff --git a/internal/api/relay_mobile_capability.go b/internal/api/relay_mobile_capability.goindex 10f5cfbc86..18f8ec7ba2 100644--- a/internal/api/relay_mobile_capability.go+++ b/internal/api/relay_mobile_capability.go@@ -42,6 +42,9 @@ const (relayMobileRouteSessionAbort relayMobileRuntimeRouteID = "session-abort"relayMobileRouteSessionRename relayMobileRuntimeRouteID = "session-rename"relayMobileRouteSessionDelete relayMobileRuntimeRouteID = "session-delete"+ relayMobileRouteAttentionList relayMobileRuntimeRouteID = "attention-list"+ relayMobileRouteAttentionDetail relayMobileRuntimeRouteID = "attention-detail"+ relayMobileRouteAttentionMutation relayMobileRuntimeRouteID = "attention-mutation")var relayMobileRuntimeRouteOrder = []relayMobileRuntimeRouteID{@@ -69,6 +72,9 @@ var relayMobileRuntimeRouteOrder = []relayMobileRuntimeRouteID{relayMobileRouteSessionAbort,relayMobileRouteSessionRename,relayMobileRouteSessionDelete,+ relayMobileRouteAttentionList,+ relayMobileRouteAttentionDetail,+ relayMobileRouteAttentionMutation,}var relayMobileRuntimeRouteSpecs = map[relayMobileRuntimeRouteID]relayMobileRuntimeRouteSpec{@@ -221,6 +227,30 @@ var relayMobileRuntimeRouteSpecs = map[relayMobileRuntimeRouteID]relayMobileRuntpath: "/api/ai/sessions/{session_id}",requiredScope: config.ScopeAIChat,},+ // The attention workbench supersedes the legacy patrol findings routes,+ // which accepted mobile relay tokens; its routes must keep doing so or+ // every registered phone loses alert sync the moment a server upgrades.+ relayMobileRouteAttentionList: {+ id: relayMobileRouteAttentionList,+ method: http.MethodGet,+ path: "/api/ai/patrol/attention",+ requiredScope: config.ScopeMonitoringRead,+ legacyScope: config.ScopeAIExecute,+ },+ relayMobileRouteAttentionDetail: {+ id: relayMobileRouteAttentionDetail,+ method: http.MethodGet,+ path: "/api/ai/patrol/attention/{item_id}",+ requiredScope: config.ScopeMonitoringRead,+ legacyScope: config.ScopeAIExecute,+ },+ relayMobileRouteAttentionMutation: {+ id: relayMobileRouteAttentionMutation,+ method: http.MethodPost,+ path: "/api/ai/patrol/attention/{item_id}/{mutation}",+ requiredScope: config.ScopeMonitoringWrite,+ legacyScope: config.ScopeAIExecute,+ },}func relayMobileRuntimeRouteInventory() []relayMobileRuntimeRouteSpec {diff --git a/internal/api/relay_mobile_capability_test.go b/internal/api/relay_mobile_capability_test.goindex 39b52d6fc0..b32a253406 100644--- a/internal/api/relay_mobile_capability_test.go+++ b/internal/api/relay_mobile_capability_test.go@@ -70,6 +70,9 @@ func TestRelayMobileRuntimeRouteInventory(t *testing.T) {"POST /api/ai/sessions/{session_id}/abort => ai:chat","PATCH /api/ai/sessions/{session_id} => ai:chat","DELETE /api/ai/sessions/{session_id} => ai:chat",+ "GET /api/ai/patrol/attention => monitoring:read",+ "GET /api/ai/patrol/attention/{item_id} => monitoring:read",+ "POST /api/ai/patrol/attention/{item_id}/{mutation} => monitoring:write",}if !reflect.DeepEqual(got, want) {diff --git a/internal/api/router_routes_ai_relay.go b/internal/api/router_routes_ai_relay.goindex e8f87cdbdb..6e3b085abf 100644--- a/internal/api/router_routes_ai_relay.go+++ b/internal/api/router_routes_ai_relay.go@@ -112,8 +112,8 @@ func (r *Router) registerAIRelayRoutesGroup() {r.mux.HandleFunc("/api/ai/patrol/status", RequireAuth(r.config, RequireScope(config.ScopeAIExecute, r.aiSettingsHandler.HandleGetPatrolStatus)))r.mux.HandleFunc("/api/ai/patrol/stream", RequireAuth(r.config, RequireScope(config.ScopeAIExecute, r.aiSettingsHandler.HandlePatrolStream)))r.mux.HandleFunc("/api/ai/patrol/findings", RequireAuth(r.config, r.routeAIPatrolFindings))- r.mux.HandleFunc("/api/ai/patrol/attention", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.attentionHandlers.HandleAttention)))- r.mux.HandleFunc("/api/ai/patrol/attention/", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.attentionHandlers.HandleAttention)))+ r.mux.HandleFunc("/api/ai/patrol/attention", RequireAuth(r.config, requireRelayMobileRuntimeRoute(relayMobileRouteAttentionList, r.attentionHandlers.HandleAttention)))+ r.mux.HandleFunc("/api/ai/patrol/attention/", RequireAuth(r.config, requireRelayMobileRuntimeRoute(relayMobileRouteAttentionDetail, r.attentionHandlers.HandleAttention)))// SECURITY: AI Patrol read endpoints - require ai:execute scoper.mux.HandleFunc("/api/ai/patrol/history", RequireAuth(r.config, RequireScope(config.ScopeAIExecute, r.aiSettingsHandler.HandleGetFindingsHistory)))r.mux.HandleFunc("/api/ai/patrol/run", RequireAdmin(r.config, RequireScope(config.ScopeAIExecute, r.aiSettingsHandler.HandleForcePatrol)))