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). |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| atomic_io.py | ||
| auth.py | ||
| constants.py | ||
| database.py | ||
| exceptions.py | ||
| log_safety.py | ||
| middleware.py | ||
| models.py | ||
| platform_compat.py | ||
| session_manager.py | ||