Skip to content

server: say how many tool-call envelopes a reply kept as text - #2814

Merged
ashhart merged 3 commits into
mainfrom
lead/kept-tool-calls
Nov 14, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/kept-tool-calls

Conversation

@ashhart

@ashhart ashhart commented Nov 10, 2026

Copy link
Copy Markdown
Owner

When a model writes a tool-call envelope the server can't accept (it names a tool the request didn't offer, or its markup is malformed), the server keeps it as text in content. Until now it only logged a count, so clients couldn't tell (#2800).

  • A reply that kept an envelope now carries tensorfold.kept_tool_calls: unoffered and malformed counts, plus unoffered_names as the model wrote them, capped at 8 names of 64 bytes each. It appears on the whole reply and on a stream's final chunk. A reply that kept nothing adds no fields.
  • /metrics adds kept_tool_calls_unoffered_total and kept_tool_calls_malformed_total.
  • docs/api.md no longer says calls to tools that weren't offered come back as tool calls: they're kept as text, and the new fields say so.
  • No new flag or setting. The parse's decisions are unchanged; it only records why it kept an envelope.

Checks: zig build test-tool-parse-host test-tool-visibility-http-host test-admission-host pass, 124/124. New tests cover an unoffered call and a malformed one, on the whole reply and on a stream, and check that a clean reply has no new fields and that the metrics counters move. zig fmt --check is clean, and the lean count is unchanged.

Fixes #2800.

  • Synthena (Ash's Agent)

A reply that keeps a tool-call envelope as text now carries
tensorfold.kept_tool_calls with unoffered and malformed counts and the
unoffered names the model wrote, capped at eight names of 64 bytes
each. /metrics counts both families. docs/api.md no longer claims an
unoffered call comes back as a tool call.
The four bad_tool cases (whole, stream, one call allowed, and its
stream) keep an envelope that names the unoffered tool "other", so
their tensorfold block now ends with kept_tool_calls: one unoffered,
none malformed, names ["other"]. No other expected reply changes; the
/metrics cases stay on the known-differences list, which they reach
before the new counters.
@ashhart
ashhart force-pushed the lead/kept-tool-calls branch from 1d326a7 to e3ff9b6 Compare November 14, 2026 00:07
@ashhart
ashhart merged commit 0aaa37d into main Nov 14, 2026
2 of 10 checks passed
@ashhart
ashhart deleted the lead/kept-tool-calls branch November 14, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: opt-in strict parsing mode (or explicit diagnostic signal) for native tool calls naming unoffered tools

1 participant