mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2140] [CLOSED] [Engine] serve: honour llama-server's thinking_budget_tokens (a llama.cpp client's thinking budget was silently ignored) #3878
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#3878
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/2140
Author: @xrip
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:pr/thinking-budget-alias📝 Commits (1)
b394c6fserve: thinking_budget_tokens (llama.cpp's name) is the same thinking budget as reasoning_budget_tokens📊 Changes
3 files changed (+18 additions, -5 deletions)
View changed files
📝
docs/DETAILS.md(+2 -1)📝
serve/server.py(+5 -4)📝
serve/test_server.py(+11 -0)📄 Description
Problem and result
A client written for llama-server sends its thinking budget as
thinking_budget_tokens. Strata's server reads onlyreasoning_budget_tokens, so it ignores that field: the request runs with no thinking budget at all, and nothing is logged or reported. llama-server reads both names (tools/server/server-common.cpptakesreasoning_budget_tokensand falls back tothinking_budget_tokens), and its Anthropic adapter (server-chat.cpp) writes the second one, so any client built against llama-server can hit this.How it showed up: the pi coding agent's llama.cpp provider (pi-llama-cpp) sends
thinking_budget_tokens(8,192 at pi's default level). During an automatic compaction (a 109,013-token history, answer capped at 26,214 tokens) the model thought until the cap and never wrote the summary. pi sent the same request again five times, about 250 s each (21 minutes), without compacting.thinking_budget_tokens: Nis ignored, and the thinking runs untilmax_tokensor the end of the context.reasoning_budget_tokens: N. The thinking is wrapped up at N tokens, andreasoning_budget_tokenswins when both are set.Related discussion
Fixes #2141 (re-tested on 0.2.0-beta there: still present).
Approach
Service.reasoning_budget()readsreasoning_budget_tokensand, when it is absent,thinking_budget_tokens, as llama-server does. The validation is unchanged (a whole number; 0 means no budget), and the config default still applies when neither field is given.serve/server.py: 4 lines inreasoning_budget().serve/test_server.py:test_llama_cpp_thinking_budget_tokens_is_the_same_budget. The alias wraps the thinking up at the same point, andreasoning_budget_tokenstakes precedence when both are set.docs/DETAILS.md: the alias is named in the thinking-budget paragraph.The engine is not touched; there are no compatibility effects for clients that send
reasoning_budget_tokens.Validation
Passed:
f57c0adc) asb394c6fc.python -m pytest -q serve/test_server.py: 339 passed, 3 skipped, 444 subtests passed (Windows 11, Python 3.14).serve/server.py(this change taken out) fails: the thought comes back whole instead of cut at 20 tokens. With the change it passes.342185bd) with this change.Failed: none observed.
Not run: this exact branch against a GPU engine (the change is in request parsing; the test uses the server's stub engine).
Limits
Only the name is added; the budget's behaviour is the existing one.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.