#6733·openhuman

[TinyAgents][Security] Streamed replies execute quoted tool-call markup: the stream scrubber ignores TextDialectRecovery::Auto

Author: M3gA-MindCreated Sep 28, 2026Updated Sep 28, 2026
Labelssecuritybugharnessagent-reliabilitypriority: p1

Risk

On the streamed path, tool-call markup that a model merely quotes is executed as a real tool call. That includes a model repeating instructions it found in fetched web content or a tool result. This happens even for native tool-calling models under the default TextDialectRecovery::Auto, which exists to prevent exactly this. openhuman streams its turns, so the protection is not in effect in production.

This is a product decision (see the trade-off below). This issue proposes no fix and no code.

What happens

  • tinyagents-harness runs the text-call stream scrubber (DeltaScrubber, agent_loop/model_call.rs:944, "Runs for every provider") on every streamed model call where tools were offered. It both strips markup from visible text and dispatches any call it can decode.
  • RunPolicy::text_dialect_recovery (Auto = off for a profile with native tool calling), and the harness fence guard that #6732 removes, are only consulted on the unary/batch path (recover_text_dialect_calls).
  • The I-2 regression test native_tool_calling_model_does_not_execute_quoted_text_dialect_markup (agent_loop/test.rs:3361) is unary, so it passes while the streamed path does the opposite.

Probe

Harness at tinyagents 3789696, tinytools 52e9ab1. Native model (tool_calling: true), default policy (Auto), streamed, max_model_calls: 1:

Assistant text (tool lookup offered) Calls dispatched
a JSON <tool_call> inside a bare ``` fence 1
the same call quoted in prose ("Wrap it like <tool_call>{…}</tool_call> in your reply.") 1
the same call inside a ```xml fence 0 (tinytools protects language-tagged fences)

The same replies on the unary path dispatch 0.

The trade-off (the decision needed)

  • Honour Auto on the stream (scrubber recovers nothing for native models when recovery resolves off). This closes quoted-call execution on the streamed path. It also disables native narrated-call recovery on the streamed path: a native model that writes its real call as text (DSML / <tool_call>, the #6562 class) would then have that call dropped.
  • Keep recovering on the stream. Native narrated calls keep working (and #6562's "never parsed" is only true on the unary path at this pin). But any quoted call outside a language-tagged fence executes. The remaining defences are tinytools' protected ranges (language-tagged fences only), the tool approval layer, and the prompt-injection screen (#6710).
  • Middle options include recovering on the stream only for tools with no side effects, or only for DSML / provider special-token grammars that do not occur in prose. The narrated-call design notes argued the second for exactly this reason: plain <tool_call> occurs in prose, and provider special tokens do not.

Whichever way this is decided, the unary and streamed paths should apply one policy. Related: #6562 (Auto unreachable on the unary path), #6732 (unary-only fence guard, being removed so both paths use tinytools' fence policy), #6723.