-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Bug Description
When using EventsCompactionConfig with RestatePlugin +
RestateSessionService,
the compaction event is never persisted to Restate K/V. Compaction fires an LLM
summarization call as expected, but the result is silently discarded every time,
regardless of the configured compaction_interval.
Root Cause
In google/adk/runners.py, the execution order is:
_exec_with_plugin(...)runs and closes
→after_run_callback→flush_session_state()→ session persisted to Restate
K/V_run_compaction_for_sliding_window(...)runs
→ callssession_service.append_event(session, compaction_event)
→ appends to in-memory session only — no second flush
flush_session_state is called before compaction, so the compaction event is
never
written to Restate K/V. On the next invocation, get_session() loads a session
without the compaction event, so last_compacted_end_timestamp is always 0.0
and all historical invocations are treated as "new" on every run.
Observed Behavior
Compaction triggers on schedule per compaction_interval, makes a real LLM
summarization call, but the resulting compaction event is never saved. On the
next invocation, the same events are compacted again — burning LLM credits with
no effect. The session grows unboundedly as if compaction was never configured.