mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2284] [CLOSED] [Engine] preserve streamed tool aliases and confirm wrapper boundaries #3962
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3962
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2284
Author: @Tsury
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:fix/native-tool-parser📝 Commits (1)
9ae3b21fix(serve): preserve declared tool schemas through streamed aliases📊 Changes
6 files changed (+286 additions, -13 deletions)
View changed files
📝
serve/frontend.py(+42 -6)📝
serve/responses.py(+0 -4)➕
serve/test_native_tool_parser.py(+143 -0)📝
serve/test_responses.py(+30 -0)📝
serve/test_server.py(+7 -3)➕
serve/test_tool_call_unclosed.py(+64 -0)📄 Description
Problem and result
A declared namespaced tool written with its flat alias or padded name can lose its schema while streaming. An ambiguous alias can also route to the first namespace. Canonicalize only unambiguous aliases at the parser boundary, with exact declared names taking precedence, so names and parameter types agree across streamed and completed calls.
This refresh also fixes the quoted incomplete-wrapper example identified in review.
Format: <tool_call>... </function> and then I explain it.now stays text rather than becoming a completed call. A following actual call opener still separates concatenated calls without merging their arguments.Related discussion
Review: https://github.com/Niko1221/Strata/pull/2284#issuecomment-6184667095
Tracker reset/reopen instructions: https://github.com/Niko1221/Strata/pull/2284#issuecomment-6272913330
Approach
Keep alias resolution and schema lookup together in the shared parser, removing the redundant Responses-only alias map. Preserve native unknown names, literal markers and opt-in recovery batches.
Keep early streamed names and argument pieces, but hold their final JSON closing brace until the wrapper or next-call boundary confirms completion. Preserve native streaming recovery when output ends immediately after
</function>. Trailing prose cannot confirm an omitted wrapper closer. Responses marks an implicitly interrupted call incomplete; only the parser's completed call confirms it.Validation
Passed:
On Linux, Python 3.14.4, CPU-only mock engine, revision
915c6f2dd2e0edcf0998bd1fffb98c892388643e, rebased onto main9de04cd44e927a9a3df6bbc0e94fc1be8b844ba4:74 tests passed in 13.910s. Includes valid-call controls, byte/chunk boundaries, aliases and native schema types, concatenated calls, literal tags and quoted incomplete wrappers, and streamed/collected Chat Completions, Messages and Responses checks.
git diff --checkpassed.Failed:
Before this repair, both new HTTP regression methods failed against the original parser patch after rebase: Chat returned
tool_calls, and Responses returned a completed function call. The two pure-parser literal scenarios also reproduced the unexpected call across all 24 tested streaming/recovery/chunk subcases. No failures remain in the final focused command.Not run:
GPU inference, native client checks, or CUDA/HIP/SYCL builds. This contribution changes Python serving code only and makes no hardware or throughput claim.
Limits
An incomplete wrapper can still announce a tentative streamed tool name and partial arguments. Those arguments remain incomplete JSON; no completed tool call follows. Chat and Messages collected replies omit that tentative call. Responses retains an explicitly incomplete item beside the literal text. Fully buffering all call events would remove early argument streaming and is outside this fix.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.