Align Patrol, Operational Trust, and Unified Resources Help docs (#5451)

**Align Patrol, Operational Trust, and Unified Resources Help docs**

Fix runtime drift across four shipped Help guides and their mirrored
copies under
frontend-modern/public/docs/:

- docs/AI_AUTONOMY.md: document that local subscription agent CLIs
(codex-subscription, claude-subscription) run 1 investigation at a time
  rather than 3 in parallel (GetPatrolInvestigationConcurrency() in
internal/config/ai.go), document the 64-finding critical-first in-memory
deferred queue (maxDeferredInvestigations), and document the
human-session
  Autopilot acknowledgement API endpoints
  (POST /api/ai/patrol/autonomy/acknowledgements and
  DELETE /api/ai/patrol/autonomy/acknowledgements/{id}).
- docs/PATROL_ARCHITECTURE.md: document investigation concurrency limits
and
  the in-memory critical-first deferred queue
  (internal/ai/patrol_investigation_queue.go).
- docs/OPERATIONAL_TRUST.md: list all ten registered
pulse_operational_trust_*
  Prometheus metrics and their bounded label vocabularies from
  internal/operationaltrust/metrics.go, including partial_permission on
evidence observations, and reference full metric names in alert
examples.
- docs/UNIFIED_RESOURCES.md: replace the contradictory "upgrading from
platform-specific navigation" description for MIGRATION_UNIFIED_NAV.md
with
  its retired historical context matching docs/README.md.

Extend source-bound regression tests in
scripts/tests/test_authentication_diagnostic_docs.py,
scripts/tests/test_production_rollout_docs.py, and
scripts/tests/test_navigation_help_docs.py.

Contract-Neutral: Shipped Help documentation alignment and source-bound
docs unit tests only; no runtime UI, backend API, schema, auth, or
subsystem contract delta.

**Remove semicolons and em dash from updated Help docs prose**

Replace semicolons in docs/AI_AUTONOMY.md and docs/OPERATIONAL_TRUST.md
and
the em dash in docs/UNIFIED_RESOURCES.md (plus their shipped mirrors
under
frontend-modern/public/docs/) to satisfy scripts/check_public_docs.py
diff-mode prose rules.

Contract-Neutral: Punctuation-only cleanup in shipped Help
documentation; no runtime UI, backend API, schema, auth, or subsystem
contract delta.

**Fix evidence metric other label placement in Operational Trust Help**

In internal/operationaltrust/metrics.go, operationalEvidenceMetricState
only emits the seven explicit evidence states and never returns other,
while operationalMetricSource uses boundedMetricLabel and falls back to
other. Move other from state to source in docs/OPERATIONAL_TRUST.md and
its shipped mirror.

Contract-Neutral: Shipped Help documentation accuracy fix only; no
runtime UI, backend API, schema, auth, or subsystem contract delta.

---
Fleet candidate `20261128T222013Z-product-intelligence` from the
`product-intelligence` lane. Reviewed tip
`bc408415ab04658467709d410978bc19368f62e0` on `main`.

[How Pulse handles
triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)
This commit is contained in:
pulse-triage[bot]
2026-11-28 22:58:20 +00:00
committed by GitHub
11 changed files with 119 additions and 24 deletions

View File

@@ -74,6 +74,8 @@ pulse_api PUT /api/ai/patrol/autonomy <<'JSON'
JSON
```
Activating **Autopilot** (`"autonomy_level": "full"`) via `PUT /api/ai/patrol/autonomy` also requires an active `acknowledgement_id` created in the same authenticated human session via `POST /api/ai/patrol/autonomy/acknowledgements` (and revocable via `DELETE /api/ai/patrol/autonomy/acknowledgements/{id}`). Both acknowledgement endpoints require administrator access, `settings:write`, and a human browser session rather than an API token.
The helper's loopback origin is for requests made on the Pulse host. For remote
use, change the origin and protocol restriction **in the helper** as the API
guide describes, using your Pulse **HTTPS** URL with certificate verification
@@ -162,7 +164,7 @@ When Patrol mode is `approval`, `assisted`, or `full`, Patrol investigates findi
| `patrol_investigation_budget` | `investigation_budget` | 10 | 5-30 | Maximum evidence-tool calls per investigation. Patrol derives a separate model-response safety ceiling. |
| `patrol_investigation_timeout_sec` | `investigation_timeout_sec` | 600 (1500 for subscription CLIs) | 60-1800 | Maximum seconds per investigation. Subscription agent CLIs (`codex-subscription`, `claude-subscription`) default to 1500 seconds (25 minutes) when unset. |
The following limits are fixed in the runtime and cannot be changed: up to 3 investigations run in parallel (up to 64 additional findings can wait in memory for a free slot, prioritised critical-first), up to 3 attempts per finding, a 1 hour default cooldown between investigation attempts, a 20 minute cooldown after a failed fix or failed fix verification, and a 10 minute cooldown after a timed-out outcome. Runs that fail before producing a conclusion, are interrupted by a restart, or end with unknown fix verification carry no extra cooldown and wait for the next scheduled Patrol cycle.
The following limits are fixed in the runtime and cannot be changed: up to 3 investigations run in parallel on metered API providers, local subscription agent CLIs (`codex-subscription`, `claude-subscription`) run 1 investigation at a time because each CLI serves one call at a time (`GetPatrolInvestigationConcurrency()`), and up to 64 additional findings can wait in memory for a free slot, prioritised critical-first then longest waiting (`maxDeferredInvestigations`, cleared on restart). Patrol also enforces up to 3 attempts per finding, a 1 hour default cooldown between investigation attempts, a 20 minute cooldown after a failed fix or failed fix verification, and a 10 minute cooldown after a timed-out outcome. Runs that fail before producing a conclusion, are interrupted by a restart, or end with unknown fix verification carry no extra cooldown and wait for the next scheduled Patrol cycle.
Background Patrol action plans, including refreshed Patrol plans, stay open for approval for 24 hours before expiring, matching investigation retention. Direct API and interactive action plans keep the 5-minute default expiry. Live freshness, policy, and emergency-stop checks still run when an approved plan executes.

View File

@@ -159,18 +159,31 @@ segments.
## Metrics
The `/metrics` listener exposes Operational Trust counters and histograms under
`pulse_operational_trust_*`. Labels use closed, low-cardinality vocabularies;
resource IDs, evidence IDs, provider-instance names, actors, and destination
IDs never appear as labels.
The `/metrics` listener exposes ten Operational Trust counters and histograms
under `pulse_operational_trust_*` (`internal/operationaltrust/metrics.go`).
Labels use closed, low-cardinality vocabularies. Resource IDs, evidence IDs,
provider-instance names, actors, and destination IDs never appear as labels:
| Metric | Type | Labels / bounded values |
| :--- | :--- | :--- |
| `pulse_operational_trust_observation_to_open_seconds` | Histogram | None (elapsed seconds from first observation to open record) |
| `pulse_operational_trust_open_to_notification_enqueue_seconds` | Histogram | None (elapsed seconds from open transition to notification enqueue) |
| `pulse_operational_trust_evidence_observations_total` | Counter | `source` (bounded provider or `other`), `state` (`current`, `stale`, `unknown`, `partial`, `unavailable`, `partial_permission`, `denied`) |
| `pulse_operational_trust_identity_correlations_total` | Counter | `outcome` (`attached`, `standalone`, `ambiguous`, `unresolved`, `other`) |
| `pulse_operational_trust_protection_posture_evaluations_total` | Counter | `state` (`protected`, `attention`, `unprotected`, `unknown`, `other`) |
| `pulse_operational_trust_protection_posture_evaluation_failures_total` | Counter | `reason` (`invalid_policy`, `invalid_posture`, `store`, `provider`, `other`) |
| `pulse_operational_trust_notification_delivery_total` | Counter | `outcome` (`queued`, `retry`, `sent`, `failed`, `dead_letter`, `cancelled`, `other`) |
| `pulse_operational_trust_active_count_mismatch_total` | Counter | None (canonical active count vs attention projection mismatches) |
| `pulse_operational_trust_action_offers_total` | Counter | `eligibility` (`eligible`, `ineligible`, `unknown`, `other`) |
| `pulse_operational_trust_action_verification_total` | Counter | `outcome` (`pending`, `confirmed`, `contradicted`, `inconclusive`, `timed_out`, `not_attempted`, `other`) |
Useful alerts include:
- sustained growth in `active_count_mismatch_total`;
- notification `failed` or `dead_letter` outcomes;
- growing stale, unavailable, denied, or partial evidence observations;
- identity `ambiguous` or `unresolved` outcomes;
- action verification `contradicted`, `inconclusive`, or `timed_out` outcomes.
- sustained growth in `pulse_operational_trust_active_count_mismatch_total`
- `pulse_operational_trust_notification_delivery_total` with `outcome` `failed` or `dead_letter`
- growing `stale`, `unavailable`, `denied`, `partial_permission`, or `partial` counts in `pulse_operational_trust_evidence_observations_total`
- `ambiguous` or `unresolved` outcomes in `pulse_operational_trust_identity_correlations_total`
- `contradicted`, `inconclusive`, or `timed_out` outcomes in `pulse_operational_trust_action_verification_total`
## Upgrade and compatibility

View File

@@ -147,6 +147,17 @@ Patrol also recovers investigations that were left running and retries ones
that timed out. See `recoverStuckInvestigations` and
`retryTimedOutInvestigations` in `internal/ai/patrol_findings.go`.
**Concurrency and deferred queue:** `GetPatrolInvestigationConcurrency()` in
`internal/config/ai.go` admits up to `3` parallel investigations on metered API
providers (`MaxConcurrentInvestigations`) and `1` at a time on local
`codex-subscription` and `claude-subscription` CLIs. When every slot is busy,
`FindingsStore.DeferInvestigation` in `internal/ai/patrol_investigation_queue.go`
holds up to `64` additional findings in memory (`maxDeferredInvestigations`),
dequeuing critical findings before warnings and then longest waiting
(`TakeNextDeferredInvestigation`), and re-checking `Finding.ShouldInvestigate`
before starting each queued run. Because the deferred list lives in memory,
waiting findings are picked up again on a later Patrol run after a restart.
### Turn budgets and stuck-run recovery
Investigation turns use caller-owned stall and deadline budgets in

View File

@@ -152,6 +152,6 @@ The hook hydrates from the WebSocket state when available and falls back to the
## See Also
- [Architecture](../ARCHITECTURE.md) — system architecture overview
- [Migration Guide](MIGRATION_UNIFIED_NAV.md) — upgrading from platform-specific navigation
- [Retired unified-navigation migration](MIGRATION_UNIFIED_NAV.md): historical context and platform-shaped equivalents for retired `/workloads`, `/storage`, and `/recovery` routes
- [API Reference](API.md) — full API documentation
- [TrueNAS Integration](TRUENAS.md) — TrueNAS-specific details

View File

@@ -74,6 +74,8 @@ pulse_api PUT /api/ai/patrol/autonomy <<'JSON'
JSON
```
Activating **Autopilot** (`"autonomy_level": "full"`) via `PUT /api/ai/patrol/autonomy` also requires an active `acknowledgement_id` created in the same authenticated human session via `POST /api/ai/patrol/autonomy/acknowledgements` (and revocable via `DELETE /api/ai/patrol/autonomy/acknowledgements/{id}`). Both acknowledgement endpoints require administrator access, `settings:write`, and a human browser session rather than an API token.
The helper's loopback origin is for requests made on the Pulse host. For remote
use, change the origin and protocol restriction **in the helper** as the API
guide describes, using your Pulse **HTTPS** URL with certificate verification
@@ -162,7 +164,7 @@ When Patrol mode is `approval`, `assisted`, or `full`, Patrol investigates findi
| `patrol_investigation_budget` | `investigation_budget` | 10 | 5-30 | Maximum evidence-tool calls per investigation. Patrol derives a separate model-response safety ceiling. |
| `patrol_investigation_timeout_sec` | `investigation_timeout_sec` | 600 (1500 for subscription CLIs) | 60-1800 | Maximum seconds per investigation. Subscription agent CLIs (`codex-subscription`, `claude-subscription`) default to 1500 seconds (25 minutes) when unset. |
The following limits are fixed in the runtime and cannot be changed: up to 3 investigations run in parallel (up to 64 additional findings can wait in memory for a free slot, prioritised critical-first), up to 3 attempts per finding, a 1 hour default cooldown between investigation attempts, a 20 minute cooldown after a failed fix or failed fix verification, and a 10 minute cooldown after a timed-out outcome. Runs that fail before producing a conclusion, are interrupted by a restart, or end with unknown fix verification carry no extra cooldown and wait for the next scheduled Patrol cycle.
The following limits are fixed in the runtime and cannot be changed: up to 3 investigations run in parallel on metered API providers, local subscription agent CLIs (`codex-subscription`, `claude-subscription`) run 1 investigation at a time because each CLI serves one call at a time (`GetPatrolInvestigationConcurrency()`), and up to 64 additional findings can wait in memory for a free slot, prioritised critical-first then longest waiting (`maxDeferredInvestigations`, cleared on restart). Patrol also enforces up to 3 attempts per finding, a 1 hour default cooldown between investigation attempts, a 20 minute cooldown after a failed fix or failed fix verification, and a 10 minute cooldown after a timed-out outcome. Runs that fail before producing a conclusion, are interrupted by a restart, or end with unknown fix verification carry no extra cooldown and wait for the next scheduled Patrol cycle.
Background Patrol action plans, including refreshed Patrol plans, stay open for approval for 24 hours before expiring, matching investigation retention. Direct API and interactive action plans keep the 5-minute default expiry. Live freshness, policy, and emergency-stop checks still run when an approved plan executes.

View File

@@ -159,18 +159,31 @@ segments.
## Metrics
The `/metrics` listener exposes Operational Trust counters and histograms under
`pulse_operational_trust_*`. Labels use closed, low-cardinality vocabularies;
resource IDs, evidence IDs, provider-instance names, actors, and destination
IDs never appear as labels.
The `/metrics` listener exposes ten Operational Trust counters and histograms
under `pulse_operational_trust_*` (`internal/operationaltrust/metrics.go`).
Labels use closed, low-cardinality vocabularies. Resource IDs, evidence IDs,
provider-instance names, actors, and destination IDs never appear as labels:
| Metric | Type | Labels / bounded values |
| :--- | :--- | :--- |
| `pulse_operational_trust_observation_to_open_seconds` | Histogram | None (elapsed seconds from first observation to open record) |
| `pulse_operational_trust_open_to_notification_enqueue_seconds` | Histogram | None (elapsed seconds from open transition to notification enqueue) |
| `pulse_operational_trust_evidence_observations_total` | Counter | `source` (bounded provider or `other`), `state` (`current`, `stale`, `unknown`, `partial`, `unavailable`, `partial_permission`, `denied`) |
| `pulse_operational_trust_identity_correlations_total` | Counter | `outcome` (`attached`, `standalone`, `ambiguous`, `unresolved`, `other`) |
| `pulse_operational_trust_protection_posture_evaluations_total` | Counter | `state` (`protected`, `attention`, `unprotected`, `unknown`, `other`) |
| `pulse_operational_trust_protection_posture_evaluation_failures_total` | Counter | `reason` (`invalid_policy`, `invalid_posture`, `store`, `provider`, `other`) |
| `pulse_operational_trust_notification_delivery_total` | Counter | `outcome` (`queued`, `retry`, `sent`, `failed`, `dead_letter`, `cancelled`, `other`) |
| `pulse_operational_trust_active_count_mismatch_total` | Counter | None (canonical active count vs attention projection mismatches) |
| `pulse_operational_trust_action_offers_total` | Counter | `eligibility` (`eligible`, `ineligible`, `unknown`, `other`) |
| `pulse_operational_trust_action_verification_total` | Counter | `outcome` (`pending`, `confirmed`, `contradicted`, `inconclusive`, `timed_out`, `not_attempted`, `other`) |
Useful alerts include:
- sustained growth in `active_count_mismatch_total`;
- notification `failed` or `dead_letter` outcomes;
- growing stale, unavailable, denied, or partial evidence observations;
- identity `ambiguous` or `unresolved` outcomes;
- action verification `contradicted`, `inconclusive`, or `timed_out` outcomes.
- sustained growth in `pulse_operational_trust_active_count_mismatch_total`
- `pulse_operational_trust_notification_delivery_total` with `outcome` `failed` or `dead_letter`
- growing `stale`, `unavailable`, `denied`, `partial_permission`, or `partial` counts in `pulse_operational_trust_evidence_observations_total`
- `ambiguous` or `unresolved` outcomes in `pulse_operational_trust_identity_correlations_total`
- `contradicted`, `inconclusive`, or `timed_out` outcomes in `pulse_operational_trust_action_verification_total`
## Upgrade and compatibility

View File

@@ -147,6 +147,17 @@ Patrol also recovers investigations that were left running and retries ones
that timed out. See `recoverStuckInvestigations` and
`retryTimedOutInvestigations` in `internal/ai/patrol_findings.go`.
**Concurrency and deferred queue:** `GetPatrolInvestigationConcurrency()` in
`internal/config/ai.go` admits up to `3` parallel investigations on metered API
providers (`MaxConcurrentInvestigations`) and `1` at a time on local
`codex-subscription` and `claude-subscription` CLIs. When every slot is busy,
`FindingsStore.DeferInvestigation` in `internal/ai/patrol_investigation_queue.go`
holds up to `64` additional findings in memory (`maxDeferredInvestigations`),
dequeuing critical findings before warnings and then longest waiting
(`TakeNextDeferredInvestigation`), and re-checking `Finding.ShouldInvestigate`
before starting each queued run. Because the deferred list lives in memory,
waiting findings are picked up again on a later Patrol run after a restart.
### Turn budgets and stuck-run recovery
Investigation turns use caller-owned stall and deadline budgets in

View File

@@ -152,6 +152,6 @@ The hook hydrates from the WebSocket state when available and falls back to the
## See Also
- [Architecture](../ARCHITECTURE.md) — system architecture overview
- [Migration Guide](MIGRATION_UNIFIED_NAV.md) — upgrading from platform-specific navigation
- [Retired unified-navigation migration](MIGRATION_UNIFIED_NAV.md): historical context and platform-shaped equivalents for retired `/workloads`, `/storage`, and `/recovery` routes
- [API Reference](API.md) — full API documentation
- [TrueNAS Integration](TRUENAS.md) — TrueNAS-specific details

View File

@@ -163,13 +163,27 @@ class AuthenticationDiagnosticDocsTest(unittest.TestCase):
def test_ai_autonomy_verification_timeout_and_autopilot_gate_match_runtime(self):
source = DOCUMENTS["AI_AUTONOMY"].read_text()
shipped = (ROOT / "frontend-modern/public/docs/AI_AUTONOMY.md").read_text(encoding="utf-8")
self.assertEqual(source, shipped)
guide = " ".join(source.split())
self.assertIn("human-session acknowledgement", guide)
self.assertIn("POST /api/ai/patrol/autonomy/acknowledgements", source)
self.assertIn("DELETE /api/ai/patrol/autonomy/acknowledgements/{id}", source)
self.assertIn("1500 for subscription CLIs", guide)
self.assertIn("codex-subscription", source)
self.assertIn("claude-subscription", source)
self.assertIn("const DefaultPatrolSubscriptionInvestigationTimeoutSec = 1500",
(ROOT / "internal/config/ai.go").read_text())
self.assertIn("up to 3 investigations run in parallel on metered API providers", guide)
self.assertIn("run 1 investigation at a time", guide)
self.assertIn("GetPatrolInvestigationConcurrency()", source)
self.assertIn("maxDeferredInvestigations", source)
ai_cfg = (ROOT / "internal/config/ai.go").read_text(encoding="utf-8")
self.assertIn("const DefaultPatrolSubscriptionInvestigationTimeoutSec = 1500", ai_cfg)
self.assertIn("func (c *AIConfig) GetPatrolInvestigationConcurrency() int", ai_cfg)
queue_go = (ROOT / "internal/ai/patrol_investigation_queue.go").read_text(encoding="utf-8")
self.assertIn("const maxDeferredInvestigations = 64", queue_go)
routes_go = (ROOT / "internal/api/router_routes_ai_relay.go").read_text(encoding="utf-8")
self.assertIn('"/api/ai/patrol/autonomy/acknowledgements"', routes_go)
self.assertIn('"/api/ai/patrol/autonomy/acknowledgements/"', routes_go)
self.assertNotIn("cannot return to idle state without verification", guide)
self.assertIn("ActionResultV2", source)
self.assertIn("ASSISTANT_SAFETY.md#evidence-and-outcomes", source)
@@ -237,6 +251,12 @@ class AuthenticationDiagnosticDocsTest(unittest.TestCase):
"`5`-minute grace window (`investigationRunGrace`)",
"`stuckInvestigationResult` and `abandonedInvestigationSession`",
'"Patrol stopped waiting for this investigation after it ran past its time limit."',
"`GetPatrolInvestigationConcurrency()`",
"`MaxConcurrentInvestigations`",
"`1` at a time on local `codex-subscription` and `claude-subscription` CLIs",
"`FindingsStore.DeferInvestigation`",
"`64` additional findings in memory (`maxDeferredInvestigations`)",
"`TakeNextDeferredInvestigation`",
):
with self.subTest(phrase=phrase):
self.assertIn(phrase, guide)

View File

@@ -588,6 +588,11 @@ class NavigationHelpDocsTest(unittest.TestCase):
with self.subTest(source="UpdateReadinessChecksPanel.tsx", marker=marker):
self.assertIn(marker, panel_tsx)
self.assertEqual(doc_text("UNIFIED_RESOURCES.md"),
(ROOT / "frontend-modern/public/docs/UNIFIED_RESOURCES.md").read_text(encoding="utf-8"))
self.assertNotIn("upgrading from platform-specific navigation", doc_text("UNIFIED_RESOURCES.md"))
self.assertIn("Retired unified-navigation migration", doc_text("UNIFIED_RESOURCES.md"))
def test_all_changed_guides_match_their_shipped_copies(self):
for name in (
"README.md",

View File

@@ -307,6 +307,24 @@ class ProductionRolloutDocsTest(unittest.TestCase):
attention = (ROOT / "internal/api/attention_handlers.go").read_text(encoding="utf-8")
self.assertIn('case path == "/receipts":', attention)
metrics_go = (ROOT / "internal/operationaltrust/metrics.go").read_text(encoding="utf-8")
for metric_suffix in (
"observation_to_open_seconds",
"open_to_notification_enqueue_seconds",
"evidence_observations_total",
"identity_correlations_total",
"protection_posture_evaluations_total",
"protection_posture_evaluation_failures_total",
"notification_delivery_total",
"active_count_mismatch_total",
"action_offers_total",
"action_verification_total",
):
with self.subTest(metric=metric_suffix):
self.assertIn(f'Name: "{metric_suffix}"', metrics_go)
self.assertIn(f"`pulse_operational_trust_{metric_suffix}`", trust)
self.assertIn("`partial_permission`", trust)
if __name__ == "__main__":
unittest.main()