Expand description
RFC 1 (issue #20) dedup window + cycle suppression engine.
Pure logic, no IO. AgentHarness::handle_trigger (follow-up sub-PR) wraps this engine
into the agent loop entrypoint, but the dedup / cycle decisions live here so they are
independently testable.
Behaviour matches RFC 1 §5:
- Dedup window: same
idempotency_keyseen twice withinTriggerRuntimeConfig::dedup_window(default 5 minutes) → outcome depends on the first trigger’sReplacementPolicy(per RFC 1 §11 fixed decision #4 — sources declare per-event; the runtime trusts the first arrival’s declaration to set the window’s collapse semantics). - Cycle suppression: when the same
trace_idexceedsTriggerRuntimeConfig::cycle_hop_limit(default 5) → forcedEvaluationOutcome::CycleSuppressed. Each accepted trigger bumps the per-trace hop counter; the runtime callsTriggerRuntime::record_follow_up_hopbefore spawning sub-triggers that share the parent’s trace.
Structs§
- Trigger
Runtime - In-memory dedup + cycle registry shared across all
NotificationHooksources for a single agent / daemon. Cloning is cheap; the actual state lives behind anArc<Mutex>. - Trigger
Runtime Config - Tunable knobs for
TriggerRuntime. The runtime never mutates these; callers can swap them viaTriggerRuntime::neworTriggerRuntime::with_config. - Trigger
Runtime Snapshot - Point-in-time view of the runtime’s dedup + cycle bookkeeping. Cheap to copy; surfaced
via
TriggerExecutor::notification_status_snapshotfor status banners and/triggersrendering.
Enums§
- Evaluation
Outcome - Result of running a
TriggerthroughTriggerRuntime::evaluate. Subsequent runtime state (state machine transitions, session audit, permission evaluator) consumes this.