Normandy.Behaviours.Compactor.WindowManager (normandy v1.1.1)

View Source

Opt-in Compactor that wraps Normandy.Context.WindowManager's truncation strategies (:oldest_first | :sliding_window | :summarize).

Triggered at the turn's :steering boundary: builds a WindowManager whose max_tokens is the model's context window (from ctx.window, unless opts pins an explicit :max_tokens), then delegates to WindowManager.ensure_within_limit/2 — a no-op when already under budget.

opts flow straight to WindowManager.new/1 (:strategy, :reserved_tokens, :max_tokens). The :summarize strategy needs acc.client; if summarization fails it returns the original acc with %{compacted: false, error: reason} rather than crashing the turn.