[PR #456] [CLOSED] Monitor: the conversation cache card (parked conversations from the engine's CACHE lines) #2650

Closed
opened 2026-11-04 02:02:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/456
Author: @sebastianrcnt
Created: 10/2/2026
Status: ❌ Closed

Base: main ← Head: monitor-conversation-cache


📝 Commits (1)

  • 81265e2 Monitor: the conversation cache card (parked conversations from the engine's CACHE lines)

📊 Changes

6 files changed (+99 additions, -1 deletions)

View changed files

📝 include/strata/core/conversation_cache.hpp (+1 -0)
📝 serve/server.py (+23 -1)
📝 serve/test_server.py (+22 -0)
📝 serve/web/app.js (+26 -0)
📝 serve/web/index.html (+12 -0)
📝 src/program/generate.cpp (+15 -0)

📄 Description

With --conversation-cache-mib the engine parks up to N conversations in RAM (#189), but the web app showed nothing about them. Only the per-request "Reused" column hints that a parked conversation was mounted.

What this adds

  • Engine: CACHE <live tokens> <parked bytes> <evictions> <superseded> [<tokens>:<bytes> ...] (parked conversations least recently active first), printed after READY and after every DONE, only when the conversation cache is on. ConversationCache gets a read-only entries() accessor; nothing else in the engine changes.
  • Server: StrataEngine._pump takes CACHE lines off the stdout stream (so a request's reader never sees them) and keeps the last one; GET /metrics returns it as conversations (budget and slots from the engine arguments, plus the reported state).
  • Monitor: a "Conversation cache" card - RAM used of the budget, the live conversation, each slot (tokens, RAM, empty, and which one is evicted next), and the evicted / superseded (#342) counts since the engine started. Hidden without --conversation-cache-mib.

Compatibility: an older server skips the unknown line (the request loop ignores lines it does not know); with an older engine the card says it is waiting for the first report.

Tested

  • python -m unittest serve.test_server: 89 tests OK, including a new test_conversation_cache_lines (the pump keeps CACHE lines out of the request queue, the last one wins, a malformed one changes nothing, /metrics returns it).
  • Linux, RTX 3090, CUDA 13.2 build of this branch, OrcaRouter IQ3_XXS at 262K with --conversation-cache-mib 8192 --conversation-cache-slots 4: three alternating conversations plus a follow-up turn; the card showed the live conversation (1,919 tokens) and three parked ones (1,753 / 1,106 / 570 tokens, 0.7 of 8.0 GB), matching the engine log.
  • Not tested on Windows or HIP; the engine change is a printf in the serve loop, nothing platform-specific.

🔄 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/456 **Author:** [@sebastianrcnt](https://github.com/sebastianrcnt) **Created:** 10/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `monitor-conversation-cache` --- ### 📝 Commits (1) - [`81265e2`](https://github.com/Niko1221/Strata/commit/81265e25dfd156c6fb86c3e9747a2a6574120c09) Monitor: the conversation cache card (parked conversations from the engine's CACHE lines) ### 📊 Changes **6 files changed** (+99 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/conversation_cache.hpp` (+1 -0) 📝 `serve/server.py` (+23 -1) 📝 `serve/test_server.py` (+22 -0) 📝 `serve/web/app.js` (+26 -0) 📝 `serve/web/index.html` (+12 -0) 📝 `src/program/generate.cpp` (+15 -0) </details> ### 📄 Description With `--conversation-cache-mib` the engine parks up to N conversations in RAM (#189), but the web app showed nothing about them. Only the per-request "Reused" column hints that a parked conversation was mounted. **What this adds** - **Engine:** `CACHE <live tokens> <parked bytes> <evictions> <superseded> [<tokens>:<bytes> ...]` (parked conversations least recently active first), printed after `READY` and after every `DONE`, only when the conversation cache is on. `ConversationCache` gets a read-only `entries()` accessor; nothing else in the engine changes. - **Server:** `StrataEngine._pump` takes `CACHE` lines off the stdout stream (so a request's reader never sees them) and keeps the last one; `GET /metrics` returns it as `conversations` (budget and slots from the engine arguments, plus the reported state). - **Monitor:** a "Conversation cache" card - RAM used of the budget, the live conversation, each slot (tokens, RAM, empty, and which one is evicted next), and the evicted / superseded (#342) counts since the engine started. Hidden without `--conversation-cache-mib`. **Compatibility:** an older server skips the unknown line (the request loop ignores lines it does not know); with an older engine the card says it is waiting for the first report. **Tested** - `python -m unittest serve.test_server`: 89 tests OK, including a new `test_conversation_cache_lines` (the pump keeps CACHE lines out of the request queue, the last one wins, a malformed one changes nothing, `/metrics` returns it). - Linux, RTX 3090, CUDA 13.2 build of this branch, OrcaRouter IQ3_XXS at 262K with `--conversation-cache-mib 8192 --conversation-cache-slots 4`: three alternating conversations plus a follow-up turn; the card showed the live conversation (1,919 tokens) and three parked ones (1,753 / 1,106 / 570 tokens, 0.7 of 8.0 GB), matching the engine log. - Not tested on Windows or HIP; the engine change is a `printf` in the serve loop, nothing platform-specific. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:04 +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#2650
No description provided.