diff options
| author | Adam Malczewski <[email protected]> | 2026-06-28 18:34:26 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-28 18:34:26 +0900 |
| commit | 7f1381c4452846e5a2689d868ab0ee2bc90042c9 (patch) | |
| tree | d62ca06e1ab670ef02ffffa680f77310f9b89d23 /packaging/[email protected] | |
| parent | 254d3c2a1a564a96d455c61ae988eddcf89e1429 (diff) | |
| download | dispatch-7f1381c4452846e5a2689d868ab0ee2bc90042c9.tar.gz dispatch-7f1381c4452846e5a2689d868ab0ee2bc90042c9.zip | |
fix(conversation-store): msgIdx collision merges messages across turns + reconcile drops thinking-only messages
Root cause of tool-calls-in-thinking bug: append() assigns msgIdx as a LOCAL
index (reset to 0 per call), but load() grouped chunks by msgIdx alone. Since
the orchestrator persists messages one at a time (append([user]) at turn start,
then append([assistant, ...toolResults]) per step), all single-message appends
share msgIdx=0 and collapse into one giant user-role message. The model loses
its prior assistant responses and tool-call history, falls back to text-based
tool-call syntax inside reasoning_content, and the turn ends with finish_reason
stop (no structured tool_calls detected).
Fix 1 (store.ts load()): split message boundaries on role change too, not just
msgIdx. Handles the alternating user/assistant/tool pattern correctly.
Fix 2 (reconcile.ts hasContent): include thinking chunks as valid content so
thinking-only assistant messages are not silently dropped on load. The buggy
seq-14 output (assistant, thinking-only) was being deleted by reconcile,
destroying evidence of the bug.
Verified: load() on the affected conversation now produces 9 correct messages
(was 3 merged). All 1999 tests pass. See notes/tool-call-in-thinking-bug.md.
Diffstat (limited to 'packaging/[email protected]')
0 files changed, 0 insertions, 0 deletions
