[GH-ISSUE #6951] [Issue]: Raw <tool_call> text stays in streamed replies after the call runs #3896

Closed
opened 2026-10-21 06:08:32 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @SpicyMarinara on GitHub (Oct 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6951

Originally assigned to: @SpicyMarinara on GitHub.

Summary

With streaming on, a model that writes its tool calls as text (for example a KoboldCPP or Gemma setup that answers with <tool_call>{...}</tool_call>) gets the call run correctly, but the raw <tool_call>…</tool_call> text stays at the start of the saved reply.

Found while fixing #6945. It happens the same way with the Roleplay Rolls command, so it isn't new.

Expected behavior

Once Marinara recognises and runs a text tool call, that text shouldn't stay in the reply that is shown and saved.

Actual behavior

The reply starts with the raw <tool_call>{"name":"roll_dice",…}</tool_call>, followed by the rest of the message. It's clean with streaming off, or when the backend returns real (native) tool calls.

Where it comes from

  • openai.provider.ts streams the text to the client before it recognises the call. The recognition is around :1919, and textual-tool-call-parser.ts does the parsing.
  • generate.routes.ts (around :8100) has already added that text to the reply and never takes it back out.

Steps to reproduce

  1. Use a local custom connection whose model writes tool calls as text, with streaming on.
  2. In Roleplay, give a character roll_dice (either through Rolls, or through Function Calling once #6945 is in).
  3. Ask the character to roll. The dice card appears, and so does the raw <tool_call> text at the top of the message.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Oct 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6951 Originally assigned to: @SpicyMarinara on GitHub. ## Summary With streaming on, a model that writes its tool calls as text (for example a KoboldCPP or Gemma setup that answers with `<tool_call>{...}</tool_call>`) gets the call run correctly, but the raw `<tool_call>…</tool_call>` text stays at the start of the saved reply. Found while fixing #6945. It happens the same way with the Roleplay **Rolls** command, so it isn't new. ## Expected behavior Once Marinara recognises and runs a text tool call, that text shouldn't stay in the reply that is shown and saved. ## Actual behavior The reply starts with the raw `<tool_call>{"name":"roll_dice",…}</tool_call>`, followed by the rest of the message. It's clean with streaming off, or when the backend returns real (native) tool calls. ## Where it comes from - `openai.provider.ts` streams the text to the client before it recognises the call. The recognition is around `:1919`, and `textual-tool-call-parser.ts` does the parsing. - `generate.routes.ts` (around `:8100`) has already added that text to the reply and never takes it back out. ## Steps to reproduce 1. Use a local custom connection whose model writes tool calls as text, with streaming on. 2. In Roleplay, give a character `roll_dice` (either through Rolls, or through Function Calling once #6945 is in). 3. Ask the character to roll. The dice card appears, and so does the raw `<tool_call>` text at the top of the message. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:08:32 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3896
No description provided.