Do you need to file an issue?
Describe the bug
In the unified chat workspace, after an assistant reply finishes streaming, the reply sometimes disappears from the conversation view. If I then send another message, the model answers as if it only saw the first turn of the conversation. Switching to another conversation and back makes the missing replies reappear, and subsequent context works again.
Environment
- DeepTutor version: 1.5.4 (pip install,
deeptutor start)
- OS: Windows 11
- Browser: Chrome (latest)
- Deployment: local, single user
Steps to reproduce
Chat normally for several turns.
Occasionally, right after streaming completes, the assistant's reply disappears from the view.
Send another message -> the model responds using only the earliest turn(s) as context.
Switch to another conversation and back -> the full history reappears.
Investigation / likely root cause
I inspected the local data/user/chat_history.db. All messages (user + assistant) are persisted correctly — nothing is lost server-side, and all turns have status = completed.
However, several user messages have parent_message_id pointing to the previous user message instead of the assistant reply that came in between (anonymized real data):
-
msg 168 (user): parent = 166 (previous user msg), expected 167 (the assistant reply in between)
-
msg 172 (user): parent = 170 (previous user msg), expected 171 (the assistant reply in between)
-
msg 180 (user): parent = 178 (previous user msg), expected 179 (the assistant reply in between)
Consequences:
Context loss: _get_message_path_sync in deeptutor/services/session/sqlite_store.py builds the LLM context by walking the parent_message_id chain from the current message. Orphaned assistant replies are excluded — e.g. when msg 168 was sent, the model only saw the first round + the new question.
Display loss: the web UI renders only the active branch, so the orphaned reply is invisible until a full reload (switching conversations) re-fetches the session from the DB.
The frontend sends parentMessageId with each new message (verified in the compiled web bundle), so it appears the frontend sometimes fails to adopt the completed assistant message as the active leaf after streaming finishes, then attaches the next user message to a stale parent — creating an orphan branch.
Expected Behavior
After a turn completes, the assistant reply stays visible and becomes the active leaf; the next user message's parent_message_id points to it.
Related Module
Frontend/Web
Configuration Used
- Install: pip install deeptutor==1.5.4
- OS: Windows 11
- LLM provider/model:
- Otherwise default settings
Logs and screenshots
No response
Additional Information
Do you need to file an issue?
Describe the bug
In the unified chat workspace, after an assistant reply finishes streaming, the reply sometimes disappears from the conversation view. If I then send another message, the model answers as if it only saw the first turn of the conversation. Switching to another conversation and back makes the missing replies reappear, and subsequent context works again.
Environment
deeptutor start)Steps to reproduce
Chat normally for several turns.
Occasionally, right after streaming completes, the assistant's reply disappears from the view.
Send another message -> the model responds using only the earliest turn(s) as context.
Switch to another conversation and back -> the full history reappears.
Investigation / likely root cause
I inspected the local
data/user/chat_history.db. All messages (user + assistant) are persisted correctly — nothing is lost server-side, and all turns havestatus = completed.However, several user messages have
parent_message_idpointing to the previous user message instead of the assistant reply that came in between (anonymized real data):msg 168 (user): parent = 166 (previous user msg), expected 167 (the assistant reply in between)
msg 172 (user): parent = 170 (previous user msg), expected 171 (the assistant reply in between)
msg 180 (user): parent = 178 (previous user msg), expected 179 (the assistant reply in between)
Consequences:
Context loss:
_get_message_path_syncindeeptutor/services/session/sqlite_store.pybuilds the LLM context by walking theparent_message_idchain from the current message. Orphaned assistant replies are excluded — e.g. when msg 168 was sent, the model only saw the first round + the new question.Display loss: the web UI renders only the active branch, so the orphaned reply is invisible until a full reload (switching conversations) re-fetches the session from the DB.
The frontend sends
parentMessageIdwith each new message (verified in the compiled web bundle), so it appears the frontend sometimes fails to adopt the completed assistant message as the active leaf after streaming finishes, then attaches the next user message to a stale parent — creating an orphan branch.Expected Behavior
After a turn completes, the assistant reply stays visible and becomes the active leaf; the next user message's
parent_message_idpoints to it.Related Module
Frontend/Web
Configuration Used
Logs and screenshots
No response
Additional Information