Repository navigation
fix(streaming): prevent text truncation before tool calls in think filter and extractors - #256
Conversation
|
Hi @NeoMetric, thanks for this. I pulled the branch and ran the full unit test suite locally (512 pass, 0 fail), and I also traced the fix against our past work on think tags and tool call flushing (issues #42, #50, #72 in docs/issues). The root cause analysis checks out: the unconditional 8-char tail buffer in Two small things before we can merge:
One really minor thing, not blocking: the counts in the ARCHITECTURE-MAP test table ("38 files, 497 cases") are slightly off from what I'm seeing locally, so feel free to bump those while you're in there. Nice catch on this one by the way, the "exactly 8 characters" symptom was a fun one to trace. Once the two items above are in, this is good to merge. |
…lter and extractors Avoid unconditional 8-character tail buffering in ThinkTagFilter by only buffering when the chunk tail starts with an opening or closing think tag prefix. Flush think filter carry prior to emitting tool calls in both OpenAI and Anthropic extractors so text preceding tool calls is not delayed or split across widget cards. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dfee685 to
fef3a59
Compare
📝 What does this change?
Prevents text preceding tool calls from being truncated by 8 characters during streaming with reasoning models (e.g. MiniMax Mimo, DeepSeek). ThinkTagFilter now only buffers tail characters if they match an opening or closing think tag prefix, and both OpenAI and Anthropic response extractors flush any pending think filter carry as visible text before emitting tool calls.
🧪 How did you test it?
src/test/thinkTags.test.tscovering ordinary text preservation, partial tag boundary detection, and unclosed tag flushes.src/test/extractors.test.tsverifying think tag carry is flushed as visible text prior to tool calls in both OpenAI and Anthropic extractors.npm run lint— all 7 checks passed (Editorconfig, ESLint, Markdown, Prettier, Shellcheck, TypeScript, Tests).✅ Checklist
npm run compilepassesnpm run lintpassesnpm testpassesnpm run packageproduces a VSIX