Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Merge branch 'f-139-ux' into f-139-rel

Niko122192ca0c7fbd50
diff --cc docs/DETAILS.md
index 0b8d0cced,23989223a..c4475a94a
--- a/docs/DETAILS.md
+++ b/docs/DETAILS.md
@@@ -486,10 -473,14 +486,18 @@@ print(r.choices[0].message.content
part of the thinking the client sees and counts as output tokens. `"reasoning_budget_tokens": N` in
`strata-<model>.json` sets it for every request; a request's own value wins, and `0` means no budget. Off by default;
Anthropic's `"thinking": {"budget_tokens": N}` still only chooses the level, as above.
+- **A reply stuck on one token is ended (0.1.39, #606).** When a reply repeats the same token 256 times in a row, the
+ server ends it there with `finish_reason` `"length"` and says so in its window: a model in a loop, or a broken
+ state that answers one token forever (#606 saw 36,689 tokens of `!`). `"repeat_stop_tokens": N` in
+ `strata-<model>.json` sets the run length; `0` turns it off (for a request that really wants one token many times).
+ - **Changing the effort without re-reading the prompt (opt-in, 0.1.39, #458).** The effort's instruction is the
+ first thing in the prompt, so a request that only changes the effort (an agent's "think harder" switch, `none` for
+ a quick tool step) reads the whole conversation again. `"effort_position": "end"` in `strata-<model>.json` renders
+ every request's prompt start as the default effort's and puts a `low` / `medium` effort in a short system turn
+ right before the answer (no thinking: the empty thinking block, as always); the engine (0.1.39+, which the server
+ checks) keeps its checkpoint in front of that turn, so the next request reuses the conversation whatever its
+ effort. The default (`"start"`) prompt is unchanged. The model sees a level that is not the default in another
+ place than it was trained with; how well it follows it there is not measured yet.
- **Anthropic requests that don't ask for thinking (opt-in, 0.1.32, #278).** By default a `/v1/messages` request
with no `"thinking"`, effort or budget thinks as the model's template does. `"anthropic_thinking": "on_request"` in
`strata-<model>.json` renders such a request without thinking - Anthropic's own rule, and what Claude Code's short
diff --cc serve/server.py
index 6178f12df,4e70c42b5..60174b71c
--- a/serve/server.py
+++ b/serve/server.py
@@@ -58,11 -59,14 +59,18 @@@ from serve.structured import Structured
IM_END = "<|im_end|>"
IMAGE_PAD = "<|image_pad|>"
+ # #458: the trailing effort turn ("effort_position": "end"); low is the template's own sentence, medium (which the
+ # template says nothing for: no xhigh sentence is medium there) says it, since the xhigh one stays at the top
+ EFFORT_TURN = "<|im_start|>system\n{}<|im_end|>\n"
+ EFFORT_TEXT = {"low": "Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the "
+ "conclusion without unnecessary elaboration.",
+ "medium": "Reasoning effort is set to medium. Think as much as the task needs, without unnecessary "
+ "elaboration."}
VISION_START = "<|vision_start|>"
+# #606: a reply that repeats one token this many times in a row is ended there ("length"): a model in a loop, or a
+# broken state that answers one token forever (an issue saw 36,689 tokens of "!"). The config's "repeat_stop_tokens"
+# sets it; 0 turns it off.
+REPEAT_STOP_TOKENS = 256
# #123: what closes the thinking when it reaches reasoning_budget_tokens (the model's own end-of-thinking tag after it)
REASONING_WRAP_UP = "\n\nI have thought about this long enough; time to give my answer.\n</think>\n\n"
LOOPBACK_NAMES = ("localhost", "127.0.0.1", "::1")
@@@ -3040,10 -3169,7 +3232,11 @@@ def main() -> int
if mode not in ("model", "on_request"):
raise SystemExit(f"[strata] config anthropic_thinking must be \"model\" or \"on_request\", not {mode!r}")
svc.anthropic_think_unasked = mode == "model"
+ rs = cfg.get("repeat_stop_tokens", REPEAT_STOP_TOKENS) # #606: opt-out with 0
+ if isinstance(rs, bool) or not isinstance(rs, int) or rs < 0:
+ raise SystemExit(f"[strata] config \"repeat_stop_tokens\" must be a whole number >= 0 (0 = off), not {rs!r}")
+ svc.repeat_stop_tokens = rs
+ svc.effort_end = bool(effort_end) # #458: "effort_position": "end" with an engine that has it
if cfg.get("reasoning_budget_tokens") is not None: # #123: a default thinking budget for every request
try:
svc.reasoning_budget_tokens = cfg["reasoning_budget_tokens"]