[PR #4670] [Engine] serve: accept the plural ask_user_questions spelling of a declared ask_user_question tool #5133

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4670
Author: @NukeDoggo
Created: 10/30/2026
Status: 🔄 Open

Base: main ← Head: feat/ask-user-question-alias


📝 Commits (1)

  • 01fa82e [Engine] serve: accept the plural ask_user_questions spelling of a declared ask_user_question tool

📊 Changes

2 files changed (+125 additions, -18 deletions)

View changed files

📝 serve/frontend.py (+71 -16)
📝 serve/test_tool_call_envelope.py (+54 -2)

📄 Description

Problem and result

Observed with DeepSeek Harness 0.2.1-rc.2 on 2026-10-23 (Qwen3.8-Flash-Next behind a local
Strata build): the harness declares the question tool ask_user_question with a required
questions array, and the model wrote <tool_call><function=ask_user_questions>…. Under the
declared-only rule (#3075) Strata returned the block as plain text with finish_reason stop, so the
harness showed the raw XML instead of its question dialog and the turn had no tool call.

Replaying that exact model output on 870aedd9 reproduces it: no tool call, all 1285 characters
returned as text. With this change the same output yields one tool call named ask_user_question,
and only the 219 characters of prose before the call remain as text. A different name
(ask_user_question_v2), a missing required argument, or a non-array questions value still stays
text.

None. This is a small compatibility fix. An issue can be opened and linked if the maintainers want
the scope agreed first.

Approach

A one-entry alias table (ask_user_questions -> ask_user_question) that applies only when:

  • the request declares the singular tool ask_user_question, and
  • that tool's schema requires a questions property of type array.

The call is parsed against that schema and returned under the declared name. While such a call
streams, no tool_start/tool_args events are emitted until the complete arguments validate; a
call that fails validation falls back to text. Declared names always win over the alias, and no
other names are guessed.

The mechanism is routed through the existing alias lookup (self.aliases / _callable), so it
composes with the namespace spellings of PR #3556 / #3796 instead of adding a second path.

Validation

Passed:

  • Replay of the observed model output on 870aedd9 (no change applied): 0 tool calls, 1285 characters
    of content, raw XML present — the bug reproduces on the base revision.
  • Replay on this change: 1 tool call named ask_user_question (arguments: questions), 219
    characters of prose, no raw XML — with stream_tools both False and True.
  • python -m pytest serve/test_tool_call_envelope.py serve/test_native_tool_parser.py serve/test_tool_call_unclosed.py serve/test_frontend.py serve/test_tool_name_alias.py serve/test_tool_name_space.py serve/test_parser_call_scan.py serve/test_parser_hold.py serve/test_parser_track.py serve/test_reasoning_tools.py serve/test_structured.py serve/test_responses.py -q
    -> 157 passed (revision 870aedd9 + this change, Windows, Python 3.12.3).
  • python -m pytest serve/test_server.py -q
    -> 356 passed, 3 skipped (same revision).

Failed:

  • none observed.

Not run:

  • No live end-to-end re-prompt with a running model server (none was running when this was
    written); the replay above feeds the exact bytes the model produced.
  • The rest of the serve/ suite was not re-run after this change; the changes are limited to the
    tool-call parser and its tests.
  • No CUDA/HIP/SYCL/Metal build is needed (Python-only change).

Limits

  • Covers only the pluralized spelling of ask_user_question; a general spelling-fuzzy match is not
    attempted. If a generic rule is preferred (for example accepting a trailing s on any declared
    tool whose schema matches), this can be generalized in review.
  • The alias is a fixed table entry, not a heuristic. The observation above is one harness/model
    pair; the same code path applies to any client that declares a tool whose name a model may
    pluralize.

🔄 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/4670 **Author:** [@NukeDoggo](https://github.com/NukeDoggo) **Created:** 10/30/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/ask-user-question-alias` --- ### 📝 Commits (1) - [`01fa82e`](https://github.com/Niko1221/Strata/commit/01fa82e9a49623892559c608b8c642bc5e0a3ad0) [Engine] serve: accept the plural ask_user_questions spelling of a declared ask_user_question tool ### 📊 Changes **2 files changed** (+125 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `serve/frontend.py` (+71 -16) 📝 `serve/test_tool_call_envelope.py` (+54 -2) </details> ### 📄 Description ## Problem and result Observed with **DeepSeek Harness 0.2.1-rc.2** on 2026-10-23 (Qwen3.8-Flash-Next behind a local Strata build): the harness declares the question tool `ask_user_question` with a required `questions` array, and the model wrote `<tool_call><function=ask_user_questions>…`. Under the declared-only rule (#3075) Strata returned the block as plain text with `finish_reason` stop, so the harness showed the raw XML instead of its question dialog and the turn had no tool call. Replaying that exact model output on 870aedd9 reproduces it: no tool call, all 1285 characters returned as text. With this change the same output yields one tool call named `ask_user_question`, and only the 219 characters of prose before the call remain as text. A different name (`ask_user_question_v2`), a missing required argument, or a non-array `questions` value still stays text. ## Related discussion None. This is a small compatibility fix. An issue can be opened and linked if the maintainers want the scope agreed first. ## Approach A one-entry alias table (`ask_user_questions` -> `ask_user_question`) that applies only when: - the request declares the singular tool `ask_user_question`, and - that tool's schema requires a `questions` property of type array. The call is parsed against that schema and returned under the declared name. While such a call streams, no `tool_start`/`tool_args` events are emitted until the complete arguments validate; a call that fails validation falls back to text. Declared names always win over the alias, and no other names are guessed. The mechanism is routed through the existing alias lookup (`self.aliases` / `_callable`), so it composes with the namespace spellings of PR #3556 / #3796 instead of adding a second path. ## Validation **Passed:** - Replay of the observed model output on 870aedd9 (no change applied): 0 tool calls, 1285 characters of content, raw XML present — the bug reproduces on the base revision. - Replay on this change: 1 tool call named `ask_user_question` (arguments: `questions`), 219 characters of prose, no raw XML — with `stream_tools` both False and True. - `python -m pytest serve/test_tool_call_envelope.py serve/test_native_tool_parser.py serve/test_tool_call_unclosed.py serve/test_frontend.py serve/test_tool_name_alias.py serve/test_tool_name_space.py serve/test_parser_call_scan.py serve/test_parser_hold.py serve/test_parser_track.py serve/test_reasoning_tools.py serve/test_structured.py serve/test_responses.py -q` -> 157 passed (revision 870aedd9 + this change, Windows, Python 3.12.3). - `python -m pytest serve/test_server.py -q` -> 356 passed, 3 skipped (same revision). **Failed:** - none observed. **Not run:** - No live end-to-end re-prompt with a running model server (none was running when this was written); the replay above feeds the exact bytes the model produced. - The rest of the `serve/` suite was not re-run after this change; the changes are limited to the tool-call parser and its tests. - No CUDA/HIP/SYCL/Metal build is needed (Python-only change). ## Limits - Covers only the pluralized spelling of `ask_user_question`; a general spelling-fuzzy match is not attempted. If a generic rule is preferred (for example accepting a trailing `s` on any declared tool whose schema matches), this can be generalized in review. - The alias is a fixed table entry, not a heuristic. The observation above is one harness/model pair; the same code path applies to any client that declares a tool whose name a model may pluralize. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5133
No description provided.