fix: 12h cooldown before reopening manually closed host_silence (0.9.9)

Track resolved_by on problems; suppress scan/ingest recreate after manual
resolve; reopen same problem after cooldown; auto-close via heartbeat unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-11 10:33:55 +10:00
parent befaf86bf4
commit 7df718eed3
11 changed files with 285 additions and 7 deletions
+18 -2
View File
@@ -10,6 +10,7 @@ from app.models import Event, Problem, ProblemEvent
from app.services.host_health import HEARTBEAT_TYPE
from app.services.problem_rules import (
RuleMatch,
RULE_HOST_SILENCE,
build_fingerprint,
pick_rule_match,
resolve_host_silence_problems,
@@ -43,7 +44,21 @@ def _append_event(db: Session, problem: Problem, event: Event) -> None:
def open_or_append_problem(
db: Session, event: Event, match: RuleMatch
) -> tuple[Problem, bool]:
) -> tuple[Problem | None, bool]:
if match.rule_id == RULE_HOST_SILENCE:
from app.services.host_silence_scan import open_or_refresh_host_silence_problem
ref = event.occurred_at
if ref.tzinfo is None:
ref = ref.replace(tzinfo=timezone.utc)
problem, created = open_or_refresh_host_silence_problem(
db, event.host_id, match, now=ref
)
if problem is None:
return None, False
_append_event(db, problem, event)
return problem, created
fingerprint = build_fingerprint(
event.host_id,
match.correlation_type,
@@ -98,4 +113,5 @@ def maybe_create_problem(db: Session, event: Event) -> tuple[Problem | None, boo
if match is None:
return None, False
return open_or_append_problem(db, event, match)
problem, created = open_or_append_problem(db, event, match)
return problem, created