Skip to content

feat(agent): cross-cycle volatility gauge for incident dedup + change awareness#96

Merged
atomicdragonranch merged 1 commit into
masterfrom
feat/77-volatility-gauge
Jul 9, 2026
Merged

feat(agent): cross-cycle volatility gauge for incident dedup + change awareness#96
atomicdragonranch merged 1 commit into
masterfrom
feat/77-volatility-gauge

Conversation

@atomicdragonranch

Copy link
Copy Markdown
Owner

Closes #77.

Problem

The coordinator is stateless between cycles and never read its own history, so a persistent anomaly (latency stays bad for N cycles) was re-diagnosed and re-escalated every cycle (alert spam), and every sighting was treated as the first.

Fix

A lightweight in-memory cross-cycle memory on the coordinator instance (which lives for the whole run loop). New VolatilityGauge (agent/volatility.py):

  • fingerprints each anomaly as anomaly_type:component (idempotent dedup key);
  • classifies a detection as NEW / ONGOING / WORSENING against history, and marks other previously-active incidents RESOLVED;
  • WORSENING when observed_value rose by >= agent_incident_worsen_pct since last cycle; ONGOING recurrence within agent_incident_ongoing_gap cycles, else NEW;
  • should_report: NEW/WORSENING always; ONGOING only until reported once (agent_incident_dedup), then suppressed;
  • prior_context() feeds a "since last cycle" summary into the next detection, so an ongoing anomaly is recognized as such (change awareness).

run_cycle now stamps a cycle number, observes each detection, injects prior context into detection, suppresses a reported unchanged ongoing incident before the expensive diagnose/report, marks reported after escalation, and logs resolved incidents on all-clear. Thresholds externalized to config, validated at startup.

State is in-memory (resets on restart), an accepted tradeoff, durable history already lives in the audit log.

Tests

11 gauge unit tests (fingerprint, new/ongoing/worsening/gap, suppression, not-yet-reported-still-reports, resolved, prior_context, all-clear, dedup-off); a run_cycle two-cycle integration test proving a persistent incident reports once and is suppressed the second cycle; config defaults + validation.

Full suite 273 passed; ruff + mypy clean.

Pairs with #67 (parallel diagnosis): together the coordinator now has cross-cycle and cross-hypothesis intelligence.

https://claude.ai/code/session_01R5VygSzbGTggW7mHd3PVwE

… awareness

Closes #77.

The coordinator is stateless between cycles and never read its own history, so a
persistent anomaly (latency stays bad for N cycles) was re-diagnosed and
re-escalated every cycle (alert spam), and every sighting was treated as the
first. This adds a lightweight in-memory cross-cycle memory on the coordinator
instance (which lives for the whole run loop).

New VolatilityGauge (agent/volatility.py):
- fingerprints each anomaly as anomaly_type:component (idempotent dedup key),
- classifies a detection as NEW / ONGOING / WORSENING against history, and marks
  other previously-active incidents RESOLVED,
- WORSENING when observed_value rose by >= agent_incident_worsen_pct since last
  cycle; ONGOING recurrence within agent_incident_ongoing_gap cycles, else NEW,
- decides should_report: NEW/WORSENING always; ONGOING only until reported once
  (agent_incident_dedup), then suppressed,
- prior_context() feeds a "since last cycle" summary into the next detection so
  an ongoing anomaly is recognized as such (change awareness).

run_cycle now stamps a cycle number, observes each detection, injects prior
context into detection, suppresses a reported unchanged ongoing incident before
the expensive diagnose/report, marks reported after escalation, and logs
resolved incidents on all-clear. Thresholds externalized to config, validated
at startup.

Tests: 11 gauge unit tests (fingerprint, new/ongoing/worsening/gap, suppression,
not-yet-reported still reports, resolved, prior_context, all-clear, dedup-off),
a run_cycle two-cycle integration test proving a persistent incident reports
once and is suppressed the second cycle, and config defaults/validation. Full
suite 273 passed; ruff + mypy clean.
@atomicdragonranch atomicdragonranch merged commit 89f10d0 into master Jul 9, 2026
3 checks passed
@atomicdragonranch atomicdragonranch deleted the feat/77-volatility-gauge branch July 9, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: cross-cycle state volatility gauge (incident dedup + change awareness)

1 participant