open-webui/backend
Classic298 cb5bb1e7b0 fix: preserve system prompt across context compaction
Context compaction dropped the user's system prompt and replaced it with the summary. compact_messages_for_request() treated messages[0] (the chat system prompt, re-prepended in middleware) as ordinary history: _find_compaction_boundary always folded it into the compacted slice, and _apply_latest_summary_checkpoint's messages[summary_idx:] slice cut it off on every subsequent turn. The function then returned only recent_messages with no system role, so add_or_update_system_message(..., append=True) had nothing to append to and inserted a summary-only system message instead. The system_prompt argument was used purely for token estimation, never to exempt it from compaction.

Pop a leading system message on entry and re-prepend it on every return path, so the summarizer never sees it and append=True appends the summary to the real system prompt as intended.

Fixes #26710
2026-07-02 21:22:48 +02:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
open_webui fix: preserve system prompt across context compaction 2026-07-02 21:22:48 +02:00
.dockerignore fix: litellm config issue 2024-02-24 22:35:11 -08:00
.gitignore refac 2024-09-06 04:59:20 +02:00
dev.sh refac 2026-03-24 19:43:30 -05:00
requirements-min.txt chore: bump Python backend dependencies, drop unused peewee (#25786) 2026-06-29 02:02:18 -05:00
requirements.txt chore: bump Python backend dependencies, drop unused peewee (#25786) 2026-06-29 02:02:18 -05:00
start.sh refac 2026-06-17 03:01:11 +02:00
start_windows.bat refac 2026-06-17 03:01:11 +02:00