Repository navigation
server: say how many tool-call envelopes a reply kept as text - #2814
Merged
Merged
Conversation
4 tasks done
ashhart
force-pushed
the
lead/kept-tool-calls
branch
from
November 12, 2026 02:15
df841f2 to
3994b04
Compare
This was referenced Nov 13, 2026
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
force-pushed
the
lead/kept-tool-calls
branch
from
November 14, 2026 00:07
1d326a7 to
e3ff9b6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).tensorfold.kept_tool_calls:unofferedandmalformedcounts, plusunoffered_namesas 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./metricsaddskept_tool_calls_unoffered_totalandkept_tool_calls_malformed_total.docs/api.mdno 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.Checks:
zig build test-tool-parse-host test-tool-visibility-http-host test-admission-hostpass, 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 --checkis clean, and the lean count is unchanged.Fixes #2800.