OpenClaw Bug: Discord Channel Sessions Bypass Compaction
Severity: High
Discovered: 2026-02-07
Version: OpenClaw 2026.2.6-3 (85ed6c7)
Summary
Discord channel sessions accumulate tokens indefinitely, ignoring contextTokens limit and compaction settings. Eventually causes context overflow errors.
Expected Behavior
With config:
{
"contextTokens": 50000,
"compaction": {
"mode": "default",
"maxHistoryShare": 0.5
}
}
All sessions should:
- Send max ~50k tokens of history to the model
- Trigger compaction when history exceeds 25k tokens (50% of 50k)
- Never overflow the model's 200k context limit
Actual Behavior
Discord channel sessions grow unbounded:
| Session Type |
Total Tokens |
Status |
| Telegram DM |
63k |
✓ Compaction works |
| Cron sessions |
~25k |
✓ Compaction works |
| Discord #chat |
162k |
⚠️ No compaction |
| Discord #samantha-feed |
155k |
⚠️ No compaction |
Discord #chat eventually hit 211k tokens, causing:
400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 211803 tokens > 200000 maximum"}}
Impact
- Silent failure with "typing..." indicator stuck
- User waits 10+ minutes with no response
- Requires manual session reset via
/new or transcript deletion
- Recurring issue as all Discord channel sessions trend toward overflow
Steps to Reproduce
- Configure
contextTokens: 50000 and compaction.mode: default
- Use OpenClaw via Discord channels for several days
- Run
openclaw sessions list --json | jq '.sessions[] | {key, totalTokens}'
- Observe Discord channel sessions far exceeding contextTokens limit
Workaround
Created session-monitor.py cron that:
- Checks session token counts every 15 min
- Alerts at 80% of 200k limit
- Auto-prunes transcripts at 95%
Environment
- OpenClaw 2026.2.6-3 (85ed6c7)
- macOS Darwin 25.2.0 (arm64)
- Node v25.5.0
- Model: anthropic/claude-opus-4-5
OpenClaw Bug: Discord Channel Sessions Bypass Compaction
Severity: High
Discovered: 2026-02-07
Version: OpenClaw 2026.2.6-3 (85ed6c7)
Summary
Discord channel sessions accumulate tokens indefinitely, ignoring
contextTokenslimit and compaction settings. Eventually causes context overflow errors.Expected Behavior
With config:
{ "contextTokens": 50000, "compaction": { "mode": "default", "maxHistoryShare": 0.5 } }All sessions should:
Actual Behavior
Discord channel sessions grow unbounded:
Discord #chat eventually hit 211k tokens, causing:
Impact
/newor transcript deletionSteps to Reproduce
contextTokens: 50000andcompaction.mode: defaultopenclaw sessions list --json | jq '.sessions[] | {key, totalTokens}'Workaround
Created
session-monitor.pycron that:Environment