-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
[Bug]: History compaction strips all user/assistant turns on Qwen, leaving messages[] with only system → upstream 400 #86145
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
When OpenClaw's history compaction runs on long conversations with Qwen models (
Qwen-Long,Qwen-3-Coder-Plus), the outboundmessages[]sometimes ends up with norole: userorrole: assistantentries — onlyrole: system(or onlyrole: tool) survives.Qwen upstream rejects with HTTP 400:
Role must be user or assistant and Content length must be greater than 0Role specification invalidThe user-facing symptom (in deployments that route through a proxy that wraps 4xx) is a generic stream-failed message that hides the real error. Without proxy wrapping the operator sees the 400 directly, but the request is always invalid.
Environment
Qwen-Long(10M context),Qwen-3-Coder-Plus(1M context)Repro pattern
Qwen-LongorQwen-3-Coder-PlussoftThresholdmessages: [ { role: 'system', ... } ](and occasionally a trailingrole: toolblock), with every prior user/assistant turn goneWhy this looks distinct from already-tracked compaction issues
#32759(closed)#32759doesn't fire.#69756(closed)#74073(open)readSubagentOutputSuggested fix direction
After compaction transforms
messages[], the serializer should validate that at least one entry hasrole: 'user'orrole: 'assistant'before transmitting. If not, either:Option (a) is closer to graceful UX, option (b) is a clearer signal to the operator.
Offered
Happy to provide sanitized session jsonls + outbound request bodies if useful for a regression test. We hit this enough times in production that we can produce captures on demand.