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++

web: send an assistant turn with no answer text back in the history (#1392); docs: STRATA_STAGER_SLEEP numbers (#1101)

Niko1221c13ddd62d51d
diff --git a/docs/DETAILS.md b/docs/DETAILS.md
index d385aa107..13ad8c5b8 100644
--- a/docs/DETAILS.md
+++ b/docs/DETAILS.md
@@ -1372,6 +1372,8 @@ test images.
---
+**Stager waits (0.1.40.2, `STRATA_STAGER_SLEEP`):** the prompt-staging threads sleep while they wait on Linux and spin on Windows, because spinning is a little faster there (a 5070 read an 8K Q2_0 prompt 1.2% faster). `STRATA_STAGER_SLEEP=1` makes Windows sleep too, which is the choice when sharing the machine matters more than speed: on a Ryzen 9 7940HS laptop with an RTX 4070 (IQ3_S, 64K context) sleeping waits read 5,914 and 22,305 token prompts 5-6% slower while the whole-machine CPU use fell from 77-90% to 21-25% (issue #1101, thanks to midhatn). `STRATA_STAGER_SLEEP=0` forces spinning on Linux. The output is the same either way.
+
## Short prompts: let the CPU share the experts (opt-in, `STRATA_PREFILL_CPU_SHARE`)
A prompt chunk below 1,024 tokens (an agent's tool result, a test's output, a short follow-up) streams every routed
diff --git a/serve/web/app.js b/serve/web/app.js
index ade19016b..c43743e45 100644
--- a/serve/web/app.js
+++ b/serve/web/app.js
@@ -726,7 +726,7 @@ function apiMessages() {
const text = userText(m);
out.push({role: "user", content: imgs.length ? [{type: "text", text},
...imgs.map((i) => ({type: "image_url", image_url: {url: i.url}}))] : text});
- } else if (!m.error) {
+ } else if (!(busy && busy.msg === m)) { // the answer being asked for now is not history yet
out.push(...assistantMessages(m));
}
}
@@ -736,7 +736,14 @@ function apiMessages() {
// their results (as the model read them), then the rest - so the next question can build on what the tools found.
function assistantMessages(m) {
const ran = (m.tools || []).filter((t) => t.round != null && t.result != null && t.state !== "skipped");
- if (!ran.length) return m.text ? [{role: "assistant", content: m.text}] : [];
+ // #1392: a turn with no answer text (only reasoning, a stop before the first content token, or an error) still goes
+ // back as an assistant turn, so the history keeps alternating and a reasoning model sees that it already answered.
+ // The server leaves such a turn out of the prompt itself (serve/frontend.py, #843); reasoning_content rides along.
+ if (!ran.length) {
+ const msg = {role: "assistant", content: m.text || ""};
+ if (!m.text && m.reasoning) msg.reasoning_content = m.reasoning;
+ return [msg];
+ }
const out = [];
let pos = 0;
for (const r of [...new Set(ran.map((t) => t.round))]) {