Skip to content

Commit fc60ce3

Browse files
committed
fix: use -inf sentinel for guardrail timestamps to prevent false blocks in fresh containers
1 parent 8cfee9c commit fc60ce3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/smart_capture/guardrails.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GuardrailChain:
2525
def __init__(self, config_mgr):
2626
self._config = config_mgr
2727
self._lock = threading.Lock()
28-
self._last_global_fire: float = 0.0
28+
self._last_global_fire: float = float("-inf")
2929
self._last_trigger_fire: dict[str, float] = {}
3030
self._hourly_fires: list[float] = []
3131
self._trigger_match_history: dict[str, list[float]] = {}
@@ -86,7 +86,7 @@ def check_batch(self, trigger_results):
8686

8787
# 4. Per-trigger cooldown
8888
trigger_cd = int(self._config.get("sc_trigger_cooldown", 900))
89-
last_fire = self._last_trigger_fire.get(trigger_key, 0.0)
89+
last_fire = self._last_trigger_fire.get(trigger_key, float("-inf"))
9090
if trigger_cd > 0 and (now - last_fire) < trigger_cd:
9191
remaining = int(trigger_cd - (now - last_fire))
9292
results.append((trigger, event, False,

0 commit comments

Comments
 (0)