AgentsIQ
alert-analyser

Alert Ticketing & Escalated Incidents — Functional Specification

Detailed functional and logical reference for the incident ticketing pipeline built into alert-analyser.
Agentagents/alert-analyser/
Schemaincident_management.incidents (Postgres)
StatusLive, verified end-to-end. RCA/Action agents not yet built (consumers pending).
Generated3 July 2026

1. Purpose

When alert-analyser's sync cycle classifies an OpsGenie alert as "genuine," the system synchronously creates or updates a ticket in a shared incident_management Postgres schema. This schema is designed to be polled by future RCA and Action agents, giving them a durable, deduplicated queue of real incidents to work — independent of OpsGenie's own state, noise, and duplicate open/close event pairs.

2. Ticket Lifecycle — Dedup & Escalation Rule

Dedup key is alert_id (OpsGenie's alert ID). On each sync, for every genuine alert:

1
No ticket exists for this alert_id → create new ticket, status = ESCALATED.
2
Ticket exists, status NOT IN (RESOLVED, MANUAL) → still in-flight. Do not create a new ticket; bump updated_at, increment recurrence_count.
3
Ticket exists, status IS RESOLVED or MANUAL → prior incident closed, this is a new occurrence. Create a new ticket with related_ticket_id pointing to the prior ticket.

Pre-ticket filtering (applied before the above rule)

  • Alias-based deduplication — before iterating, alerts are deduplicated by alias (fallback id), keeping the record with the latest createdAt. Same incident firing multiple open/close events in one sync no longer creates duplicate ticket-loop iterations.
  • Source-status skip — alerts whose OpsGenie status field is closed or resolved are skipped entirely, even if classified genuine. Known limitation — see Future Work Tracker: the status field alone is unreliable; many source tools update the alert's message/title instead.

3. Reconciliation Pass — Auto-Resolving Stale Tickets

After ticket creation/update, a second pass runs on every sync to detect tickets whose underlying alert is no longer open+genuine, and reconciles their state:

Current Ticket StatusAlert No Longer Open+GenuineAction
ESCALATEDYesAuto-set status = RESOLVED, resolved_at = now() (nothing was in-flight, safe to close)
INVESTIGATING / RCA_COMPLETE / REMEDIATINGYesSet resolved_externally = TRUE — flags that the alert self-cleared mid-pipeline, without overwriting agent-driven status (preserves whether the pipeline's work mattered)
RESOLVED / MANUALN/ANo-op — already terminal

4. Schema

ColumnTypePurpose
idUUID (PK)Ticket identifier
alert_idTEXTOpsGenie alert ID (dedup key)
alert_signatureTEXTReserved for future RAG pattern matching
statusTEXTESCALATED / INVESTIGATING / RCA_COMPLETE / REMEDIATING / RESOLVED / MANUAL
priorityTEXTP1–P4 (from OpsGenie)
titleTEXTAlert message/alias, truncated
alert_payloadJSONBFull original alert object — the data contract for RCA/Action agents
rca_findings / action_outcomeJSONBReserved for RCA/Action agents (not yet populated)
recurrence_countINTEGERHow many times this alert has re-fired while ticket stayed open
related_ticket_idUUID (FK, self)Links a new ticket to a prior resolved/manual ticket for the same alert_id
resolved_externallyBOOLEANTrue if the ticket was reconciled/closed by the sync process rather than an Action agent
detected_at / escalated_at / rca_completed_at / resolved_atTIMESTAMPTZLifecycle timestamps
created_at / updated_atTIMESTAMPTZRow bookkeeping

5. SLA Policy

Priority-based response-time targets, applied to the Aging panel and per-ticket breach flag (proposed policy — not yet formally adopted org-wide):

PriorityDefinitionTarget ResponseTarget Resolution
P1 — CriticalService outage, major business impact15 min2 hours
P2 — MajorMajor functionality degraded, no workaround30 min4 hours
P3 — MinorLimited impact, workaround available60 min8 hours
P4 — InternalMinor impact, non-urgent240 min3 business days

Implemented Target Response is applied today as the SLA breach flag on the Aging panel and kanban lanes. Target Resolution is not yet used (no Action agent exists to actually close tickets on a timeline).

6. Resolution Method Breakdown

CategoryDefinition
Auto-Resolvedstatus=RESOLVED and resolved_externally=FALSE — closed by reconciliation because the source alert cleared before any agent touched it
Action-Resolvedstatus=RESOLVED and resolved_externally=TRUE — Placeholder currently indistinguishable from resolved-mid-pipeline; needs a real Action agent to set this deliberately
Manualstatus=MANUAL — closed by a human

7. Dashboard — Escalated Incidents Tab

KPI Panels

  • Pipeline Flow — horizontal bar, count per status (all 6 statuses always shown), with on-bar value labels.
  • Ticket Aging — time-bucketed histogram (0-5m / 5-15m / 15m+) for all non-terminal tickets, longest-wait callout, and an SLA breach summary line (breached vs within-SLA count and %, color-coded by severity).
  • Resolution Method — 3-segment donut (Auto-Resolved / Action-Resolved / Manual), with percentage labels, hidden when all-zero.
  • Recurrence Signal — top 10 tickets by recurrence_count, surfacing alerts that keep re-firing while a ticket is open.

Priority Lanes (Kanban)

Four columns — P1-CRITICAL, P2-HIGH, P3-MEDIUM, P4-LOW — each showing its SLA target as a subtitle, ticket cards sorted oldest-first, capped at 6 visible with a "+N more" indicator. Cards show status dot, short ID, time-since-escalation, title, alert ID, recurrence badge (if >1), and a red border + "⚠ SLA" badge when the SLA has been breached.

8. API Endpoints

EndpointPurpose
GET /dashboard/incidentsAggregated KPI data: pipeline_flow, aging_buckets, aging_longest_wait, resolution_ring, recurrence_signal, sla_breach
GET /dashboard/incidents/listIndividual tickets (optionally filtered by status/priority), including sla_breached and resolved_externally, sorted oldest-first — powers the kanban lanes
GET /dashboard/period-summaryRow 2 "Alerts in Period" KPI cards; extended this session with new_incidents_count / recurring_incidents_count sourced from the incidents table (true new-vs-recurring split, replacing the previously misleading "new genuine" alert-event count)
GET /dashboardMain dashboard stats; also extended with the same new/recurring incident fields for the Genuine Alerts tab

9. Known Simplifications

See the companion Future Work Tracker for the full, current list of flagged gaps and their code locations.