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++
Tests: STRATA_TEST_SLOW_COPY_US makes a parked conversation's checkpoint copy as slow as paged-out memory (for the #2049 repro)
Niko1221798f3006bbc6
diff --git a/src/core/conversation_copy.hpp b/src/core/conversation_copy.hppindex e15b1197b..7f5bd266b 100644--- a/src/core/conversation_copy.hpp+++ b/src/core/conversation_copy.hpp@@ -1,8 +1,13 @@#pragma once+#include "strata/core/conversation_cache.hpp"+#include <cuda_runtime.h>+#include <chrono>#include <cstddef>+#include <cstdlib>+#include <thread>#include <vector>namespace strata::core::conversation_detail {@@ -29,4 +34,21 @@ inline cudaError_t copy_nonblocking(void* dst, const void* src, size_t bytes) {return cudaStreamSynchronize(s);}+/// STRATA_TEST_SLOW_COPY_US=N (tests only): a parked conversation's running checkpoints copy as slowly as when the OS+/// has paged them out - N microseconds per MiB copied. Unset: a plain copy.+inline long test_slow_copy_us() {+ static const long v = [] { const char* e = std::getenv("STRATA_TEST_SLOW_COPY_US"); return e ? std::atol(e) : 0L; }();+ return v;+}++inline std::vector<ConversationCheckpoint> copy_checkpoints(const std::vector<ConversationCheckpoint>& cs) {+ std::vector<ConversationCheckpoint> out = cs;+ if (const long us = test_slow_copy_us(); us > 0) {+ size_t bytes = 0;+ for (const auto& c : out) bytes += c.bytes();+ std::this_thread::sleep_for(std::chrono::microseconds(us * (long) (bytes >> 20)));+ }+ return out;+}+} // namespace strata::core::conversation_detaildiff --git a/src/core/conversation_state.cpp b/src/core/conversation_state.cppindex 9c2342f84..8356cee82 100644--- a/src/core/conversation_state.cpp+++ b/src/core/conversation_state.cpp@@ -257,7 +257,7 @@ bool conversation_snapshot_save(SavedConversation& image, const ConversationViewcaptured.geometry = geometry_key(g);captured.layer_lo = ss.layer_lo; captured.layer_hi = ss.layer_hi;captured.live.ids = view.ids; captured.live.imgs = view.images;- captured.cvec = view.cvec; captured.checkpoints = view.checkpoints;+ captured.cvec = view.cvec; captured.checkpoints = conversation_detail::copy_checkpoints(view.checkpoints);const int64_t unchanged = reuse.kv.empty() ? 0 : reuse.unchanged_tokens;captured.kv = std::move(reuse.kv);const size_t layers = owned_qsa(ss);@@ -283,7 +283,7 @@ bool conversation_snapshot_sources(SavedConversation& meta, std::vector<SessionKcaptured.geometry = geometry_key(g);captured.layer_lo = ss.layer_lo; captured.layer_hi = ss.layer_hi;captured.live.ids = view.ids; captured.live.imgs = view.images;- captured.cvec = view.cvec; captured.checkpoints = view.checkpoints;+ captured.cvec = view.cvec; captured.checkpoints = conversation_detail::copy_checkpoints(view.checkpoints);if (!conversation_checkpoint_save(captured.live, ss, g, error)) return false;const int64_t upto = (int64_t) view.ids.size();const size_t layers = owned_qsa(ss);