mirror of
https://github.com/open-webui/computer.git
synced 2026-11-05 01:17:24 +00:00
[GH-ISSUE #162] bug: repeated context compaction can drop every user message and break Qwen/vLLM #82
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/computer#82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @calderanicola on GitHub (Jul 23, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/162
Summary
On cptr 0.9.12, a long agentic Chat Completions task can fail after repeated automatic context compaction when the retained
keep_zonecontains onlyassistantandtoolmessages.With a Qwen model served by vLLM through LiteLLM, the next request fails with:
Raising
chat.compact_token_thresholdonly delays the failure.Environment
hosted_vllmReproduction
A sanitized real trace reproduced the second compaction as:
Root cause
In
cptr/utils/chat_task.py:_find_safe_split()protects tool-call/tool-result boundaries and keeps at least two messages.keep_zonecontains a top-leveluserturn.messages = keep_zone.api_messagesis then sent to the provider unchanged with respect to roles.For a task that began with one user prompt followed by many assistant/tool iterations, repeated 40% retention can eventually remove every user turn.
Expected behavior
Every compacted continuation sent through Chat Completions should contain a real top-level user anchor, while preserving the retained assistant/tool ordering.
Suggested fix
Add a small invariant immediately before constructing
ChatCompletionForm:This keeps normal histories unchanged and adds one synthetic continuation turn only when compaction removed every user message.
Regression tests