[PR #1489] [CLOSED] Responses persistence and disk-only cache: CUDA/HIP integration #3485

Closed
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/1489
Author: @CC-David-CC
Created: 10/8/2026
Status: ❌ Closed

Base: main ← Head: work/responses-disk-cache-core


📝 Commits (10+)

  • 34e2409 serve: keep evicted conversations on disk across restarts
  • d258f18 serve: restore a session file without holding its K/V in RAM
  • 0d846c1 Merge remote-tracking branch 'upstream/main' into conversation-spill-disk
  • 54aa4ca Responses: preserve replay and add experimental persistence and summary controls
  • 1904b8a serve: recompute the RAM conversation match after a failed disk attempt: make_room may have evicted the entry the stale index named
  • 1a9e8b9 Merge remote-tracking branch 'upstream/main' into conversation-spill-disk
  • 3a5daf6 Merge branch 'pr-1269' into disk-only-cache
  • dd146f4 serve: --conversation-cache-disk-only - the conversation cache on disk, no RAM budget
  • b189048 conversation_spill_test: disk-only checks; docs: --conversation-cache-disk-only, measured on Strix Halo
  • ff30368 docs: --conversation-cache-disk-only restores measured from a cold page cache

📊 Changes

26 files changed (+4202 additions, -153 deletions)

View changed files

📝 CMakeLists.txt (+4 -1)
📝 docs/DETAILS.md (+74 -7)
➕ docs/RESPONSES_DISK_INTEGRATION.md (+125 -0)
➕ docs/RESPONSES_EXPERIMENTAL.md (+126 -0)
➕ docs/validation/responses-disk-20261008/cuda-rtx4090.json (+441 -0)
➕ docs/validation/responses-disk-20261008/hip-rx7900xtx.json (+441 -0)
📝 include/strata/core/conversation_cache.hpp (+124 -13)
📝 include/strata/core/conversation_file.hpp (+28 -0)
📝 include/strata/core/conversation_snapshot.hpp (+38 -2)
➕ include/strata/core/conversation_spill.hpp (+107 -0)
📝 serve/frontend.py (+10 -3)
➕ serve/response_runner.py (+147 -0)
➕ serve/response_store.py (+220 -0)
📝 serve/responses.py (+25 -17)
📝 serve/server.py (+109 -25)
📝 serve/test_responses.py (+11 -3)
➕ serve/test_responses_experimental.py (+447 -0)
📝 src/core/conversation_file.cpp (+227 -32)
📝 src/core/conversation_file_test.cpp (+122 -0)
📝 src/core/conversation_snapshot.cpp (+79 -14)

...and 6 more files

📄 Description

Summary

Validate #1269, #1271 and #1480 together with instruction/reasoning replay corrections, experimental Responses persistence and optional generated summaries.

The point is to test the boundaries between these features: can a chat resume after another chat, a summary pass or a restart without losing its history or restoring the wrong inference state? If KV files are evicted or damaged, the server must rebuild from durable history. This provides a tested core for downstream profile-based applications.

What changed

Preserves the original commit histories. Live testing found and fixed non-MTP snapshot failures: capture and restore now omit the absent draft ring. Adds regression coverage, a live probe and integration notes. Persistence and summary generation remain separate opt-ins.

Simple examples

Enable server options:

--experimental-responses-persistence --responses-store-path ./history

Add engine options to your existing configuration:

--conversation-cache-disk-only --conversation-cache-spill-dir ./kv --conversation-cache-disk-mib 2048

Keep those directories across restarts. Generated summaries remain off by default.

Use your configured model name and API key. Each reply is capped at 128 tokens:

from openai import OpenAI
c = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key="your-key")
def ask(text, parent=None):
    return c.responses.create(
        model="strata", input=text, previous_response_id=parent,
        max_output_tokens=128, reasoning={"effort": "none"})

# Code chat, then an independent research chat.
code = ask("Write a Python function that squares a number.")
research = ask("Explain why a control group matters in an experiment.")

# Continue the code chat without resending its history.
reply = ask("Add a test for a negative number.", code.id)
print(reply.output_text)
print(reply.id)  # Save this ID; use it as parent after a server restart.

The same continuation call works after restart. KV reuse accelerates compatible prefixes; a missing cache does not erase the conversation.

Validation and merge notes

Check CUDA / RTX 4090 HIP / RX 7900 XTX
Native cache tests 8 passed 7 passed
Live integration checks 33 passed 33 passed
Cached tokens after restart 1429 1429

Each backend ran 389 API tests with four optional skips; a dependency-enabled follow-up passed 25 tests. Live coverage includes branching, deletion, summaries on/off, cancellation, corrupt-cache fallback and eviction.

Validated engine: e6da7e11. Scope: Linux, one GPU, 8K context, int8 KV, MTP off. Maximum context, multi-GPU and live MTP remain unvalidated. This is functional validation, not a speed comparison.

Merge the combined candidate once, or use resulting main if its components land separately. Keep downstream profile selection and immutable revision binding in the application.

Detailed results: https://github.com/CC-David-CC/Strata-a5500/blob/work/responses-disk-cache-core/docs/RESPONSES_DISK_INTEGRATION.md


🔄 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/1489 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/8/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `work/responses-disk-cache-core` --- ### 📝 Commits (10+) - [`34e2409`](https://github.com/Niko1221/Strata/commit/34e24094a2214eaa14cde6a08cebc36f62926c18) serve: keep evicted conversations on disk across restarts - [`d258f18`](https://github.com/Niko1221/Strata/commit/d258f18920daf7c85a1c5fe407bf907d1fb9639a) serve: restore a session file without holding its K/V in RAM - [`0d846c1`](https://github.com/Niko1221/Strata/commit/0d846c168fa6f400d409574507c5bcd32b6771ee) Merge remote-tracking branch 'upstream/main' into conversation-spill-disk - [`54aa4ca`](https://github.com/Niko1221/Strata/commit/54aa4caaa3c3756fb0d258cbc3cc1647ff3562d9) Responses: preserve replay and add experimental persistence and summary controls - [`1904b8a`](https://github.com/Niko1221/Strata/commit/1904b8abf542bc3c8177d8d18a22aea5da3d49c2) serve: recompute the RAM conversation match after a failed disk attempt: make_room may have evicted the entry the stale index named - [`1a9e8b9`](https://github.com/Niko1221/Strata/commit/1a9e8b95a185cfa3939bb3fdf1d5487411dd229f) Merge remote-tracking branch 'upstream/main' into conversation-spill-disk - [`3a5daf6`](https://github.com/Niko1221/Strata/commit/3a5daf640d68576876767e5926ed25e9b9e5629b) Merge branch 'pr-1269' into disk-only-cache - [`dd146f4`](https://github.com/Niko1221/Strata/commit/dd146f495534f950847ba8dfff93d9ec9d9712d2) serve: --conversation-cache-disk-only - the conversation cache on disk, no RAM budget - [`b189048`](https://github.com/Niko1221/Strata/commit/b18904801395080df9a5c42190dd5f227200b974) conversation_spill_test: disk-only checks; docs: --conversation-cache-disk-only, measured on Strix Halo - [`ff30368`](https://github.com/Niko1221/Strata/commit/ff30368e4f7ecf0e315d1b2fd7e05cc9bdbf5a75) docs: --conversation-cache-disk-only restores measured from a cold page cache ### 📊 Changes **26 files changed** (+4202 additions, -153 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+4 -1) 📝 `docs/DETAILS.md` (+74 -7) ➕ `docs/RESPONSES_DISK_INTEGRATION.md` (+125 -0) ➕ `docs/RESPONSES_EXPERIMENTAL.md` (+126 -0) ➕ `docs/validation/responses-disk-20261008/cuda-rtx4090.json` (+441 -0) ➕ `docs/validation/responses-disk-20261008/hip-rx7900xtx.json` (+441 -0) 📝 `include/strata/core/conversation_cache.hpp` (+124 -13) 📝 `include/strata/core/conversation_file.hpp` (+28 -0) 📝 `include/strata/core/conversation_snapshot.hpp` (+38 -2) ➕ `include/strata/core/conversation_spill.hpp` (+107 -0) 📝 `serve/frontend.py` (+10 -3) ➕ `serve/response_runner.py` (+147 -0) ➕ `serve/response_store.py` (+220 -0) 📝 `serve/responses.py` (+25 -17) 📝 `serve/server.py` (+109 -25) 📝 `serve/test_responses.py` (+11 -3) ➕ `serve/test_responses_experimental.py` (+447 -0) 📝 `src/core/conversation_file.cpp` (+227 -32) 📝 `src/core/conversation_file_test.cpp` (+122 -0) 📝 `src/core/conversation_snapshot.cpp` (+79 -14) _...and 6 more files_ </details> ### 📄 Description ## Summary Validate #1269, #1271 and #1480 together with instruction/reasoning replay corrections, experimental Responses persistence and optional generated summaries. The point is to test the boundaries between these features: can a chat resume after another chat, a summary pass or a restart without losing its history or restoring the wrong inference state? If KV files are evicted or damaged, the server must rebuild from durable history. This provides a tested core for downstream profile-based applications. ## What changed Preserves the original commit histories. Live testing found and fixed non-MTP snapshot failures: capture and restore now omit the absent draft ring. Adds regression coverage, a live probe and integration notes. Persistence and summary generation remain separate opt-ins. ## Simple examples Enable server options: ```text --experimental-responses-persistence --responses-store-path ./history ``` Add engine options to your existing configuration: ```text --conversation-cache-disk-only --conversation-cache-spill-dir ./kv --conversation-cache-disk-mib 2048 ``` Keep those directories across restarts. Generated summaries remain off by default. Use your configured model name and API key. Each reply is capped at 128 tokens: ```python from openai import OpenAI c = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key="your-key") def ask(text, parent=None): return c.responses.create( model="strata", input=text, previous_response_id=parent, max_output_tokens=128, reasoning={"effort": "none"}) # Code chat, then an independent research chat. code = ask("Write a Python function that squares a number.") research = ask("Explain why a control group matters in an experiment.") # Continue the code chat without resending its history. reply = ask("Add a test for a negative number.", code.id) print(reply.output_text) print(reply.id) # Save this ID; use it as parent after a server restart. ``` The same continuation call works after restart. KV reuse accelerates compatible prefixes; a missing cache does not erase the conversation. ## Validation and merge notes | Check | CUDA / RTX 4090 | HIP / RX 7900 XTX | |---|---:|---:| | Native cache tests | 8 passed | 7 passed | | Live integration checks | 33 passed | 33 passed | | Cached tokens after restart | 1429 | 1429 | Each backend ran 389 API tests with four optional skips; a dependency-enabled follow-up passed 25 tests. Live coverage includes branching, deletion, summaries on/off, cancellation, corrupt-cache fallback and eviction. Validated engine: e6da7e11. Scope: Linux, one GPU, 8K context, int8 KV, MTP off. Maximum context, multi-GPU and live MTP remain unvalidated. This is functional validation, not a speed comparison. Merge the combined candidate once, or use resulting main if its components land separately. Keep downstream profile selection and immutable revision binding in the application. Detailed results: https://github.com/CC-David-CC/Strata-a5500/blob/work/responses-disk-cache-core/docs/RESPONSES_DISK_INTEGRATION.md --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:41:48 +07:00
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#3485
No description provided.