Skip to content

fix: fix auto_compact truncating latest conversation content#110

Open
Zheisenbergy wants to merge 1 commit intoshareAI-lab:mainfrom
Zheisenbergy:Zheisenbergy-patch-1
Open

fix: fix auto_compact truncating latest conversation content#110
Zheisenbergy wants to merge 1 commit intoshareAI-lab:mainfrom
Zheisenbergy:Zheisenbergy-patch-1

Conversation

@Zheisenbergy
Copy link

Related Issue

Closes #109

Problem Description

In the auto_compact function of s06_context_compact.py, the code uses [:80000] to intercept the beginning of the string.
Since the messages list is stored in chronological order (oldest first, newest last), this causes the latest tool execution results and task status to be discarded directly.
The generated summary loses current progress, making the agent "amnesiac" after compression.

Fix

Changed string interception from start to end:

# Before
conversation_text = json.dumps(messages, default=str)[:80000]
# After
conversation_text = json.dumps(messages, default=str)[-80000:]

fix: repair auto_compact truncating latest messages bug
@vercel
Copy link

vercel bot commented Mar 21, 2026

@Zheisenbergy is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: auto_compact 截取文本时丢弃最新对话,导致摘要丢失当前状态

1 participant