[GH-ISSUE #4409] [Engine] scope: move a conversation between Strata servers (save by client session, import into the conversation cache, incremental saves) #1965

Closed
opened 2026-11-04 01:55:38 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @janit on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4409

Area

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

What do you want to do?

We run several Strata servers behind one router. The router sends a client session to another server when its own is
full, restarting or slower than a free one. The new server has none of the conversation's K/V, so its first turn reads
the whole prompt again: 41 s for a 50k-token conversation on one RTX A4000, 24.5 s for 82.9k tokens on an RTX 5090.
Long coding-agent sessions are exactly the ones that move, and they pay the most.

Session files already make this possible in principle: a 50k file saved by one process and restored in another
continued with the same output. The current API stops short in four ways:

  1. It saves a slot, not a session. With --batch a slot changes hands between requests, so a router cannot name the
    conversation it wants. Save and restore also refuse --batch outright.
  2. Restore replaces the live session, so a busy server cannot take in a conversation for later.
  3. Every save is the whole file (about 1 GB at 50k), while consecutive turns differ in about 240 MB of it.
  4. Nothing says whether a conversation is still held. The conversation cache evicts oldest first and reports
    nothing, so a caller that imported a conversation cannot tell whether it is still there.

Proposed behavior

All opt-in, all behind --slot-save-path (no session is remembered and every endpoint answers 501 without it):

  • POST /slots/session?action=save {session, filename[, base]}: save the conversation a client session
    (X-Session-Affinity, else X-Session-Id) last continued, from a batch slot, the live session or the conversation
    cache. The engine checks a hash of the conversation's first ids before writing (SAVEC), so a slot that changed hands
    is never saved under the wrong name. With base (an earlier save's id) it writes a delta file (STRSDLT v1) instead.
  • POST /slots/0?action=import {filename}: read and check a session file as restore does, then park it in the
    conversation cache (IMPORT). The live session and the batch slots are untouched; a matching prompt resumes from it
    through the existing cache path.
  • POST /slots/session?action=held {session}: how many tokens of that conversation the engine still holds (HELD),
    read only.

STRSESS is unchanged. The existing /slots/0?action=save|restore keep their current behavior, including refusing --batch.
The session writer also gets two changes that write the same bytes faster: the deepest checkpoint by reference instead of
copied, and full blocks written on a thread (0.80 to 0.56 s at 50k on an A4000).

Tradeoffs

  • A save blocks every slot of the engine for 0.2-0.7 s at 50k (A4000).
  • The server keeps the last prompt of up to 1024 sessions (at most 64 MiB) when --slot-save-path is set.
  • The engine remembers its last 64 saves for deltas; the ids die with the process.
  • --layer-split, --peer-device and pictures stay refused, as for session files today.
  • Moving files between hosts is the caller's job.

Evidence so far

On the branch below (v0.2.7 main plus this change), one RTX A4000, Qwen3.8-Flash-Next IQ3_XXS:

  • Without --slot-save-path, greedy answers to the same prompts were byte-identical to v0.2.7 across four fresh
    processes (two each).
  • A 49k-token conversation: first turn 41.4 s cold. Full save 989 MB in 0.72 s; the next save as a delta, 239 MB in
    0.30 s. Imported into a fresh process in 0.99 s, the next turn took 1.43 s (49,308 tokens reused) against 42.7 s cold.
    base + delta rebuilt the engine's own full save byte for byte.
  • It builds and links for CUDA, SYCL, Metal (the metal-build.yml workflow) and HIP RDNA (gfx1100, gfx1201, TheRock
    wheels). For gfx906 the changed files compile, but the engine does not link because of src/core/dflash2.cpp,
    which fails the same way on main.

Earlier versions of the same change ran on two RTX 5090 hosts behind a router: a 16-session coding-agent workload
resumed 93.8-96.8% of its host switches warm. Write-up: https://viiwork.pulu.app/blog/kv-share-two-5090-hosts/
(viiwork is the router).

The change is about 1,700 lines, including 690 lines of tests and 130 of docs, on v0.2.7 main:
https://github.com/janit/Strata/tree/kv-export-upstream

I have no RDNA or Intel Arc hardware and cannot get any, so those would need a tester from the community; I may be
able to test gfx906 later.

Questions for the maintainers

  1. Is this in scope for Strata?
  2. One PR, or split into (a) save by session + import, (b) incremental saves, (c) held? Each depends on the one before.
  3. Are the endpoint names and the engine commands (SAVEC, SAVEX, IMPORT, HELD) acceptable, or would you rather
    they followed another convention?

What do you do today instead?

A cold prefill on every move, or not moving sessions at all and queueing behind a busy server.

Originally created by @janit on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4409 ### Area [Engine] (speed, kernels, models, the server and API) ### What do you want to do? We run several Strata servers behind one router. The router sends a client session to another server when its own is full, restarting or slower than a free one. The new server has none of the conversation's K/V, so its first turn reads the whole prompt again: 41 s for a 50k-token conversation on one RTX A4000, 24.5 s for 82.9k tokens on an RTX 5090. Long coding-agent sessions are exactly the ones that move, and they pay the most. Session files already make this possible in principle: a 50k file saved by one process and restored in another continued with the same output. The current API stops short in four ways: 1. **It saves a slot, not a session.** With `--batch` a slot changes hands between requests, so a router cannot name the conversation it wants. Save and restore also refuse `--batch` outright. 2. **Restore replaces the live session**, so a busy server cannot take in a conversation for later. 3. **Every save is the whole file** (about 1 GB at 50k), while consecutive turns differ in about 240 MB of it. 4. **Nothing says whether a conversation is still held.** The conversation cache evicts oldest first and reports nothing, so a caller that imported a conversation cannot tell whether it is still there. **Proposed behavior** All opt-in, all behind `--slot-save-path` (no session is remembered and every endpoint answers 501 without it): - `POST /slots/session?action=save {session, filename[, base]}`: save the conversation a client session (`X-Session-Affinity`, else `X-Session-Id`) last continued, from a batch slot, the live session or the conversation cache. The engine checks a hash of the conversation's first ids before writing (`SAVEC`), so a slot that changed hands is never saved under the wrong name. With `base` (an earlier save's id) it writes a delta file (STRSDLT v1) instead. - `POST /slots/0?action=import {filename}`: read and check a session file as restore does, then park it in the conversation cache (`IMPORT`). The live session and the batch slots are untouched; a matching prompt resumes from it through the existing cache path. - `POST /slots/session?action=held {session}`: how many tokens of that conversation the engine still holds (`HELD`), read only. STRSESS is unchanged. The existing `/slots/0?action=save|restore` keep their current behavior, including refusing `--batch`. The session writer also gets two changes that write the same bytes faster: the deepest checkpoint by reference instead of copied, and full blocks written on a thread (0.80 to 0.56 s at 50k on an A4000). **Tradeoffs** - A save blocks every slot of the engine for 0.2-0.7 s at 50k (A4000). - The server keeps the last prompt of up to 1024 sessions (at most 64 MiB) when `--slot-save-path` is set. - The engine remembers its last 64 saves for deltas; the ids die with the process. - `--layer-split`, `--peer-device` and pictures stay refused, as for session files today. - Moving files between hosts is the caller's job. **Evidence so far** On the branch below (v0.2.7 main plus this change), one RTX A4000, Qwen3.8-Flash-Next IQ3_XXS: - Without `--slot-save-path`, greedy answers to the same prompts were byte-identical to v0.2.7 across four fresh processes (two each). - A 49k-token conversation: first turn 41.4 s cold. Full save 989 MB in 0.72 s; the next save as a delta, 239 MB in 0.30 s. Imported into a fresh process in 0.99 s, the next turn took 1.43 s (49,308 tokens reused) against 42.7 s cold. base + delta rebuilt the engine's own full save byte for byte. - It builds and links for CUDA, SYCL, Metal (the `metal-build.yml` workflow) and HIP RDNA (gfx1100, gfx1201, TheRock wheels). For gfx906 the changed files compile, but the engine does not link because of `src/core/dflash2.cpp`, which fails the same way on main. Earlier versions of the same change ran on two RTX 5090 hosts behind a router: a 16-session coding-agent workload resumed 93.8-96.8% of its host switches warm. Write-up: https://viiwork.pulu.app/blog/kv-share-two-5090-hosts/ (viiwork is the router). The change is about 1,700 lines, including 690 lines of tests and 130 of docs, on v0.2.7 main: https://github.com/janit/Strata/tree/kv-export-upstream I have no RDNA or Intel Arc hardware and cannot get any, so those would need a tester from the community; I may be able to test gfx906 later. **Questions for the maintainers** 1. Is this in scope for Strata? 2. One PR, or split into (a) save by session + import, (b) incremental saves, (c) `held`? Each depends on the one before. 3. Are the endpoint names and the engine commands (`SAVEC`, `SAVEX`, `IMPORT`, `HELD`) acceptable, or would you rather they followed another convention? ### What do you do today instead? A cold prefill on every move, or not moving sessions at all and queueing behind a busy server.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660425419 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#1965
No description provided.