fix: unconditional lazy hydration in get_session
Drop the message_count > 0 guard — if it's 0 in the DB (stale metadata, race condition, failed persist), the session stays empty and the model gets no conversation history. The UI history endpoint has its own DB fallback, so messages display correctly but never reach the LLM. Now hydrate from DB whenever history is empty, regardless of message_count. Trade-off: one extra DB query for genuinely empty sessions (rare).
This commit is contained in:
parent
60452712b2
commit
20c7d7e6b7
1 changed files with 1 additions and 1 deletions
|
|
@ -382,7 +382,7 @@ class SessionManager:
|
||||||
else:
|
else:
|
||||||
cached = self.sessions[session_id]
|
cached = self.sessions[session_id]
|
||||||
# Lazy hydrate: metadata-only entries get their messages on first read.
|
# Lazy hydrate: metadata-only entries get their messages on first read.
|
||||||
if not cached.history and getattr(cached, "message_count", 0) > 0:
|
if not cached.history:
|
||||||
self._load_session_from_db(session_id)
|
self._load_session_from_db(session_id)
|
||||||
|
|
||||||
# Keep model/endpoint metadata fresh. Endpoint deletion can clear the
|
# Keep model/endpoint metadata fresh. Endpoint deletion can clear the
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue