mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5500] [Engine] Prototype incremental and prefix-readable session persistence #5472
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5472
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5500
Author: @giphoo
Created: 11/7/2026
Status: 🔄 Open
Base:
main← Head:l2-reference📝 Commits (1)
4277f9dAdd L2 session persistence reference implementation📊 Changes
26 files changed (+6325 additions, -267 deletions)
View changed files
📝
CMakeLists.txt(+15 -1)➕
docs/l2-design.md(+206 -0)➕
docs/l2-guide.md(+212 -0)📝
include/strata/core/conversation_cache.hpp(+32 -3)➕
include/strata/core/conversation_cache_l2.inc(+117 -0)📝
include/strata/core/conversation_file.hpp(+49 -0)📝
include/strata/core/conversation_snapshot.hpp(+5 -1)➕
include/strata/core/ple_metrics.hpp(+91 -0)📝
include/strata/kernels/ngram.hpp(+3 -0)➕
l2/bench_rotation.py(+206 -0)➕
l2/cache_control.py(+187 -0)➕
l2/reference_controller.py(+357 -0)➕
l2/test-deviation-contracts.py(+744 -0)📝
serve/server.py(+283 -22)➕
src/core/conversation_cache_l2_test.cpp(+56 -0)📝
src/core/conversation_cache_test.cpp(+42 -0)📝
src/core/conversation_file.cpp(+101 -5)➕
src/core/conversation_file_l2.inc(+461 -0)📝
src/core/conversation_file_test.cpp(+595 -0)➕
src/core/conversation_file_v2.inc(+1683 -0)...and 6 more files
📄 Description
Problem and result
Long agent conversations that alternate between sessions pay repeated prefill costs when the conversation is no longer in the RAM cache. Existing session files write and read whole snapshots, which amplifies I/O when only a small part changes or only a prefix is needed.
This draft adds:
All features are opt-in. Default behavior is unchanged.
Related discussion
Approach
The engine owns all KV state and transfers. The controller only decides when to save and restore. The key primitives are:
A minimal reference controller (~300 lines,
l2/reference_controller.py) demonstrates the full save ? preload ? generate ? saveinc loop. A rotation benchmark (l2/bench_rotation.py) measures reuse rates across a three-conversation workload with engine restart.Validation
Passed (reference implementation, Linux/HIP, AMD W7900 48 GB, Qwen3.8-Flash-Next UD-IQ4_XS, v0.2.12/engine 0.1.58):
Failed:
HIP_VISIBLE_DEVICES=1on W7900Not run:
Limits
open/pread/pwrite/fsync). Windows needs a separate implementation.conversation_snapshot_restore(); it should be scoped to the L2 opt-in path only.This is a draft for design discussion. I can split it into smaller PRs based on feedback.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.