Skip to content

fix(strata): count tool-call-only answers in the community bench - #223

Merged
shuk777 merged 1 commit into
Edge0-AI:mainfrom
lxove:fix/bench-tool-call-answers
Nov 16, 2026
Merged

shuk777 merged 1 commit into
Edge0-AI:mainfrom
lxove:fix/bench-tool-call-answers

Conversation

@lxove

@lxove lxove commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Fixes #222

tools/strata_bench.py reports FAILED: no token came back for agent-session turns that the model answers with only a tool call. The agent test offers four tools. With thinking off, such an answer streams nothing but delta.tool_calls:

finish_reason: tool_calls   completion_tokens: 26   delta fields with data: {'role': 1, 'tool_calls': 8}

chat() only counts delta.content and delta.reasoning_content as a token, so first stays None, digest() marks the turn not ok, and the session stops there. The engine did answer: the failed turns had 26–49 generated tokens.

I hit this with edge0-145b on an RTX 3090 at a 16 GiB VRAM budget. 2 of 3 agent sessions failed this way in one run and 3 of 3 in another. At 24 GiB the model happened to answer in text. The same line is in upstream Strata, and the symptom appears in an RX 9070 XT report there (Niko1221/Strata#2876, closed in the tracker reset).

The fix follows the semantics agreed in #222:

  • the first-token time is set by the first non-empty delta of any kind (content, reasoning_content, tool_calls);
  • pieces keeps counting text only, so generated_tokens still falls back to the engine's usage and never to the number of tool-call chunks.

The turn's text stays content only, and the session already falls back to "Understood." for an empty reply.

Area

  • Engine, CLI or server (edge0-infer/)
  • Model asset tools (edge0-infer/tools/assets/)
  • Chat app examples (edge0-infer/examples/)
  • Model docs (docs/)
  • Other — edge0-strata/tools/strata_bench.py (the community bench)

How was it tested?

  • New test SuiteTests.test_a_tool_call_answer_counts_as_an_answer: FakeStrata gets a mode that answers requests offering tools with tool_calls deltas only. It fails before the change with [{'where': 'agent', 'error': 'no token came back'}] and passes after.
  • New test SuiteTests.test_tool_call_chunks_are_not_counted_as_text: chat() on a tool-call-only answer sets first, and pieces stays 0 (it would be 12 if tool-call chunks were counted).
  • python -m unittest test_strata_bench in edge0-strata/tools/: 24 tests OK.
  • Against the real engine (edge0-strata 0.1.55, Edge0-145B-q3k, Linux, RTX 3090), measured with the first commit: a tool-call only answer now counts as an answer: ok, first token after 613 ms, 26 generated tokens (from the engine's usage), empty text. The follow-up commit only changes pieces, which this turn does not use because the engine reported usage.

Checklist

  • ctest --preset cpu -L "L0|L1" passes locally in edge0-infer/ (engine changes) — not applicable: no engine change
  • Ran the higher test levels this change affects (see edge0-infer/docs/testing.md) — the bench's own unit tests, plus the real-engine check above
  • Added/updated tests for new behavior
  • Updated relevant docs / READMEs (incl. translations if user-facing) — not needed: no user-facing change beyond the bench no longer failing these turns

The agent session of tools/strata_bench.py offers four tools. When the
model answers a turn with a tool call alone, the engine streams only
`delta.tool_calls` (no content, and no reasoning with thinking off), so
chat() never set the first-token time and the turn was reported as
"no token came back", which ended the session.

Count a tool_calls delta as an answer as well. The text of the turn
stays the content only; the session already continues with
"Understood." when a turn has no text.

Test: a fake-server mode that answers requests offering tools with
tool_calls deltas only; the agent session now completes all turns.
@lxove

lxove commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for confirming in #222. I pushed the agreed semantics as a separate commit on top, so the change is easy to review:

  • the first non-empty delta of any kind (content, reasoning_content, tool_calls) sets the first-token time
  • pieces counts text only, so generated_tokens falls back to the engine's usage and never to tool-call chunks

The fake-server test is kept, and a new test, test_tool_call_chunks_are_not_counted_as_text, covers the second point. It fails on the first commit with pieces == 12. Updated description to match.

I'm happy to squash into one commit if you prefer.

@shuk777 shuk777 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shuk777
shuk777 merged commit b2db234 into Edge0-AI:main Nov 16, 2026
1 check passed
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.

strata_bench.py: agent session fails with "no token came back" when a turn is answered with only a tool call

2 participants