Skip to content

[codex] reduce noisy repeated alerts with cooldown#9

Merged
stacknil merged 1 commit intomainfrom
codex/issue-2-alert-cooldown
Mar 23, 2026
Merged

[codex] reduce noisy repeated alerts with cooldown#9
stacknil merged 1 commit intomainfrom
codex/issue-2-alert-cooldown

Conversation

@stacknil
Copy link
Copy Markdown
Owner

Summary

Fixes #2.

This PR adds a small, repo-local alert cooldown to reduce repeated noisy alerts caused by overlapping windows while keeping the current rule-based design intact.

Before this change, the same rule could trigger on many adjacent overlapping windows in the sample dataset, which made the default output noisy and harder to explain. The main cause was that apply_rules emitted every matching window independently, even when those windows were only 10 seconds apart and clearly part of the same burst.

The fix is intentionally simple:

  • add a global cooldown_seconds setting under rules in configs/default.yaml
  • apply cooldown after rule evaluation, using rule_name plus alert_time
  • suppress only repeated alerts for the same rule while the cooldown window is still active
  • keep different rules independent, so multiple distinct rule types can still alert on the same underlying window

With the default sample config, cooldown_seconds is set to 60, which matches the current window size. That reduces the bundled sample output from 53 alerts to 12 alerts without changing the underlying window features or moving away from the existing MVP rule model.

Validation

  • pytest tests/test_rules.py
  • pytest tests/test_pipeline_e2e.py -q
  • pytest

Exact cooldown behavior

For the default config, once an alert is emitted for a given rule_name, additional alerts with that same rule_name are suppressed until at least 60 seconds have elapsed since the last emitted alert for that rule. The comparison uses each alert's alert_time. An alert that lands exactly 60 seconds after the last emitted alert for the same rule is allowed through. Different rule names do not suppress each other.

@stacknil stacknil added this to the v0.2 milestone Mar 23, 2026
@stacknil stacknil added v0.2 Planned for v0.2 milestone enhancement New feature or request alerts Alerting behavior and noise reduction labels Mar 23, 2026
@stacknil
Copy link
Copy Markdown
Owner Author

@codex review
Focus on:

@stacknil stacknil merged commit 7fa2b9a into main Mar 23, 2026
2 checks passed
@stacknil stacknil deleted the codex/issue-2-alert-cooldown branch March 23, 2026 20:22
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alerts Alerting behavior and noise reduction enhancement New feature or request v0.2 Planned for v0.2 milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.2: add alert deduplication / cooldown to reduce noisy repeated alerts

1 participant