[PR #4447] [CLOSED] [Other] A tool call written as text is shown as not run #5053

Closed
opened 2026-11-07 16:32:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4447
Author: @xvcezrqpbxtpzblrt
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: agent/text-call-027


📝 Commits (1)

  • ed85bf8 [Other] A tool call written as text is shown as not run

📊 Changes

17 files changed (+237 additions, -15 deletions)

View changed files

📝 apps/host/server/agent/agent-bridge.mjs (+2 -0)
📝 apps/host/server/agent/events.mjs (+127 -5)
📝 apps/host/server/agent/preset.mjs (+1 -0)
📝 apps/host/server/agent/turn-guard.mjs (+3 -0)
📝 apps/host/src/locales/de.json (+5 -1)
📝 apps/host/src/locales/en.json (+5 -1)
📝 apps/host/src/locales/es.json (+5 -1)
📝 apps/host/src/locales/fr.json (+5 -1)
📝 apps/host/src/locales/ja.json (+5 -1)
📝 apps/host/src/locales/ko.json (+5 -1)
📝 apps/host/src/locales/pt.json (+5 -1)
📝 apps/host/src/locales/ru.json (+5 -1)
📝 apps/host/src/locales/zh.json (+5 -1)
📝 apps/host/tests/agent-events.test.mjs (+36 -0)
📝 apps/host/tests/agent-turn-guard.test.mjs (+14 -0)
📝 apps/host/tests/functional-fixes.test.mjs (+4 -1)
📝 apps/host/tests/helpers/scripted-worker.mjs (+5 -0)

📄 Description

## Problem

A model can put a tool call in the text channel instead of calling the tool. A real session (session-82188d88, 4 turns, 373 steps) has this at seq 1328:

{"type":"assistant/message","seq":1328,"data":{"message":{"role":"assistant",
 "content":[{"type":"reasoning","text":"Now compile..."},
            {"type":"text","text":"<tool_call>\n<function=compile>\n<parameter=command>\ncd \"D:\\下载器\\gui\"; python ..."}]}}}

Then step/end and urn/end follow: the command never ran and the turn was over. The chat showed the raw XML as the answer, so nothing told the person that the work was not done.

The same session has 3,772 ordinary ool/call events, so this is the model's slip, not a broken parser.

Result

  • A call written as text is taken out of the answer and shown as an ordinary tool card whose verb is "Not run — written as text", with the command and the tool's own name in it. The raw <tool_call> never reaches the chat, whether it arrives as one chunk or split across many.
  • A block that is not a well-formed call (for example an answer quoting the format) is left as text.
  • The turn ends with one plain sentence: it did not run, and saying "continue" sends it as a real call. That sentence is in all nine catalogs, as are the card's verb, effect and result.
  • The app's standing prompt gains one rule: call a tool, never write the call as text.

Validation

  • node --test tests/agent-events.test.mjs → 18 pass (3 new: whole call, split across chunks plus a quoted block, a half-written tag at the end of a message).
  • node --test tests/agent-turn-guard.test.mjs with the installed Harness, against a scripted model that answers with the same text → 10 pass, including the new end-to-end case: no raw XML in the deltas, one card with args.command = "python -m py_compile a.py", the note is the last delta, the turn ends normally.
  • node --test tests/languages-and-catalog.test.mjs tests/french-catalog.test.mjs tests/locale-gaps.test.mjs tests/functional-fixes.test.mjs → pass; the catalogs have the same 3,532 keys in every language and French keeps its typography.
  • Full host suite: 1,292 tests, 1,182 pass, 2 fail (the known Windows symlink EPERM cases, unchanged), 108 skipped.

Limits

  • The prompt rule is wording; the model can still ignore it. What does not depend on the model is the display and the sentence at the end of the turn.
  • The app does not run a call that arrives as text. Executing text the model wrote would bypass the approval card and the sandbox's own decision, so it is shown and the person is told.
  • The test ceiling for the prompt moves from 1,600 to 2,600 characters (1,688 now). Another open change that also raises it should take the higher number when the two meet.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4447 **Author:** [@xvcezrqpbxtpzblrt](https://github.com/xvcezrqpbxtpzblrt) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `agent/text-call-027` --- ### 📝 Commits (1) - [`ed85bf8`](https://github.com/Niko1221/Strata/commit/ed85bf85fe023554ed207de8a3d99a12f72b97b0) [Other] A tool call written as text is shown as not run ### 📊 Changes **17 files changed** (+237 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/server/agent/agent-bridge.mjs` (+2 -0) 📝 `apps/host/server/agent/events.mjs` (+127 -5) 📝 `apps/host/server/agent/preset.mjs` (+1 -0) 📝 `apps/host/server/agent/turn-guard.mjs` (+3 -0) 📝 `apps/host/src/locales/de.json` (+5 -1) 📝 `apps/host/src/locales/en.json` (+5 -1) 📝 `apps/host/src/locales/es.json` (+5 -1) 📝 `apps/host/src/locales/fr.json` (+5 -1) 📝 `apps/host/src/locales/ja.json` (+5 -1) 📝 `apps/host/src/locales/ko.json` (+5 -1) 📝 `apps/host/src/locales/pt.json` (+5 -1) 📝 `apps/host/src/locales/ru.json` (+5 -1) 📝 `apps/host/src/locales/zh.json` (+5 -1) 📝 `apps/host/tests/agent-events.test.mjs` (+36 -0) 📝 `apps/host/tests/agent-turn-guard.test.mjs` (+14 -0) 📝 `apps/host/tests/functional-fixes.test.mjs` (+4 -1) 📝 `apps/host/tests/helpers/scripted-worker.mjs` (+5 -0) </details> ### 📄 Description ## Problem A model can put a tool call in the text channel instead of calling the tool. A real session (session-82188d88, 4 turns, 373 steps) has this at seq 1328: ``` {"type":"assistant/message","seq":1328,"data":{"message":{"role":"assistant", "content":[{"type":"reasoning","text":"Now compile..."}, {"type":"text","text":"<tool_call>\n<function=compile>\n<parameter=command>\ncd \"D:\\下载器\\gui\"; python ..."}]}}} ``` Then step/end and urn/end follow: the command never ran and the turn was over. The chat showed the raw XML as the answer, so nothing told the person that the work was not done. The same session has 3,772 ordinary ool/call events, so this is the model's slip, not a broken parser. ## Result - A call written as text is taken out of the answer and shown as an ordinary tool card whose verb is "Not run — written as text", with the command and the tool's own name in it. The raw <tool_call> never reaches the chat, whether it arrives as one chunk or split across many. - A block that is not a well-formed call (for example an answer quoting the format) is left as text. - The turn ends with one plain sentence: it did not run, and saying "continue" sends it as a real call. That sentence is in all nine catalogs, as are the card's verb, effect and result. - The app's standing prompt gains one rule: call a tool, never write the call as text. ## Validation - `node --test tests/agent-events.test.mjs` → 18 pass (3 new: whole call, split across chunks plus a quoted block, a half-written tag at the end of a message). - `node --test tests/agent-turn-guard.test.mjs` with the installed Harness, against a scripted model that answers with the same text → 10 pass, including the new end-to-end case: no raw XML in the deltas, one card with `args.command = "python -m py_compile a.py"`, the note is the last delta, the turn ends normally. - `node --test tests/languages-and-catalog.test.mjs tests/french-catalog.test.mjs tests/locale-gaps.test.mjs tests/functional-fixes.test.mjs` → pass; the catalogs have the same 3,532 keys in every language and French keeps its typography. - Full host suite: 1,292 tests, 1,182 pass, 2 fail (the known Windows symlink `EPERM` cases, unchanged), 108 skipped. ## Limits - The prompt rule is wording; the model can still ignore it. What does not depend on the model is the display and the sentence at the end of the turn. - The app does not run a call that arrives as text. Executing text the model wrote would bypass the approval card and the sandbox's own decision, so it is shown and the person is told. - The test ceiling for the prompt moves from 1,600 to 2,600 characters (1,688 now). Another open change that also raises it should take the higher number when the two meet. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:32:20 +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
Niko1221/Strata#5053
No description provided.