An agent holding /api/agent/events open heard about findings, approvals
and action completions, but not about the facts it most often has to
react to: an alert firing or clearing, or a resource going down. Pulse
already records those as resource changes that list_recent_changes
reads; this publishes them live as alert.fired, alert.resolved and
resource.status_changed, so agents and Pulse MCP --emit-notifications
clients can react without polling.
The monitor adapter tells an observer about each change after the store
accepts it, with the resource ID resolved to the canonical identity it
was stored under. Registry diffs are announced after the new generation
is swapped in. Alert rows are announced only from the alert manager's
live lifecycle callback through RecordLiveChange; lifecycle replay,
active-alert reconciliation and imported history keep using RecordChange,
so a restart never re-announces old alerts. Nothing new is persisted and
nothing is read back from the store, so there are no extra disk writes.
Payloads mirror the timeline record (changeId, kind, canonical
resourceId, current name and type, from/to or alert identifier, type,
level and resolution) and never carry alert messages, change reasons or
command metadata. Only state transitions whose status field changed
count as status events. Status changes are coalesced per resource over
30 seconds: the first is immediate, later ones fold into at most one
event per window, and a flap that returns to the announced status
publishes nothing. Change events carry the recording monitor's
organization and reach only subscribers in that organization.
Close background catch-up admission atomically with its wait group, cancel between whole lifecycle events and keep the applied watermark before closing history. Start joins replay admitted by router attachment; Stop also covers a monitor that never started. Retain blocked-writer ownership through the existing tenant deletion budget, and resume the unapplied tail in a new monitor.
Contract-Neutral: Preserve canonical occurrence history, notification policy, tenant isolation and bounded deletion refusal; make existing background projection writers obey monitor lifetime without changing public API or delivery behaviour.
Change-source: pulse-maintainer
Eight imported snapshots caused eight filtered history queries and thirty-six identity reads although replay discards each result. Share the unchanged occurrence repair with a write-only materialisation entrypoint; keep EnsureAlertOccurrence and user queries on their existing canonical read-repair path.
Preserve snapshot fallback, bounded count and age retention, checkpoint recovery and read-error behaviour. Shutdown worker ownership and the reported memory baseline remain separate outcomes.
Contract-Neutral: Internal replay cost correction only; alert occurrences, canonical history, checkpoint and retention formats, user reads and notification policy are unchanged.
Change-source: pulse-maintainer
Preserve exact reviewed tip b5b1fa9777 and upstream a85bdcdc9a additively. Retain both alert threshold test sets. Combine upstream mock-mode epoch fencing with reviewed structural-revision checks and Docker departure ownership; add a regression that a current revision cannot revive an ended epoch. Resolve the monitoring contract to describe both boundaries, without rewriting accepted history.
Publication remains deferred for genuine final-content browser receipts and independent CodeQL disposition. Composition checks do not establish native recovery, deployment, exact-head hosted acceptance or release readiness.
Change-source: pulse-maintainer
SetMockMode(false) switched the mock package off and then cleared active
alerts, but every path that evaluates mode-dependent data checked the
mode once, up front. A mock alert pass (started from the ticker with go,
so passes overlap), a frontend or ingest refresh evaluating a GetState
snapshot, a backup-age check over fixture recovery rollups, or a
connection check over the mock ledger could already hold fixture data
when the switch happened. Its evaluations then landed after the clear,
in live mode, where nothing evaluates or resolves fixture resources, so
the alerts stayed until the 24-hour stale sweep.
A pass-level lock around checkMockAlerts was tried and reverted: it left
the other paths open and made the mock-mode API wait behind a whole pass
of synchronous event-log writes.
The monitor now owns a mock-mode epoch fence. The mock pass, backup-age
and snapshot checks, connection checks, Docker pruning and the
resource-store refresh take a scope before reading anything
mode-dependent and send each alert-manager call through it. SetMockMode,
now serialized, flips the mode, ends the epoch, waits only for calls
already admitted, and then clears. Unified metrics are evaluated one
resource per call, so the wait covers single calls, not passes.
Registry rebuilds are tracked rather than waited on. A refresh evaluates
the registry it read back only if no rebuild from an ended epoch
overlapped it, and the readers that open or remove alerts from the
inventory use current state until a clean rebuild in the new epoch
replaces the previous mode's registry. The mock supplemental fixture
sources now serve nothing outside mock mode: the router swaps them for
the real pollers only after the switch, refreshing between sources, so
a single switch to live mode used to raise fixture vSphere incidents.
The new tests park a real evaluation at a fixed point (a held lock or a
blocking supplier), switch modes and release it. Against the unfenced
code the mock pass left about 40 fixture alerts, the frontend refresh 5
vSphere incidents and the backup check 137 backup-age alerts in live
mode, and a mock-mode connection observation counted toward a live
connection's confirmation. The drain, republish and pruning tests fail
against a fence without its wait, overlap check or registry tracking.
Switching mock mode with several tenant monitors running remains
uncovered and is noted in the monitoring contract.
Add the exact batch-start upstream history without rewriting any accepted commit; reconcile its host-offline, mock-disk, hot-disk and metric-history changes with the reviewed monitoring batch.
Change-source: pulse-maintainer
checkMockAlerts evaluated guests, agents, nodes, storage, PBS, PMG and
Docker against the mock estate but never physical disks. The fixture
keeps a FAILED cohort and worn SSDs stable on purpose, so mock and demo
stacks showed failing and "Replace Now" disks with no disk-health or
disk-wearout alert, and the disk alert lifecycle could not be exercised
without real hardware.
The pass applies the physical disk poller's boundary: only disks on
online nodes, matched by instance and node name, with the linked
agent's --disk-exclude patterns forcing a matched device healthy. The
per-disk evaluation moves into checkPhysicalDiskAlerts so the poller
and the mock pass share one rule. The poller's agent-link settle
deferral is not applied, because fixture links and exclusions are
complete from the first pass.
Like the other loops in checkMockAlerts, the disk loop runs after the
pass's single mode check, so the existing race with leaving mock mode
now covers disk alerts too. That race also involves other fixture
evaluation paths and is left for a monitor-wide fix.
On the public demo's estate (8 nodes) this adds one warning-level
disk-wearout alert and no disk-health alert: that estate has no FAILED
Proxmox disk.
Port rcourtman’s Pulse PR #2592 at 5a37a72f76 onto the assigned current source. Departed fixture hosts use the live removal boundary even without state readers; structural revision checks prevent stale overlapping passes from reinstating retired hosts or node links.
The source tree is identical to rejected candidate 2540bfdae621ddad72063463e0ef8dea6451247f. Its contributor-history merge failed maintainer provenance, so this is a new attributed maintainer port, not an amendment or relabelling of the original commits. Fresh exact-source proof and independent protected review are still required.
Change-source: pulse-maintainer
Follow-up to rcourtman/Pulse#2580. A node alert handed to its Pulse
agent closes with an `AlertResolution` (`moved_to_agent`), and
notifications already say it moved. Every in-app reader still treated
that close as a recovery:
- Patrol's attention detail showed a green **Resolved** badge, and its
timeline read "Open to Resolved · Recovery evidence" directly above
"…This is not a recovery…".
- The Alerts history listed the row as **resolved**, and its incident
timeline ended "Alert resolved: Node memory at 95.0%".
- `GetRecentlyResolved` rebuilt `models.Alert` without the resolution.
So the state snapshot, websocket, assistant context, Patrol's seed
prompt and the `pulse_alerts` `resolved` action all saw a plain resolve.
**Operational trust.** New `TransitionCause` `ownership_transferred`. It
may only enter `resolved`, and only with evidence.
`markOperationalResolved` uses it whenever the alert carries a
`moved_to_agent` resolution; every other close stays on
`recovery_evidence`. Alert-quality telemetry keys "resolved while
snoozed" on `recovery_evidence`, so a handover during a snooze no longer
counts there. No notification code reads the cause: links key on the
transition ID and state.
**State and AI.** `models.Alert.Resolution` holds the reason, successor
and the engine's `Summary()`. `cloneAlert` copies it, and
`GetRecentlyResolved` fills it.
- Patrol's seed writes `closed 3m ago. Alert moved to pve1 (Host Agent).
This is not a recovery: …`.
- The assistant's context writes `closed … ago) <summary>`.
- The resolved-alerts tool returns `resolution` and
`successor_resource_id`.
**Timelines.** The `alert_resolved` resource change carries the summary
as its reason and the code as `alert_resolution` metadata. Incident
memory titles the close with it, both when projecting from the canonical
timeline and on its own write path.
**UI.**
- The history row reads **moved to agent**, even if it was acknowledged.
The full account is in the badge title and is printed under the message
on the phone card.
- Patrol's detail shows a **Moved** badge (info tone), with the handover
sentence directly under the summary rather than only inside Evidence and
history. Its timeline says "Ownership transferred".
**Landing order.** rcourtman/Pulse#2586 is the only producer of a
handover, and it has no auto-merge. It should land after this PR (or
merge main once this is in). Any handover recorded before this lands
would otherwise keep a recovery-labelled transition and timeline.
**Not covered here:**
- Performance reports still list a handover from the last 5 minutes as
resolved.
- The resource drawer labels the change "Alert resolved" before its
reason.
- The incident header in the history expansion still shows its
open/resolved status word.
Both of the first two are filed as a follow-up and noted in
ai-runtime.md and unified-resources.md.
**Tests:**
- `TestOwnershipTransferOnlyClosesWithEvidence`.
- The cause assertions in
`TestReleasedMetricAlertCarriesResolutionInsteadOfRecovery`.
- `TestRecentlyResolvedCarriesHandoverResolution`.
- `TestAlertResolutionWireContract`, which fails without the
`cloneAlert` copy.
- `TestMonitor_HandleAlertLifecycle_HandoverCloseIsNotARecovery`, which
fails on the old code with "Alert resolved: Memory usage at 95%".
- `TestIncidentStore_HandoverCloseIsNotARecovery`.
- `TestSeedHealthAndAlerts_HandoverIsNotARecovery`.
- `TestService_buildAlertContext_HandoverIsNotARecovery`.
- `TestExecuteListResolvedAlertsReportsHandover`.
- Frontend history, presentation and Patrol workbench tests.
The operationaltrust, alerts, models, ai, ai/tools, ai/memory,
unifiedresources, monitoring and notifications suites pass. `tsc`,
eslint and the vitest sweep pass, apart from the Mac-only
`agentInstallCommand` PTY test.
**Browser pass.** A private non-mock stack ran on an alert history
written by the real `releaseCanonicalMetricAlert` handover path. I
checked Alerts history (row, tooltip, expanded timeline) and Patrol's
deep-linked detail at 1280 and 375: no overflow, no console errors.
A node alert handed to its Pulse agent closes with an AlertResolution
(#2580), and notifications already say it moved. Every in-app reader
still treated the close as a recovery: Patrol's detail wore a green
Resolved badge over a timeline labelled "Recovery evidence", the alert
history listed the row as resolved and its incident timeline said
"Alert resolved: Node memory at 95%", and the assistant, Patrol's seed
prompt and the pulse_alerts tool saw a plain resolve because
GetRecentlyResolved dropped the resolution.
Operational trust gains a non-recovery cause, ownership_transferred,
which may only enter resolved and only with evidence. The resolve
transition uses it whenever the alert carries a moved_to_agent
resolution, so a handover during a snooze also stops counting as
resolved while snoozed.
models.Alert gains Resolution (reason, successor and the engine's
summary), copied by cloneAlert and filled by GetRecentlyResolved, so
the state snapshot, websocket, assistant context, Patrol seed and the
resolved-alerts tool all report where the alert went. The resolved
resource change carries the summary as its reason with alert_resolution
metadata, and incident memory titles the close with it.
In the UI, the history row reads "moved to agent" with the account in
its title and on the phone card, and Patrol's detail shows a Moved
badge with the handover sentence under the summary.
checkMockAlerts evaluated mock nodes, guests, storage, PBS, PMG and
Docker hosts but never host agents. Live agents are evaluated by
CheckHost as each report lands; mock mode discards reports and the host
health sweep never sees fixture agents, so no agent CPU, memory, disk,
temperature or offline alert could open against mock data. A mock agent
at 94% memory sat under an 85% trigger with no alert, and alert work on
agents needed a private build to reproduce anything.
Mock passes now evaluate every fixture agent with the live lifecycle
boundaries:
- offline fixtures go through HandleHostOfflineWithCorrelation, since
CheckHost treats its input as a fresh report and marks it online;
- agents run before nodes, so a node with an online linked agent hands
its metric alerts to the agent on the first tick;
- an agent that leaves the estate on a runtime mock config change goes
through HandleHostRemoved, like a deleted live agent;
- leaving mock mode routes the fixture agents through HandleHostRemoved,
releasing hostname registrations that ClearActiveAlerts leaves behind
and that would otherwise suppress a real node named pve1; a pass already
in flight finds mock mode off and evaluates nothing.
Evaluating agents exposed a mock-only reading: every Kubernetes pod took
a single-pod share (10-80%) of its node's allocatable memory, so any
node running four or more pods, and its linked agent, read a constant
100%. On the public demo's estate that became two permanent critical
memory alerts no real cluster would raise. Pods now share 0.7 single-pod
footprints per node (at most 58% of allocatable in steady state), and a
60% per-node ceiling clips the transient while rescheduled pods'
readings settle, so those nodes stay under 82%.
For #2465, select latest provider evidence with the existing scope index
rather than ranking every retained payload. Preserve history and evidence
validation. Share complete, failure-preserving backup alert evaluation
across PVE/PBS/mock polls and expose unavailable reads through the existing
deduplicated system warning; keep existing age alerts until a complete read.
Contract-Neutral: Application query and existing system-alert behaviour only; no API, schema, resource identity, agent lifecycle, entitlement or notification contract shape changes. The new warning uses the existing open system-alert type, identity and metadata contract. Semantic contracts and connected verification are included.
Change-source: pulse-maintainer
A cancelled retry and a lost RAM cooldown marker do not mean that no destination received the old firing. Keep quiet-hours and recovery controls, then let persistent occurrence/destination receipts select the actual recipients. Add an HTTP 200/503, restart and recurrence control so the newer firing survives and only the previously informed destination receives the old recovery.
Change-source: pulse-maintainer
Capture the resolved alert before asynchronous callbacks and carry its start/end identity through monitor recovery. Cancel only that occurrence in grouping, cooldown and persistent firing rows, retaining newer incidents, operational links, destination receipts and failed attempts. Keep the explicit identifier-wide cancellation API and legacy callback IDs. Add snapshot, restart and connected queue-to-HTTP regression controls.
Change-source: pulse-maintainer
Rejected active-alert writes still reached history, firing events and
notification dispatch. Make admission explicit across detector and restore
paths so repeated suppressed observations cannot create those side effects.
Reconcile restored alerts when persisted resource policy attaches at startup,
reconcile again after native aliases become canonical, and refresh shared
state before those alerts reach clients.
Preserve occurrence identity when retained alerts re-fire, including durable
history reconstruction and delayed lifecycle replay.
Keep retained table and card components mounted when scrolling shifts the
visible window, so policy editors do not lose unsaved state. Show actual
future maintenance times and the paused-attention effect.
Keep synthetic host machine identities stable across restarts so saved
operator policy remains attached during verification.
Qualify server update and rollback instructions by helper ownership, and
stop signed installer recipes before execution if a download or signature
check fails.
Refs #2237
Revalidate policy, active occurrence, acknowledgement and snooze at the monitoring callback boundary. Preserve current routing and cooldown behaviour with live-incident fixtures. Pin pre-deadline policy changes and queued email routing versus resolution independently.
Change-source: pulse-maintainer
Filter canonical history before selecting occurrences, preserve source evidence
and expose bounded reads and failures. Reconcile duplicate saved shells without
splitting one alert lifecycle, and keep note identity and canonical risk intact.
Carry attributed operator notes into Assistant. Preserve mobile investigations
across layout changes, transfer composer focus on handoff and keep long event
text readable. Record scoped qualification and its unresolved wider limits.
Refs #1782
Projection replay walked the entire alert event log on every boot, twice
(monitor start and the resource-store boundary), synchronously on the
serving path, and every replayed event queued a full incident-store JSON
rewrite. A 64k-event log made startup exceed the dev supervisor's
health-kill window, so the backend restarted forever and never served.
The event log now owns per-consumer projection watermarks in
alert_store_meta, WalkOldest takes an AfterID cursor, and the single
catch-up pass runs in the background at the canonical resource-store
boundary with periodic watermark checkpoints. The watermark only
advances when both the incident store and the canonical change recorder
are attached, so partial-surface passes repair without marking events
applied, and lowering the watermark forces a full repair replay.
Incident-store saves now coalesce: a burst of mutations queues one
whole-store serialization instead of one per event, live paths included.
Registers the alert-lifecycle-replay-startup-scalability coverage gap
and amends the alerts and monitoring subsystem contracts accordingly.
checkMockAlerts checked guests, nodes, storage, PBS, and PMG but never
looped over the mock estate's DockerHosts, so no docker container state,
health, metric, update, or swarm service alert could ever fire against
mock data. The generator deliberately keeps one container unhealthy per
estate, and the docker alert lifecycle (disable-all sweeps, update-alert
delay, config reconciliation) was unexercisable in the mock QA surface.
Verified live on a scratch mock instance: canonical docker metric alerts
fire, the Containers global-defaults toggle clears all of them via the
DisableAllDockerContainers sweep (the #1545 fix path), and re-enabling
re-fires them on the next cycle.
Contract-Neutral: mock-mode docker alert evaluation wiring fix; no public contract delta
An alert that resolved while its firing notification was still in the
grouping window or waiting in the persistent queue (alert delay pushes
activation close to resolution; quiet-hours replay defers delivery)
produced a recovery-only notification: CancelAlert dropped the queued
firing, but LastNotified had been set optimistically at dispatch, so
the resolved-notification gate believed the firing had been sent.
CancelAlert now reports whether it cancelled a firing notification that
had not been delivered (grouping window entries and pending queue rows;
mid-send rows are excluded because their delivery may still complete),
and handleAlertResolved suppresses the recovery in that case. This also
covers the quiet-hours replay bypass: a recovery only follows a deferred
firing if the replay was actually delivered.
Addresses #1553
A Proxmox host wedged on a ZFS deadlock yesterday took the cluster API poll
with it (context deadline exceeded). The unified connections aggregator
flipped the Connection from active to stale to unreachable, and the
Settings / Infrastructure page rendered the right badges, but no top-nav
alert ever fired because nothing was actively notifying off that derived
state. Patrol's deterministic triage flagged it every minute, but its LLM
investigation stage has been broken since 2026-02-26 so flags never
escalated into user-visible findings. Result: a 3 hour outage I only
noticed because I happened to open Settings.
This wires an active notification off the same connection state the
Settings badges already use:
- internal/alerts/connection.go: new CheckConnection +
clearConnectionDegradedAlert that fire connection-degraded after three
consecutive stale or unreachable observations. Severity scales: stale
warning, unreachable / unauthorized critical. Clear runs through the
same recovery-confirmation gate as clearNodeOfflineAlert so a single
flap back to active doesn't silently resolve a real outage. Paused,
disabled, and non-platform connections are no-ops.
- internal/api/connections_alerts.go: snapshot translator that turns
api.Connection into the narrow alerts.ConnectionSnapshot view. Keeping
the snapshot type inside the alerts package preserves the existing
api -> monitoring import direction; the monitor would have cycled if
it called back into api directly.
- internal/monitoring: new SetConnectionsSnapshotLister hook + a
per-tick checkConnectionAlerts call in the main poll loop, alongside
the existing evaluate*Agents passes.
- internal/api/router.go: register the lister closure on r.monitor so
the alerts loop sees the same Connection rows the HTTP handler does.
- internal/alerts/specs/types.go: add "connection" to the migration
bridge list of accepted ResourceTypes, alongside node / docker-host /
proxmox-disk / etc. The connection concept doesn't have a canonical
unified resource type yet; this matches the existing pattern for
alert-keyed resources that aren't first-class canonical.
Test coverage in internal/alerts/connection_test.go covers active never
fires, three stale observations escalate from pending to warning,
unreachable escalates warning to critical, unauthorized fires critical
cold, paused / disabled / agent never fire, recovery confirmation gate,
and a stale flap during recovery resets the gate.
TestResourceAlertSpecValidateAllowsConnectionMigrationBridgeType mirrors
the existing migration-bridge proof tests for the new type.