Confidence decay for signal groups (ADR 022)#122
Merged
Conversation
Exponential time decay applied to per-event confidence contributions when computing derived_confidence. An event's effective weight is multiplied by 0.5^(age_seconds / half_life_seconds), so older corroborating evidence smoothly loses influence without ever being discarded. - Global config: correlation.confidence_decay_half_life_seconds: u32 (default 0, disabled). Validated 0 <= H <= 10 * window_seconds. - Per-playbook override: confidence_decay_half_life_seconds: Option<u32>. Some(0) explicitly disables for the playbook; None falls through. - Reconcile loop step refresh_decayed_confidence iterates open groups every tick and recomputes derived_confidence with decay applied. - Sticky corroboration_met: once true, decay never flips it back to false (one-shot authorization). - Metric prefixd_signal_group_decay_refreshes_total counter. - UI label "decayed, half-life Ns" on group detail page when active. Default disabled, zero behavior change for existing deployments. Tests: 17 new (7 engine + 7 config + 3 integration) covering decay math, override resolution, validation, disabled paths, and sticky corroboration semantics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds exponential confidence decay to signal-group
derived_confidencecomputation. Older per-event confidence contributions are multiplied by0.5 ^ (age_seconds / half_life_seconds), so corroborating evidence from earlier in the correlation window smoothly loses weight without ever being discarded.Closes ROADMAP item: "Confidence decay over time" under Confidence Model.
Why
The correlation engine (ADR 018) computes
derived_confidenceas a source-weighted average. With long correlation windows (e.g.window_seconds: 3600) and ADR 021 corroborating signals, evidence that fired hours ago continues to inflate the score at full weight long after the underlying signal has gone silent. A naive cutoff loses history and produces step discontinuities; exponential decay shapes contributions smoothly.Design (ADR 022)
correlation.confidence_decay_half_life_seconds: u32(default0, disabled). Validated0 ≤ H ≤ 10 × window_seconds.correlation_override.confidence_decay_half_life_seconds: Option<u32>.Some(0)explicitly disables for the playbook even when the global is non-zero;Nonefalls through.refresh_decayed_confidencestep (no-op when decay disabled).corroboration_met: sticky — oncetrue, decay never reverts it tofalse. Preserves the invariant that authorized mitigations stay authorized.prefixd_signal_group_decay_refreshes_totalcounter ticks per reconcile step.Tests
test_decay_refresh_lowers_derived_confidencetest_decay_one_shot_corroboration_no_flap_backtest_decay_disabled_does_not_touch_groupsFull suite: 236 unit + 130 integration + 16 postgres pass. Frontend: 87 tests + build clean.
cargo fmt --check+cargo clippy --all-targets --features test-utils -- -D warningspass.Migration
None. Default
confidence_decay_half_life_seconds: 0preserves ADR 018 behavior bit-for-bit. Operators opt in by setting a non-zero value incorrelation.yaml.ADR
See docs/adr/022-confidence-decay.md for full rationale, alternatives considered, and consequences.