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

[Bug]: the sixth Compression strategy for current round makes llm response empty

Open tcsp opened this issue 10 months ago • 2 comments

AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.

Describe the bug the sixth Compression strategy for current round makes llm response empty.

To Reproduce Steps to reproduce the behavior:

  1. enbale the AutoContextMeomry for reactAgent
  2. chat and make context tokens greater than maxTokens in config
  3. the AutoContextMemory trigger the sixth compression strategy
  4. the compressed result returned normally
  5. however, when the compressed result was put back into the context and a reasoning request was made again, an empty result was returned

reasoning request response just like:

{"choices":[{"delta":{"content":"","role":"assistant"},"finish_reason":"stop","index":0}],"created":1768463958,"id":"021768463956351c97886b1884070617909158979a5aac856af9d","model":"doubao-seed-1-8-251228","service_tier":"default","object":"chat.completion.chunk","usage":null}

{"choices":[],"created":1768463958,"id":"021768463956351c97886b1884070617909158979a5aac856af9d","model":"doubao-seed-1-8-251228","object":"chat.completion.chunk","usage":{"completion_tokens":0,"prompt_tokens":26762,"total_tokens":26762,"prompt_tokens_details":{"cached_tokens":0},"completion_tokens_details":{"reasoning_tokens":0}}}

Expected behavior First, the reasoning request response should not be empty.

Second, I would rather agentscope could provide a switch control to skip the sixth compression policy.

Environment (please complete the following information):

  • AgentScope-Java Version: 1.0.7
  • Java Version: 17

tcsp avatar Jan 15 '26 12:01 tcsp

I traced this through the current-round compression path in AutoContextMemory and confirmed the likely failure mode: strategy 6 currently replaces the post-user tool/result sequence with an ASSISTANT summary message, so the next reasoning request can end up sending a conversation that already ends with assistant content instead of a tool/result turn. I'm working on a fix that preserves the follow-up reasoning turn shape after compression and adds regression coverage for the compressed-current-round flow.

Alexxigang avatar Apr 06 '26 10:04 Alexxigang

Opened a fix here: https://github.com/agentscope-ai/agentscope-java/pull/1146

It preserves a non-assistant follow-up turn after strategy-6 current-round compression, teaches AutoContextMemory to ignore the synthetic summary as a real user turn during internal scans, and adds regression tests for the follow-up reasoning path.

Alexxigang avatar Apr 06 '26 11:04 Alexxigang