[PR #3167] [CLOSED] serve: accept the three thinking-budget field names (pi's thinkingTokenBudgetField) as aliases #4486

Closed
opened 2026-11-07 15:36:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3167
Author: @shizhx
Created: 10/19/2026
Status: ❌ Closed

Base: main ← Head: serve-thinking-budget-aliases


📝 Commits (1)

  • 77b442f serve: 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

Summary

pi's thinkingTokenBudgetField can be any of the other providers' names for the same budget; clients send thinking_token_budget (vLLM), thinking_budget (Qwen) or thinking_budget_tokens (llama.cpp). Those fields were silently ignored, so the thinking budget never applied. The serve layer now copies the first alias present into reasoning_budget_tokens before dispatching; the request's own reasoning_budget_tokens wins.

on(request, for /v1/chat/completions | /v1/messages | /v1/responses)
  if request has no reasoning_budget_tokens
    copy first present of
      thinking_token_budget, thinking_budget, thinking_budget_tokens
      → reasoning_budget_tokens
  dispatch   # unchanged downstream: validation, budget, wrap-up

Serve layer only — 9 lines in serve/server.py plus tests and the DETAILS.md note. No engine change; the budget machinery itself (#123) is untouched.

Evidence

  • Before: parent commit 477ac13c, same four tests — the alias is ignored, thinking runs to the end, a bad alias is not rejected:
    FAIL test_the_budget_alias_field_names
      AssertionError: 'Let me think step by step about two plus two. ...'  (full thinking, no wrap-up)
                   != 'Let me think step by
                       I have thought about this long enough; time to give my answer.'
    FAIL test_a_bad_alias_is_a_400
      AssertionError: 200 != 400 : ('thinking_token_budget', 1.5)
    
  • After:
    test_the_budget_alias_field_names ... ok
    test_the_request_s_own_budget_wins_over_the_aliases ... ok
    test_the_alias_field_order_wins ... ok
    test_a_bad_alias_is_a_400 ... ok
    Ran 4 tests in 2.250s — OK
    
    python3 -m unittest serve.test_server
    Ran 341 tests in 111.677s — OK
    
    Measured on this PC with the mock engine (serve's tests run without a GPU or downloads). No backend files touched, so no CUDA/HIP/SYCL builds; the alias lands before the existing, separately-tested budget path.

Merge Danger

Door: Two-way. Additive serve-layer normalization; rolling back is a revert, and nothing downstream knows the budget came from an alias. Default path stays byte-identical: a request without any of the three aliases has reasoning_budget_tokens left untouched.

Blast Radius: small — requests carrying one of the alias fields now have it applied as the thinking budget (previously ignored), and an invalid alias value now 400s like reasoning_budget_tokens does (previously 200 and ignored).


🔄 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/3167 **Author:** [@shizhx](https://github.com/shizhx) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `serve-thinking-budget-aliases` --- ### 📝 Commits (1) - [`77b442f`](https://github.com/Niko1221/Strata/commit/77b442f38ea9ceb8f43632b3bd71d49e565fadea) serve: accept the three thinking-budget field names (pi's thinkingTokenBudgetField) as aliases ### 📊 Changes **3 files changed** (+49 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+5 -1) 📝 `serve/server.py` (+9 -0) 📝 `serve/test_server.py` (+35 -0) </details> ### 📄 Description ## Summary pi's `thinkingTokenBudgetField` can be any of the other providers' names for the same budget; clients send `thinking_token_budget` (vLLM), `thinking_budget` (Qwen) or `thinking_budget_tokens` (llama.cpp). Those fields were silently ignored, so the thinking budget never applied. The serve layer now copies the first alias present into `reasoning_budget_tokens` before dispatching; the request's own `reasoning_budget_tokens` wins. ```text on(request, for /v1/chat/completions | /v1/messages | /v1/responses) if request has no reasoning_budget_tokens copy first present of thinking_token_budget, thinking_budget, thinking_budget_tokens → reasoning_budget_tokens dispatch # unchanged downstream: validation, budget, wrap-up ``` Serve layer only — 9 lines in `serve/server.py` plus tests and the DETAILS.md note. No engine change; the budget machinery itself (#123) is untouched. ## Evidence - **Before:** parent commit `477ac13c`, same four tests — the alias is ignored, thinking runs to the end, a bad alias is not rejected: ```text FAIL test_the_budget_alias_field_names AssertionError: 'Let me think step by step about two plus two. ...' (full thinking, no wrap-up) != 'Let me think step by I have thought about this long enough; time to give my answer.' FAIL test_a_bad_alias_is_a_400 AssertionError: 200 != 400 : ('thinking_token_budget', 1.5) ``` - **After:** ```text test_the_budget_alias_field_names ... ok test_the_request_s_own_budget_wins_over_the_aliases ... ok test_the_alias_field_order_wins ... ok test_a_bad_alias_is_a_400 ... ok Ran 4 tests in 2.250s — OK python3 -m unittest serve.test_server Ran 341 tests in 111.677s — OK ``` Measured on this PC with the mock engine (serve's tests run without a GPU or downloads). No backend files touched, so no CUDA/HIP/SYCL builds; the alias lands before the existing, separately-tested budget path. ## Merge Danger **Door:** Two-way. Additive serve-layer normalization; rolling back is a revert, and nothing downstream knows the budget came from an alias. Default path stays byte-identical: a request without any of the three aliases has `reasoning_budget_tokens` left untouched. **Blast Radius:** small — requests carrying one of the alias fields now have it applied as the thinking budget (previously ignored), and an invalid alias value now 400s like `reasoning_budget_tokens` does (previously 200 and ignored). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:36:22 +07:00
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#4486
No description provided.