[PR #1492] [Engine] save and restore sessions without an MTP drafter #3487

Open
opened 2026-11-07 14:41:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1492
Author: @Momoyeyu
Created: 10/8/2026
Status: 🔄 Open

Base: main ← Head: fix/session-save-without-mtp


📝 Commits (1)

  • 5a14ef2 fix(serve): save and restore sessions without an MTP drafter

📊 Changes

5 files changed (+84 additions, -13 deletions)

View changed files

📝 include/strata/core/conversation_snapshot.hpp (+6 -0)
📝 src/core/conversation_snapshot_test.cpp (+17 -0)
📝 src/core/conversation_state.cpp (+21 -8)
📝 src/core/conversation_validation_test.cpp (+34 -0)
📝 src/program/generate.cpp (+6 -5)

📄 Description

Problem and result

--serve can run without --mtp, but SAVE always passed mtp.kv_state() to the session writer. An unloaded drafter has max_cells == 0, so saving any nonempty conversation failed with:

conversation snapshot: invalid K/V extent

and RESTORE never got a file to read. The in-memory snapshot path already accepts an absent drafter, so the disk path now uses the same distinction: the draft K/V source, its read bounds, sl.kv_layers and the validate/restore calls include the drafter only when it exists. The file format and the K/V extent checks are unchanged; passing an uninitialized drafter explicitly still fails instead of bypassing validation.

Related to #1444, not closing it: the failure is reproduced with the same error, but not in the reporter's Q6_K configuration, and the launch arguments are still missing there.

#1444.

Approach

conversation_snapshot_sources and conversation_session_read_limits take const QsaState*; the reference overloads stay for callers that always have a drafter, so nothing else in the tree changes. SAVE/RESTORE, the memory preflight and the saved layer count follow the actual drafter presence.

Validation

Rebased on main at e88ee39d (0.2.0-beta); the commit is now 5a14ef2a on top of it.

Passed:

  • git rebase upstream/main — the single commit replayed onto e88ee39d with no conflicts; git diff --check clean.
  • Re-read every session-save/restore call site in src/program/generate.cpp on e88ee39d: SAVE sources, the read limits, validate, restore and the layer count all take the nullable session_draft; the only other draft-passing callers are the batch_mtp copies, which are guarded by batch_mtp and are not affected.

Failed:

  • none observed.

Not run:

  • The build and conversation_transfer_test, conversation_validation_test, conversation_file_test, conversation_snapshot_test were not re-run on 0.2.0-beta: the machine I have now is macOS arm64 with no CUDA toolkit and no NVIDIA GPU, so the engine does not build here. The 4055-check run in the original description was on d5ea713, and I am not restating it as a 0.2.0-beta result.
  • The reporter's Q6_K pack, Windows, HIP and SYCL remain untested.

Limits

The 0.2.0-beta build and test run is the one open item; I will post it in this thread as soon as a GPU is available. The SYCL copy of the session code (sycl/src/program/generate.cpp) is not changed by this PR.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1492 **Author:** [@Momoyeyu](https://github.com/Momoyeyu) **Created:** 10/8/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/session-save-without-mtp` --- ### 📝 Commits (1) - [`5a14ef2`](https://github.com/Niko1221/Strata/commit/5a14ef2aa3ee00f3ff56f7c59a5482ca91b6a856) fix(serve): save and restore sessions without an MTP drafter ### 📊 Changes **5 files changed** (+84 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/conversation_snapshot.hpp` (+6 -0) 📝 `src/core/conversation_snapshot_test.cpp` (+17 -0) 📝 `src/core/conversation_state.cpp` (+21 -8) 📝 `src/core/conversation_validation_test.cpp` (+34 -0) 📝 `src/program/generate.cpp` (+6 -5) </details> ### 📄 Description ## Problem and result `--serve` can run without `--mtp`, but SAVE always passed `mtp.kv_state()` to the session writer. An unloaded drafter has `max_cells == 0`, so saving any nonempty conversation failed with: ``` conversation snapshot: invalid K/V extent ``` and RESTORE never got a file to read. The in-memory snapshot path already accepts an absent drafter, so the disk path now uses the same distinction: the draft K/V source, its read bounds, `sl.kv_layers` and the validate/restore calls include the drafter only when it exists. The file format and the K/V extent checks are unchanged; passing an uninitialized drafter explicitly still fails instead of bypassing validation. Related to #1444, not closing it: the failure is reproduced with the same error, but not in the reporter's Q6_K configuration, and the launch arguments are still missing there. ## Related discussion #1444. ## Approach `conversation_snapshot_sources` and `conversation_session_read_limits` take `const QsaState*`; the reference overloads stay for callers that always have a drafter, so nothing else in the tree changes. SAVE/RESTORE, the memory preflight and the saved layer count follow the actual drafter presence. ## Validation Rebased on `main` at `e88ee39d` (0.2.0-beta); the commit is now `5a14ef2a` on top of it. **Passed:** - `git rebase upstream/main` — the single commit replayed onto `e88ee39d` with no conflicts; `git diff --check` clean. - Re-read every session-save/restore call site in `src/program/generate.cpp` on `e88ee39d`: SAVE sources, the read limits, validate, restore and the layer count all take the nullable `session_draft`; the only other draft-passing callers are the `batch_mtp` copies, which are guarded by `batch_mtp` and are not affected. **Failed:** - none observed. **Not run:** - The build and `conversation_transfer_test`, `conversation_validation_test`, `conversation_file_test`, `conversation_snapshot_test` were not re-run on 0.2.0-beta: the machine I have now is macOS arm64 with no CUDA toolkit and no NVIDIA GPU, so the engine does not build here. The 4055-check run in the original description was on `d5ea713`, and I am not restating it as a 0.2.0-beta result. - The reporter's Q6_K pack, Windows, HIP and SYCL remain untested. ## Limits The 0.2.0-beta build and test run is the one open item; I will post it in this thread as soon as a GPU is available. The SYCL copy of the session code (`sycl/src/program/generate.cpp`) is not changed by this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#3487
No description provided.