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.

Merge main into feat/patrol-typed-conclusions

rcourtman85fb199ff54d
diff --cc docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 267021b175,8351ee4883..045699ff64
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@@ -10166,12 -10166,12 +10166,22 @@@ facts as a `DetailSectionTable`; the co
in a closed Details disclosure. No diagnosis, repair or credential flow
changes: this is presentation only.
+ The agent profiles settings panel reads AI availability from
+ `frontend-modern/src/stores/aiAvailability.ts` since 2026-10-22, when the
+ browser Assistant chat window and its store were retired.
+ `useAgentProfilesPanelState.ts` still gates only its AI-backed profile
+ suggestions on that session fact; agent enrolment, profile assignment, and
+ lifecycle behaviour are unchanged. The same change adds the read-only
+ `settingsCapabilities.patrolRun` security-status field in
+ `internal/api/security_status_capabilities.go`, a projection of the Patrol run
+ route's admin gate; it opens no agent enrolment, command, or lifecycle path.
++
+The Patrol investigation wiring in `internal/api/ai_handlers.go` now passes the
+typed conclusion an investigation records with `patrol_conclude_investigation`
+to the private orchestrator. It also seeds the orchestrator's concurrency and
+timeout from the Patrol provider: one investigation at a time and a 25-minute
+default on a subscription agent. The digest email names the new `unclassified`
+and `interrupted` outcomes. None of this enrols, commands, updates or removes an
+agent, or touches agent identity or credentials. Investigations still reach
+hosts only through the existing read-only evidence tools and the governed
+action lifecycle.
diff --cc docs/release-control/v6/internal/subsystems/ai-runtime.md
index 05931e26bd,84fc6ffc3a..1c5d9f5bf3
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@@ -9059,108 -7406,18 +7406,124 @@@ read-only. Proof: `TestExecutionIntent_
`TestExecutionIntent_RouteOperationBoundary` in
`internal/ai/tools/tools_query_readonly_test.go`.
+ The browser Assistant chat window was retired on 2026-10-22. Operators who
+ want to talk to their infrastructure use Claude Code, Codex, and other MCP
+ clients, which reach the same governed tools through Pulse MCP, so the drawer,
+ its launcher and command-palette entries, and every "Open in Assistant" or
+ "Discuss" hand-off left the web app. Alert Investigate now starts a targeted Patrol run
+ (`POST /api/ai/patrol/run` with the alert's resource and identifier), is offered
+ only to sessions whose `settingsCapabilities.patrolRun` says that admin route
+ accepts them, and its findings land on the Patrol page. The External agents settings page moved to
+ `/settings/pulse-intelligence/agents`; `/settings/pulse-intelligence/assistant`
+ and its `?tab=` aliases redirect there with the hash preserved. The chat
+ service in `internal/ai/chat` stays: Patrol investigations run on it and Pulse
+ Mobile chat uses it until 31 March 2027, so `/api/ai/chat`, the session
+ endpoints, and the stream contract keep their rules in this contract.
+ `frontend-modern/src/stores/aiAvailability.ts` replaced the chat store as the
+ owner of the shell's AI-enabled fact.
++
+### Typed investigation conclusions and subscription-aware investigation limits (22 October 2026)
+
+Patrol investigations record their zero-action conclusion through
+`patrol_conclude_investigation`, an investigation-only, side-effect-free,
+read-kind, mutation-none tool on the request-local `ProposalCapture`. The model
+supplies one of `resolved`, `cannot_fix` or `needs_attention` and a reason.
+The capture keeps the first conclusion: an identical replay is accepted and a
+different outcome is refused. `InvestigationRunResult.Conclusion` carries it to
+the orchestrator beside any proposal. A typed proposal still owns remediation
+and outranks a conclusion, and the conclusion consumes no evidence budget.
+Once a conclusion is recorded, the next turn is text-only: the summary.
+The final turn, whether reached by the turn limit or by the deadline reserve,
+offers only the tools that end a run: the conclusion, plus the typed proposal
+once the evidence budget is spent. Evidence exhaustion offers the proposal and
+the conclusion.
+
+A run reserves time to conclude before its context deadline. The reserve is
+one more evidence turn plus the conclusion and summary turns, each estimated as
+the slowest turn so far (20 s minimum), plus 15 s, capped at half the run's
+budget. When the time left reaches the reserve, the current turn becomes the
+final turn. The final summary call may use the time left before that deadline
+instead of the 20 s interactive bound, which interactive chat keeps.
+
+On subscription agents, a positive `StreamIdleTimeout` remains an earlier
+complete-turn deadline, because the transport buffers the whole turn.
+Investigation turns there get a four-minute caller-owned stall budget, while
+Watch keeps 60 s. Without an explicit setting, an investigation on a
+subscription agent defaults to 25 minutes and to one investigation at a time,
+because that transport serves one call at a time.
+
+`LoadConfig` and autonomy saves republish the timeout and, through the optional
+`aicontracts.InvestigationConcurrencyLimitUpdater`, the concurrency limit, so a
+provider change applies without rebuilding the orchestrator. Both read the
+orchestrator before taking the service lock, because `PatrolService` takes its
+own lock before the service lock. Patrol's outer deadline for an automatic
+investigation follows the effective timeout plus a 5-minute grace instead of a
+fixed 10 minutes.
+
+The stuck-run sweep looks up the session of the run each running finding names
+among every session the orchestrator's store holds for the finding, so a newer
+session cannot hide a live run. Without the store it uses the finding's latest
+session, and leaves the finding alone when a different run is the latest. A
+live run is reset as
+`timed_out` only after its own `InvestigationSession.Deadline` plus that
+grace, or its start plus the current timeout and grace when no deadline is
+recorded. So a timeout lowered mid-run does not cut it short, and the previous
+run's `LastInvestigatedAt` no longer resets a live re-investigation. A run the
+orchestrator holds no session for, or closed as `interrupted` when it reloaded
+after a restart, is recorded as `interrupted`. Such a run keeps its attempt, so
+a run that crashes Pulse cannot retry forever. A run the orchestrator closed
+without updating the finding takes the result its session recorded, once the
+orchestrator's own update has had the grace to land, or `timed_out` when the
+session recorded none. Without an orchestrator the sweep keeps the
+`LastInvestigatedAt` rule. A first investigation cut short by a hard restart no
+longer stays running for good. `FindingsStore.RecoverStuckInvestigation`
+applies the recovery only while the finding still shows that run as running,
+so a result or a newer run that landed after the sweep looked is kept. A run
+that started before the finding's current occurrence is recorded only as
+`interrupted`, never with its session's result. An outcome the action
+lifecycle recorded on the finding during the run, such as
+`fix_queued`, is kept and the run completes, so a queued fix still blocks
+another investigation. The close stamps `LastInvestigatedAt` like any other
+closed run.
+
+Two outcomes join the vocabulary. `unclassified` records a completed run that
+left neither a typed conclusion nor a recognisable marker. The private
+orchestrator no longer defaults that case to `needs_attention`, which ends
+investigation of the finding. `unclassified` keeps the normal cooldown and
+attempt limit, presents as needs-attention in the loop state, and lands in the
+telemetry `other` bucket with no schema change. `interrupted` records a run
+cut short by a restart, shutdown or caller cancellation. It is not
+`timed_out`, has no cooldown, and reports as `in_progress`. A run cancelled by
+shutdown spends no attempt.
+
+A typed conclusion recorded before a later provider failure or summary timeout
+stands when the run holds no proposal or action. A failure without one remains
+failed, and fallback prose is still never classified as a conclusion. The
+prose-marker reader remains a fallback. It accepts only line-start markers
+inside the conclusion section. It ignores fenced and indented-code lines,
+reading any fence-like line as a fence and ending it only where every
+CommonMark reading would, and it treats a quote as running to the next blank
+line. Where that differs from CommonMark it hides more, which can only leave
+a run unclassified. It now tolerates markdown emphasis, list markers,
+numbering, case and heading punctuation.
+
+Proofs:
+- `agentic_investigation_conclusion_test.go`: final-turn tools, the summary
+ after a conclusion, the deadline reserve, and the reserve, summary-timeout
+ and subscription turn-budget helpers.
+- `tools_conclude_test.go`: the closed vocabulary, first conclusion wins,
+ profile and capture gating, and refusals.
+- `findings_test.go`: `interrupted` and `unclassified` eligibility.
+- `patrol_investigation_limits_test.go`: the sweep (live runs held to their
+ own deadline, a live or pending run behind a newer session, restart
+ reconciliation, the settle window, session results, kept action outcomes,
+ a result from before a regression, the guarded recovery write and the
+ no-orchestrator rule) and the run ceiling.
+- `service_patrol_limits_test.go`: provider-aware limits on reload.
+- `ai_config_test.go`, `contracts_test.go` (including the session `deadline`
+ wire shape), `patrol_cost_test.go` and the orchestrator-setup case in
+ `ai_handlers_investigation_additional_test.go`.
+
+This changes outcome recording and run limits only. It widens no mutation,
+approval or execution boundary, and it is not measured improvement on
+installed systems.
diff --cc docs/release-control/v6/internal/subsystems/api-contracts.md
index 6fd8b32499,4125834ff4..1567cc8f6f
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@@ -12587,24 -12475,32 +12475,54 @@@ Routes, caller scope/token filtering, c
HTTP statuses, private-body controls, same-credential fixture recovery and wire
attribution. They are not installed permission or guest-recovery acceptance.
+ The browser Assistant chat window was retired on 2026-10-22. Its frontend
+ client (`frontend-modern/src/api/aiChat.ts`), the dev stream fixture, and the
+ generated TypeScript chat event projection left with it; `scripts/generate-types.go`
+ no longer emits chat stream types. `/api/ai/chat`, the session endpoints, and
+ the chat stream payloads keep their contracts because Patrol investigations
+ and Pulse Mobile chat still use them, pinned server-side by
+ `internal/api/contract_test.go`. The alert Investigate action now calls
+ `POST /api/ai/patrol/run` with `resource_ids`, `alert_identifier`, and
+ `alert_type`, and the External agents settings route is
+ `/settings/pulse-intelligence/agents`.
+
+ `/api/security/status` `settingsCapabilities` gained `patrolRun` on 2026-10-22.
+ `securityStatusCanRunPatrol` answers that route's RequireAdmin + `ai:execute`
+ gate from the security status snapshot, like the other admin capabilities, so
+ it validates no token and has no side effect. Where `ensureAdminSession`
+ differs from `canAccessAdminSurface` it follows the route: an instance
+ administrator on an org-scoped session is admitted, an organization-bound
+ token is refused whatever its scopes, and a session cookie beside a token must
+ belong to an instance administrator. The snapshot's remaining gaps
+ (recovery-session binding, proxy-over-token precedence, Bearer-only tokens,
+ the dev bypass beside an explicit token) are shared with every settings
+ capability. The browser offers alert Investigate only where the field is true. Auth-free installs report no capability
+ set and the frontend treats them as allowed, as it already does for update
+ status. `TestContract_SecurityStatusPatrolRunTracksRunRouteGate` keeps the
+ field and the route in agreement, including a non-admin cookie beside a token;
+ `TestSecurityStatusPatrolRunRefusesOrgBoundToken` and
+ `TestSecurityStatusPatrolRunFollowsInstanceAdminOnOrgScopedSession` compare it
+ with `ensureAdminSession` directly, and the capability enforcement tests list it
+ with the other admin-only fields.
++
+### Typed investigation conclusion tool (22 October 2026)
+
+`patrol_conclude_investigation` joins `patrol_propose_action` and
+`patrol_action_capabilities` as an investigation-only tool whose canonical name
+and descriptor live in `internal/agentcapabilities/`. It is statically
+read-kind and mutation-none, projected into the investigation scope surface,
+rejected by registry policy outside the investigation profile, and unavailable
+without the request-local capture. The model supplies only `outcome`
+(`resolved`, `cannot_fix` or `needs_attention`) and `reason`. The tool records
+the run's conclusion for the private orchestrator, which persists the outcome;
+it creates no proposal and grants no plan, approval or execution authority.
+The Pulse–enterprise boundary stays additive:
+`aicontracts.OrchestratorInvestigationResult.Conclusion`,
+`aicontracts.InvestigationConclusion`, the `unclassified` and `interrupted`
+outcome constants and the optional `InvestigationConcurrencyLimitUpdater` are
+new. `aicontracts.InvestigationSession.Deadline` (`deadline`, omitted when
+unrecorded) carries when a run's own timeout expires, so investigation session
+payloads gain one optional field. An older orchestrator ignores the conclusion
+and keeps reading prose markers, and records no deadline, so core measures its
+runs from their start. Proofs: `patrol_scope_tools_test.go`, `names_test.go`,
+`tools_conclude_test.go` and `contracts_test.go`.
diff --cc docs/release-control/v6/internal/subsystems/storage-recovery.md
index 1c75958192,6168327653..1b49b14167
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@@ -7159,9 -7159,11 +7159,18 @@@ nodes) now renders through the shared `
Docker and vSphere overviews also use; its Storage, Replication, Backups, Ceph
and Mail Gateway tabs, and every storage and recovery rule, are unchanged.
+ The Pulse Intelligence external-agent setup anchor named in Forbidden Path 10
+ moved to `/settings/pulse-intelligence/agents#external-agent-setup` on
+ 2026-10-22, when the browser Assistant chat window was retired. It is still
+ adjacent settings route state in `frontend-modern/src/routing/resourceLinks.ts`
+ and carries no recovery or storage meaning. The same change adds the read-only
+ `settingsCapabilities.patrolRun` security-status field in `internal/api`, a
+ projection of the Patrol run route's admin gate that opens no storage or
+ recovery path.
++
+The `internal/api` changes for typed Patrol investigation conclusions open no
+storage, backup or recovery path. They hand the run's typed conclusion to the
+private orchestrator, make investigation concurrency and timeout follow the
+Patrol provider, and label the `unclassified` and `interrupted` outcomes in the
+digest email. Recovery evidence, restore rules and storage capabilities are
+unchanged, and Patrol gains no storage remediation capability.