Repository navigation
Commit 2ff3bed
fix(session): recover orphaned assistant messages on startup (#59)
When the server crashes or restarts while a session is actively
executing tool calls, in-memory session state is lost but the database
retains stale incomplete messages. This leaves sessions permanently
stuck in a 'Thinking' state with no way to recover.
Add Session.recover() that runs during InstanceBootstrap to:
- find assistant messages with no time.completed
- force running/pending tool parts to error status
- mark orphaned messages as completed
- emit bus events so connected frontends update
Closes anomalyco#19023
Co-authored-by: engineer <[email protected]>1 parent 950a9fe commit 2ff3bed
2 files changed
Lines changed: 580 additions & 521 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
0 commit comments