Skip to content

Core: exempt destinations should bypass consent queue and event buffer #15

@tyssejc

Description

@tyssejc

Problem

"Necessary" and "exempt" currently behave identically in the consent engine — both short-circuit isAllowed() to true. But they serve different purposes and should have different dispatch behavior.

"Exempt" destinations (error monitoring, observability) are operational — they need events immediately, not after a 2s buffer timer or consent queue drain. Current behavior adds unnecessary latency for Sentry errors and first-party analytics.

Proposed Behavioral Divergence

Aspect necessary exempt
Consent UI Visible Hidden
Consent queue Participates Bypasses
Event buffer Participates Bypasses — dispatch immediately
sentTo tracking Included Excluded (always receives, even on replay)

Implementation

In collector.ts, when track() is called:

  1. Before buffering, check if any destinations are exempt
  2. Dispatch to exempt destinations immediately (skip buffer)
  3. Buffer the event for consent-gated destinations as normal

This means exempt destinations get events with near-zero latency while consent-gated destinations still respect the queue and buffer.

Edge cases

  • Exempt destinations still go through transform() and send() — no shortcutting the destination interface
  • Events dispatched to exempt destinations should still emit destination:send for debug panel visibility
  • sentTo should NOT include exempt destinations, so they also receive the event on consent queue replay (they're observability sinks — seeing the event twice with different consent context is valuable)

Files

  • packages/core/src/collector.ts — split dispatch path in track() and dispatchToDestinations()
  • packages/core/src/collector.test.ts — new tests for immediate exempt dispatch

Context

See standard: agent-os/standards/core/necessary-vs-exempt.md (behavioral divergence section)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions