[GH-ISSUE #5153] [Engine] session save/restore is refused on a DFlash2-only install: "conversation snapshot: invalid K/V extent". Desktop-app #3063

Open
opened 2026-11-07 14:37:45 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @davidvv on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5153

Area

[Engine] (speed, kernels, models, the server and API)

Desktop app, Terminal or source?

Desktop app (Windows 11, installed build 0.2.10)

What happened

POST /slots/0?action=save fails on a server started with --draft dflash2 --draft-fallback none
(the server's own choice for "drafting": "auto" on this machine):

{"error": {"code": 500, "message": "conversation snapshot: invalid K/V extent", "type": "server_error", "kind": "io"}}

engine log:

strata serve: session save C:\Users\devendav\AI\Strata\sessions\chat1.bin: conversation snapshot: invalid K/V extent

Nothing is written; the folder stays empty. It fails at 120,061 tokens and at 33 tokens, so it is not
a length limit. RESTORE then answers 404 no saved session named ....

The same save works when the MTP layer is loaded: with --max-context 16384 (MTP layer loaded,
808 MiB of VRAM) it wrote 344,945,384 bytes in 444 ms, restored in 213 ms, restored again after a
full engine restart in 344 ms, and the continued turn reused 12,067 tokens (39 read, 1.04 s against
11.9 s cold). So the file format and the hand-over are fine; the failure is specific to a start
without the MTP layer — which is both the --draft-fallback none install and any start where the
draft layer is dropped for lack of VRAM:

strata generate: short of GPU memory: 2.67 GiB is free ... this start runs without the draft layer

Why it matters

Session files are the only way to keep a long conversation across an engine restart without a full
re-prefill. On this box a 120K prompt reads in 126.5 s; the same conversation as a session file is
about 1.1 GB and restores in under a second. A DFlash2 install — the recommended drafter on a card
this small — cannot save at all, so the whole disk path is unavailable to exactly the users who
need it.

Steps to reproduce

  1. Strata 0.2.10 / engine 0.1.56, one GPU, --kv q4_0 --kv-resident 0 --max-context 131072,
    --draft dflash2 --draft-fallback none (DFlash2 pack given to --draft-model).
  2. Start the server with --slot-save-path DIR.
  3. Send any request (one token is enough).
  4. curl -X POST "http://127.0.0.1:PORT/slots/0?action=save" -H "Content-Type: application/json" -d '{"filename":"chat1.bin"}'

It also happens on a start that drops the draft layer for lack of VRAM (this start runs without the draft layer, 2.67 GiB free), and it does not happen when the MTP layer is loaded.

Reproduction status

Reproduced locally: a 120,061-token conversation, a 33-token conversation, and a start that dropped
the draft layer all fail the same way; the same save on an MTP start succeeds.

Strata version

Strata 0.2.10, engine 0.1.56 (commit ffa80d7)

Graphics card, memory and system

Strata 0.2.10 · engine 0.1.56 · Windows 11 (desktop app install), commit ffa80d7
NVIDIA RTX PRO 1000 Blackwell Laptop, 8151 MiB · Intel Core Ultra 9 285HX, 63.5 GiB RAM
Qwen3.8-Flash-Next IQ2_XS-GSQ-RCO · --kv q4_0 --max-context 131072 --kv-resident 0 --vram-reserve-mib 300
--expert-cache auto -> 869 slots · --draft dflash2 --draft-fallback none · --pool-workers 15

Cause (from reading the source)

src/program/generate.cpp (~line 14972) passes the drafter's state to the capture unconditionally:

if (!strata::core::conversation_snapshot_sources(meta, sources, view, ss, g, mtp.kv_state(), err)) {

With --draft-fallback none the MTP layer is never loaded (df2_solo), so mtp.kv_state()
(include/strata/core/mtp.hpp:102, returning st_) is a default-constructed QsaState:
max_cells == 0. conversation_snapshot_sources then builds the last K/V source from it, and
valid_extent() (src/core/conversation_snapshot.cpp:25-31)

if (upto < 0 || upto > st.max_cells || ...) { error = "conversation snapshot: invalid K/V extent"; return false; }

rejects every non-empty conversation.

The read path already handles a drafter that is not there, in two ways:

  • conversation_session_read_limits (src/core/conversation_state.cpp) clamps:
    const int64_t dupto = (int64_t) std::min<uint64_t>(tokens, (uint64_t) std::max<int64_t>(draft.max_cells, 0));
  • the prompt path guards the pointer: (n_st > 0 && !mtp_first) || !use_mtp ? nullptr : &mtp.kv_state()
    (generate.cpp ~11763).

conversation_snapshot_validate and conversation_snapshot_restore already take const QsaState* draft
and accept nullptr; only the save side takes a reference and always includes the layer
(image.kv.size() != layers + (draft ? 1 : 0) is already written to allow its absence).

So the fix is the one the callers already expect: make conversation_snapshot_sources take
const QsaState* draft and pass df2_solo || !mtp_loaded ? nullptr : &mtp.kv_state() (or, if the
signature should stay, skip the out.back() source when the layer was not loaded). Both the save and
its matching restore then agree on kv.size() == layers.

Originally created by @davidvv on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5153 ### Area [Engine] (speed, kernels, models, the server and API) ### Desktop app, Terminal or source? Desktop app (Windows 11, installed build 0.2.10) ### What happened `POST /slots/0?action=save` fails on a server started with `--draft dflash2 --draft-fallback none` (the server's own choice for `"drafting": "auto"` on this machine): ``` {"error": {"code": 500, "message": "conversation snapshot: invalid K/V extent", "type": "server_error", "kind": "io"}} ``` engine log: ``` strata serve: session save C:\Users\devendav\AI\Strata\sessions\chat1.bin: conversation snapshot: invalid K/V extent ``` Nothing is written; the folder stays empty. It fails at 120,061 tokens and at 33 tokens, so it is not a length limit. `RESTORE` then answers `404 no saved session named ...`. The same save works when the MTP layer is loaded: with `--max-context 16384` (MTP layer loaded, 808 MiB of VRAM) it wrote 344,945,384 bytes in 444 ms, restored in 213 ms, restored again after a full engine restart in 344 ms, and the continued turn reused 12,067 tokens (39 read, 1.04 s against 11.9 s cold). So the file format and the hand-over are fine; the failure is specific to a start without the MTP layer — which is both the `--draft-fallback none` install and any start where the draft layer is dropped for lack of VRAM: ``` strata generate: short of GPU memory: 2.67 GiB is free ... this start runs without the draft layer ``` #### Why it matters Session files are the only way to keep a long conversation across an engine restart without a full re-prefill. On this box a 120K prompt reads in 126.5 s; the same conversation as a session file is about 1.1 GB and restores in under a second. A DFlash2 install — the recommended drafter on a card this small — cannot save at all, so the whole disk path is unavailable to exactly the users who need it. ### Steps to reproduce 1. Strata 0.2.10 / engine 0.1.56, one GPU, `--kv q4_0 --kv-resident 0 --max-context 131072`, `--draft dflash2 --draft-fallback none` (DFlash2 pack given to `--draft-model`). 2. Start the server with `--slot-save-path DIR`. 3. Send any request (one token is enough). 4. `curl -X POST "http://127.0.0.1:PORT/slots/0?action=save" -H "Content-Type: application/json" -d '{"filename":"chat1.bin"}'` It also happens on a start that drops the draft layer for lack of VRAM (`this start runs without the draft layer`, 2.67 GiB free), and it does **not** happen when the MTP layer is loaded. ### Reproduction status Reproduced locally: a 120,061-token conversation, a 33-token conversation, and a start that dropped the draft layer all fail the same way; the same save on an MTP start succeeds. ### Strata version Strata 0.2.10, engine 0.1.56 (commit ffa80d7) ### Graphics card, memory and system ``` Strata 0.2.10 · engine 0.1.56 · Windows 11 (desktop app install), commit ffa80d7 NVIDIA RTX PRO 1000 Blackwell Laptop, 8151 MiB · Intel Core Ultra 9 285HX, 63.5 GiB RAM Qwen3.8-Flash-Next IQ2_XS-GSQ-RCO · --kv q4_0 --max-context 131072 --kv-resident 0 --vram-reserve-mib 300 --expert-cache auto -> 869 slots · --draft dflash2 --draft-fallback none · --pool-workers 15 ``` #### Cause (from reading the source) `src/program/generate.cpp` (~line 14972) passes the drafter's state to the capture unconditionally: ```cpp if (!strata::core::conversation_snapshot_sources(meta, sources, view, ss, g, mtp.kv_state(), err)) { ``` With `--draft-fallback none` the MTP layer is never loaded (`df2_solo`), so `mtp.kv_state()` (`include/strata/core/mtp.hpp:102`, returning `st_`) is a default-constructed `QsaState`: `max_cells == 0`. `conversation_snapshot_sources` then builds the last K/V source from it, and `valid_extent()` (`src/core/conversation_snapshot.cpp:25-31`) ```cpp if (upto < 0 || upto > st.max_cells || ...) { error = "conversation snapshot: invalid K/V extent"; return false; } ``` rejects every non-empty conversation. The read path already handles a drafter that is not there, in two ways: - `conversation_session_read_limits` (`src/core/conversation_state.cpp`) clamps: `const int64_t dupto = (int64_t) std::min<uint64_t>(tokens, (uint64_t) std::max<int64_t>(draft.max_cells, 0));` - the prompt path guards the pointer: `(n_st > 0 && !mtp_first) || !use_mtp ? nullptr : &mtp.kv_state()` (`generate.cpp` ~11763). `conversation_snapshot_validate` and `conversation_snapshot_restore` already take `const QsaState* draft` and accept `nullptr`; only the save side takes a reference and always includes the layer (`image.kv.size() != layers + (draft ? 1 : 0)` is already written to allow its absence). So the fix is the one the callers already expect: make `conversation_snapshot_sources` take `const QsaState* draft` and pass `df2_solo || !mtp_loaded ? nullptr : &mtp.kv_state()` (or, if the signature should stay, skip the `out.back()` source when the layer was not loaded). Both the save and its matching restore then agree on `kv.size() == layers`.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".
  • Fill in "Area".
  • Fill in "Desktop app, Terminal or source?".
  • Fill in "Reproduction status".
  • Fill in "Strata version".
  • Fill in "Graphics card, memory and system".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6615691930 --> @github-actions[bot] commented on GitHub (Nov 3, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". - [ ] Fill in "Area". - [ ] Fill in "Desktop app, Terminal or source?". - [ ] Fill in "Reproduction status". - [ ] Fill in "Strata version". - [ ] Fill in "Graphics card, memory and system". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6616031085 --> @github-actions[bot] commented on GitHub (Nov 3, 2026): Thanks, this follows the format now.
Author
Owner

@udqe commented on GitHub (Nov 3, 2026):

Static-read root cause (source at main as of 2026-11-03, engine 0.1.56 era; read-only audit, no build - our own box runs --mtp so we never hit this).

The refusal comes from the SAVE handler passing the MTP drafter's K/V state unconditionally: src/program/generate.cpp:14972 conversation_snapshot_sources(meta, sources, view, ss, g, mtp.kv_state(), err), and src/core/conversation_state.cpp:622-643 always appends the draft source (:639 conversation_kv_source(out.back(), draft, g, upto, false, error) with upto = view.ids.size()). On a --draft dflash2 --draft-fallback none server the MtpDrafter is never loaded, so its state is default-constructed with max_cells = 0 (include/strata/core/mtp.hpp:102 returns st_), and upto > st.max_cells trips the check at src/core/conversation_snapshot.cpp:27-28 that emits exactly your string.

Two things make this look like an oversight rather than a designed refusal:

  1. the PARK path already guards it - generate.cpp:11593 // no --mtp: no draft K/V (snapshots accept null) and :11763 passes !use_mtp ? nullptr : &mtp.kv_state();
  2. save/bytes/validate/restore all have nullptr overloads (conversation_snapshot.hpp:161-184) - the one function missing one is conversation_snapshot_sources (hpp:139-141).

Also worth deciding on purpose: session files store only the MTP draft ring (hpp:136-138, "one streamed source per QSA layer then the draft") - DFlash2's own context ring is never part of a snapshot at all. So even after the save is unblocked, a restored DFlash2-only session would carry no drafter state; refusing with a clearer message ("sessions are not supported with dflash2 drafters") may be the honest short-term answer, and a nullptr overload plus that message is a small patch.

(ai-assisted; citations: udqe static audit of v0.2.10-era main, 2x RTX 4090 Windows box - not its engine build itself)

<!-- gh-comment-id:6616756213 --> @udqe commented on GitHub (Nov 3, 2026): Static-read root cause (source at main as of 2026-11-03, engine 0.1.56 era; read-only audit, no build - our own box runs --mtp so we never hit this). The refusal comes from the SAVE handler passing the MTP drafter's K/V state unconditionally: src/program/generate.cpp:14972 `conversation_snapshot_sources(meta, sources, view, ss, g, mtp.kv_state(), err)`, and src/core/conversation_state.cpp:622-643 always appends the draft source (:639 `conversation_kv_source(out.back(), draft, g, upto, false, error)` with `upto = view.ids.size()`). On a `--draft dflash2 --draft-fallback none` server the MtpDrafter is never loaded, so its state is default-constructed with `max_cells = 0` (include/strata/core/mtp.hpp:102 returns `st_`), and `upto > st.max_cells` trips the check at src/core/conversation_snapshot.cpp:27-28 that emits exactly your string. Two things make this look like an oversight rather than a designed refusal: 1. the PARK path already guards it - generate.cpp:11593 `// no --mtp: no draft K/V (snapshots accept null)` and :11763 passes `!use_mtp ? nullptr : &mtp.kv_state()`; 2. save/bytes/validate/restore all have nullptr overloads (conversation_snapshot.hpp:161-184) - the one function missing one is `conversation_snapshot_sources` (hpp:139-141). Also worth deciding on purpose: session files store only the MTP draft ring (hpp:136-138, "one streamed source per QSA layer then the draft") - DFlash2's own context ring is never part of a snapshot at all. So even after the save is unblocked, a restored DFlash2-only session would carry no drafter state; refusing with a clearer message ("sessions are not supported with dflash2 drafters") may be the honest short-term answer, and a nullptr overload plus that message is a small patch. (ai-assisted; citations: udqe static audit of v0.2.10-era main, 2x RTX 4090 Windows box - not its engine build itself)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3063
No description provided.