GitHub user sangkyoonnam added a comment to the discussion: [Discussion] 
Context compaction for Flink Agents

On question 6, I'd support opening the group A PR, with replay tests for the 
round cap. For the C and D follow-ups, I'd add coverage for conditional call 
order and the decisions that trigger them.

The built-in chat loop uses durable ids that don't depend on the messages: 
`chat` in both languages (Python since #1240), or `chat:<router>:<candidate>` 
for a routed Java attempt. Ordinary tool executions use `tool-call:<call_id>`. 
When an action invocation replays from recoverable completed call records, 
prompt-only masking or truncation keeps them matched as long as call order and 
ids don't change. A call with no recoverable outcome may run against the 
transformed prompt. A round cap changes control flow, so it's the option I'd 
test across a restart.

Each tool round is its own event-triggered action invocation, and results are 
matched by position within one invocation. An id mismatch clears that slot and 
every later recorded result in the invocation 
(`matchNextOrClearSubsequentCallResult`, which Python's 
`_try_get_cached_result` also calls), so calls reached after it can't reuse 
those outcomes. A summariser or judge call therefore needs a stable id of its 
own, and its trigger has to reach the same decision on replay, or the decision 
itself has to be recorded. `ChatResult` has optional usage, but the tool loop 
keeps only `response.message` in its history, so a budget built on usage 
accumulated across rounds needs its own recoverable accounting.

The event log is now the Trace Log (#1219). Recording each compaction step 
there, with what was masked or summarized, could help a trace explain why the 
prompt the model saw differs from the stored messages.

I haven't run a failover with compaction enabled; this comes from reading the 
durable-execution path on `main`. Happy to help with replay tests for group C.

GitHub link: 
https://github.com/apache/flink-agents/discussions/1202#discussioncomment-18971406

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to