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

fix(engine): clear stale error/cancellation state between requests and before prompt prefill

Pravesh Khatana481b69246f70
diff --git a/src/prefill/prefill.cpp b/src/prefill/prefill.cpp
index 2dcdb5436..6731b3c81 100644
--- a/src/prefill/prefill.cpp
+++ b/src/prefill/prefill.cpp
@@ -927,6 +927,7 @@ struct PfTimer {
} // namespace
bool Prefill::run(const int64_t* tokens, int64_t n, int64_t pos0, std::string& err) {
+ err.clear();
Impl& m = *impl_;
const core::OnDevice on_device(m.device);
const core::ModelGeometry& g = *m.g;
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index 0bbc92e03..3b0bba446 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -3559,6 +3559,7 @@ int main(int argc, char** argv) {
~BusyScope() { strata::core::progress().busy.store(false); strata::core::progress_at("idle"); }
} busy_scope;
stop_req.store(false); // a STOP that arrived between requests is stale
+ err.clear();
const bool geni = line.rfind("GENI ", 0) == 0;
if (!geni && line.rfind("GEN ", 0) != 0) {
std::printf("ERR expected: GEN <max_new> <id,id,...> or GENI <max_new> <file> <id,id,...>\n");
@@ -3976,6 +3977,7 @@ int main(int argc, char** argv) {
int64_t at = read_from;
for (const int64_t to : {reread_to, root_at, turn_at, n - 1}) {
if (to <= at) continue;
+ err.clear();
const bool win = windows_ok(at, to);
if (win && !refill(err)) {
std::printf("ERR refilling a lent slot failed: %s\n", err.c_str());