mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3340] [Other] serve: accept pi's three thinking-budget field names as aliases #4579
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#4579
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/3340
Author: @shizhx
Created: 10/20/2026
Status: 🔄 Open
Base:
main← Head:serve-thinking-budget-aliases-v2📝 Commits (1)
2b33646serve: accept the three thinking-budget field names (pi's thinkingTokenBudgetField) as aliases📊 Changes
3 files changed (+49 additions, -1 deletions)
View changed files
📝
docs/DETAILS.md(+5 -1)📝
serve/server.py(+9 -0)📝
serve/test_server.py(+35 -0)📄 Description
Problem and result: pi's
compat.thinkingTokenBudgetFieldonly allowsthinking_token_budget(vLLM),thinking_budget(Qwen/DashScope/SGLang) andthinking_budget_tokens(llama.cpp), but #123's thinking budget was only readablefrom
reasoning_budget_tokens, so a pi client's budget was silently ignored - themodel thought its full length instead of being wrapped up at N tokens. After this
change all three names work exactly like
reasoning_budget_tokenson the threechat routes. Related: issue #123 #984.
Summary
One commit, 3 files, +49/-1 (
serve/server.pyalias copy,serve/test_server.py4 tests,
docs/DETAILS.mdthe budget bullet). A request that sends none of thethree names goes through the added lookups unmodified: no mutation, no config,
engine or response change, so the default path is unchanged.
Evidence
Before: on base
e88ee39dthe three names are silently ignoredAfter:
e88ee39d+ this commitlive on :4000 (real IQ3_S model, 2x RTX 2080 Ti), prompt "What is 17*23? ...",
budget 20:
Each alias wraps the thinking at 20 (wrap-up marker, answer after, finish stop)
exactly like the native field; the response shape is unchanged.
Approach
The alias copy happens once, at the request entry (
_post, afterbegin_request,before dispatch), so every downstream read -
Service.reasoning_budgeton allthree routes, including
/v1/responses- sees the native name and keeps theexisting whole-number validation (a bad alias is the same 400). Precedence is
deterministic: the request's own
reasoning_budget_tokenswins over all aliases;among the aliases the fixed order
thinking_token_budget>thinking_budget>thinking_budget_tokensdoes. The patch applies verbatim ontoe88ee39d:do_POST'sbody moved to
_postand the req parse now happens afterreserve_inference, butthe insertion point and the budget's read path are unchanged.
Validation
Revision
e88ee39d+2b336465, Python 3.13.5,Linux x86-64, 2x RTX 2080 Ti, Qwen3.8-Flash-Next IQ3_S:
.venv/bin/python -m unittest serve.test_server.ThinkingBudget -v- redbefore (the alias-wrap and bad-alias-400 tests fail on base; the two
precedence tests pass since the native field already wins when the aliases
are ignored) / green after, 23 OK
.venv/bin/python -m unittest discover -s serve -p 'test_*.py'(CI'scommand): 885 OK (14 skipped)
strata serve --profile strata-iq3_s.json, thepatched tree): see Evidence
builds; the live check used the OpenAI route - the Anthropic route and
/v1/responsesare covered by the suite's fake-engine tests onlyMerge Danger
Door: two-way - revert the one commit; no data, schema, config or feed
migration.
Blast Radius: request handling on the three chat routes. A client that sends
none of the three names is unaffected (lookups only, no mutation); the only
behavior change is that a previously-ignored field now does what its name says.
Limits
DETAILS.md).
top-level
thinking_budgetis aliased too, same as the native field'sbehavior there.
response shapes are covered by the suite.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.