[PR #350] [CLOSED] Chat: a context gauge, per-request timings, and conversation compaction #2591

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/350
Author: @orangeswim
Created: 10/1/2026
Status: ❌ Closed

Base: main ← Head: context-and-compaction


📝 Commits (10+)

  • 5a30024 calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447)
  • 9f60d13 serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448)
  • eb8da1d /metrics: each request's speculative draft counts, and their sums in the totals (#457)
  • 6a09387 setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)
  • d6a91e2 docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)
  • d8d4ad3 Merge branch 'f-135-eng' into rel-0.1.35
  • 7b600d5 Merge branch 'f-135-small' into rel-0.1.35
  • d9ab843 Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it
  • 57bd713 sycl: pipeline the expert cache's profile fill (model load 3-4x faster)
  • e3bdd74 A prompt cancelled mid-read is logged and recorded with the tokens it read (#471)

📊 Changes

8 files changed (+409 additions, -19 deletions)

View changed files

📝 docs/DETAILS.md (+4 -2)
➕ serve/test_compaction.py (+30 -0)
📝 serve/web/app.css (+28 -5)
📝 serve/web/app.js (+176 -12)
➕ serve/web/compact-prompt.js (+20 -0)
➕ serve/web/compaction.js (+40 -0)
📝 serve/web/index.html (+5 -0)
➕ serve/web/test_compaction.mjs (+106 -0)

📄 Description

Chat: a context gauge, per-request timings, and conversation compaction

Follow-up to the prefill-speed PR (#163 took the Monitor half); this is everything
else from that review thread. No server change — server.py and telemetry.py
are untouched.

Context gauge. 2.4k/200K with a fill bar next to the sampling button. Amber
at 70% of the window, red at 90%. Updates from usage after each reply. Passive -
it never triggers anything.

Request timings in chat. A chevron on each reply opens one muted line:
read 25,838 tokens @ 2,165 tok/s · 1,850 reused · TTFT 12.4 s · drafts 214 of 240 accepted. It is the response's existing timings block (llama.cpp's names) -
kept in localStorage with the message. The requests table gains a PP t/s column
beside decode, computed in the UI from the history fields the server already
returns (net of the reused cache share).

Compaction. The compact button summarizes the older turns:

  • The newest turns stay verbatim up to a ~5k-token budget - a token budget, not a
    message count, since six large pastes would defeat the fold; a single message
    over twice the budget goes to the summarized part instead, however recent
  • The summary is one hidden non-streaming request (thinking on low, temp 0):
    seven sections (intent; facts and decisions; verbatim code and artifacts; all
    user messages; errors and fixes; open items; current thread), told to extract
    rather than describe and that it may be long - capped at 5k tokens, clamped to
    the window's remaining room (the server 400s an over-window request), with a
    warning when the cap truncates it. The prompt lives in its own file
    (web/compact-prompt.js), editable without touching app.js
  • The kept turns are appended to the summary as an exact verbatim transcript
    (client-built, never paraphrased), so the payload after any compaction is
    exactly [summary] + newer messages
  • The summary marker lands at the end of the chat with its stats; only the
    newest summary can be put back, and undo peels one layer at a time. The page
    keeps every message, muted above the cut
  • Long user messages (>10 lines / 800 chars) clamp with a Show-all toggle -
    display only, the API gets the full text

The payload's compaction rules live in web/compaction.js (pure; loaded by the
app and by web/test_compaction.mjs - the cut boundary, chained summaries,
undo-after-a-merge, the full-coverage marker shape, corrupt-marker handling;
node serve/web/test_compaction.mjs), run with the suite through
serve/test_compaction.py (skips loudly where node is absent). All serve tests
pass unchanged.

AI Tooling

Claude-code with GLM-5.3, Strata qwen3.8-flash-next-coder-iq1_m

image image image image

🔄 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/350 **Author:** [@orangeswim](https://github.com/orangeswim) **Created:** 10/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `context-and-compaction` --- ### 📝 Commits (10+) - [`5a30024`](https://github.com/Niko1221/Strata/commit/5a3002446dbb9dfcabb7d0bd9f113da90cc2f3c0) calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447) - [`9f60d13`](https://github.com/Niko1221/Strata/commit/9f60d13246e46b02b1dd0841980b4d18b0faaea7) serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448) - [`eb8da1d`](https://github.com/Niko1221/Strata/commit/eb8da1d8c26ec41e6ffb084fdf579dba7cad10bd) /metrics: each request's speculative draft counts, and their sums in the totals (#457) - [`6a09387`](https://github.com/Niko1221/Strata/commit/6a093874fe037020f49bd5cf053879ff6a133c21) setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444) - [`d6a91e2`](https://github.com/Niko1221/Strata/commit/d6a91e2d1770d0f469d6ec15890acc7ee93e764c) docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438) - [`d8d4ad3`](https://github.com/Niko1221/Strata/commit/d8d4ad337d3c98ba21d3bd0af1a16e9177e112b6) Merge branch 'f-135-eng' into rel-0.1.35 - [`7b600d5`](https://github.com/Niko1221/Strata/commit/7b600d55ff801caaaa11542af1523050992e049b) Merge branch 'f-135-small' into rel-0.1.35 - [`d9ab843`](https://github.com/Niko1221/Strata/commit/d9ab8435f654c368c586340d490915f6addf56a3) Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it - [`57bd713`](https://github.com/Niko1221/Strata/commit/57bd713454ddb4b965f994e95d95cacd68c93fb1) sycl: pipeline the expert cache's profile fill (model load 3-4x faster) - [`e3bdd74`](https://github.com/Niko1221/Strata/commit/e3bdd7449223c4305ef53e331538346765855a2c) A prompt cancelled mid-read is logged and recorded with the tokens it read (#471) ### 📊 Changes **8 files changed** (+409 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+4 -2) ➕ `serve/test_compaction.py` (+30 -0) 📝 `serve/web/app.css` (+28 -5) 📝 `serve/web/app.js` (+176 -12) ➕ `serve/web/compact-prompt.js` (+20 -0) ➕ `serve/web/compaction.js` (+40 -0) 📝 `serve/web/index.html` (+5 -0) ➕ `serve/web/test_compaction.mjs` (+106 -0) </details> ### 📄 Description # Chat: a context gauge, per-request timings, and conversation compaction Follow-up to the prefill-speed PR (#163 took the Monitor half); this is everything else from that review thread. No server change — `server.py` and `telemetry.py` are untouched. **Context gauge.** `2.4k/200K` with a fill bar next to the sampling button. Amber at 70% of the window, red at 90%. Updates from `usage` after each reply. Passive - it never triggers anything. **Request timings in chat.** A chevron on each reply opens one muted line: `read 25,838 tokens @ 2,165 tok/s · 1,850 reused · TTFT 12.4 s · drafts 214 of 240 accepted`. It is the response's existing `timings` block (llama.cpp's names) - kept in localStorage with the message. The requests table gains a PP t/s column beside decode, computed in the UI from the history fields the server already returns (net of the reused cache share). **Compaction.** The compact button summarizes the older turns: - The newest turns stay verbatim up to a ~5k-token budget - a token budget, not a message count, since six large pastes would defeat the fold; a single message over twice the budget goes to the summarized part instead, however recent - The summary is one hidden non-streaming request (thinking on low, temp 0): seven sections (intent; facts and decisions; verbatim code and artifacts; all user messages; errors and fixes; open items; current thread), told to extract rather than describe and that it may be long - capped at 5k tokens, clamped to the window's remaining room (the server 400s an over-window request), with a warning when the cap truncates it. The prompt lives in its own file (`web/compact-prompt.js`), editable without touching app.js - The kept turns are appended to the summary as an exact verbatim transcript (client-built, never paraphrased), so the payload after any compaction is exactly `[summary] + newer messages` - The summary marker lands at the end of the chat with its stats; only the newest summary can be put back, and undo peels one layer at a time. The page keeps every message, muted above the cut - Long user messages (>10 lines / 800 chars) clamp with a Show-all toggle - display only, the API gets the full text The payload's compaction rules live in `web/compaction.js` (pure; loaded by the app and by `web/test_compaction.mjs` - the cut boundary, chained summaries, undo-after-a-merge, the full-coverage marker shape, corrupt-marker handling; `node serve/web/test_compaction.mjs`), run with the suite through `serve/test_compaction.py` (skips loudly where node is absent). All serve tests pass unchanged. ### AI Tooling Claude-code with GLM-5.3, Strata qwen3.8-flash-next-coder-iq1_m <img width="1124" height="878" alt="image" src="https://github.com/user-attachments/assets/cf7c401a-67c0-4851-820f-9c39c59cbae1" /> <img width="950" height="529" alt="image" src="https://github.com/user-attachments/assets/e31f2967-c7a6-4407-8361-9adc661aaefd" /> <img width="877" height="483" alt="image" src="https://github.com/user-attachments/assets/dbb5bd2e-3ba6-4f7f-9c30-10142225e2a0" /> <img width="854" height="414" alt="image" src="https://github.com/user-attachments/assets/676f3574-b575-47ec-b3ea-14a1dd386ecf" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:36 +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#2591
No description provided.