agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Feature]: Add loop mechanism to recheck context after compression

Open kevinforge opened this issue 8 months ago • 1 comments

Problem Description

The compressIfNeeded() method currently returns true immediately after any compression strategy succeeds, without checking if the context still exceeds the threshold after compression.

Current Behavior

// Strategy 1-6 are tried sequentially
if (strategy1()) return true;  // Returns immediately, no recheck
if (strategy2()) return true;
...
// All strategies failed
log.warn("All compression strategies exhausted but context still exceeds threshold");
return false;

Issue Scenarios

1. Insufficient compression: Strategy 1 compresses tool calls, but context still exceeds threshold after compression

kevinforge avatar Mar 03 '26 05:03 kevinforge

PTAL @shiyiyue1102

LearningGp avatar Mar 04 '26 09:03 LearningGp