Commit fb8c7ce
committed
🤖 fix: prevent queued message amnesia by flushing partial before tool-call-end
When a queued message is sent after tool-call-end, the model needs to see
the complete assistant response including tool results. Previously, there
was a race condition where tool-call-end was emitted before the partial
file was written, causing commitToHistory to read stale data.
The fix ensures partial.json is flushed to disk BEFORE emitting the
tool-call-end event, so listeners (like sendQueuedMessages) see the
complete tool result when they read via commitToHistory.
Changes:
- Make completeToolCall async
- Await flushPartialWrite before emitting tool-call-end
- Update callers to await the async method
_Generated with `mux`_1 parent a2a417e commit fb8c7ce
2 files changed
+24
-144
lines changed
0 commit comments