[PR #727] [CLOSED] Add opt-in durable chat history, legacy import and browser compaction #2792

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/727
Author: @medking82
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: codex/chat-memory


📝 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)

📄 Description

This is a Draft for integration discussion because durable chat storage and compaction overlap #696, #680 and #350. It offers a bounded alternative focused on preserving full legacy branches and making retained history available through read-only MCP memory. Maintainers can assess whether to combine the pieces with those proposals.

The existing web chat retains a single browser conversation. With an explicit chat_archive_path or --chat-archive, this adds a local SQLite archive, conversation and branch selection, Rename, import and full JSON backup. Without that option, existing single-chat/New chat/Undo behavior remains available.

Behavior and preservation

  • Transactional, revision-checked saves prevent stale tabs from overwriting newer history. Import is atomic and existing destination IDs always win on reimport. Original legacy graphs, all branches and the selected currNode path are retained.
  • Read-only import supports same-origin LlamaUi/LlamacppWebui IndexedDB, exported JSON/JSONL and Strata backups. Baseline Strata browser records with name-only attachments retain their raw source and visibly mark missing content; malformed or unsupported legacy formats fail atomically. Remote image URLs are retained without fetching them merely to display history; historical tool calls remain archive data.
  • Browser Auto compact and Compact now summarize earlier rounds while keeping recent rounds verbatim and original messages in the archive. Restore full context uses those originals. Template-aware counting includes offered tools, image reserve and reply headroom. Raw API code/diff/review requests are not silently compacted.
  • Original persistence is required before summary generation. Storage failure and save conflict retain original context, and epoch guards prevent delayed saves or file-read callbacks from changing another selected draft.
  • Builtin memory__search and memory__recall reuse the existing MCP loop, preserve configured providers, and return bounded read-only text with chat/branch/message coordinates and continuation offsets. Literal search supports Chinese text; image bytes are omitted from tool results.
  • Private archive routes require the server's own host/port origin (HTTP or HTTPS) and configured API key and never inherit wildcard API CORS or foreign trusted_origins. A reverse proxy must preserve Host. No account system, filesystem coding agent, external storage service or new inference provider is added.

Limits

The 100 MB cap applies to the whole SQLite database, including duplicated search text, so usable payload capacity is lower; memory results are limited to 12,000 characters. Capacity errors return safe JSON and preserve committed history. Without a configured archive, oversized full-media browser saves preserve the text fallback and display an explicit warning. Retrieval is selective and can miss facts; persistence is not a disk-failure backup. API traffic is not automatically archived. Drafts persist on chat saves/actions; this does not add continuous autosave of unsent edits. Browser compaction is lossy, although full originals remain available. Oversized recent turns may still need shortening.

This contribution is independent of document extraction and adaptive memory budgeting and leaves C++ kernels, model precision, context configuration and lazy vision unchanged. The /strata alias and retirement worker support the transition from an old root UI without deleting legacy browser databases or caches.

Current upstream integration

Head 23f4e24809ccf0fdbcf7a511484b1b23e36d4fc9 integrates upstream main=6f32ec070f23ced9f50e704d854d775da52591ab (0.1.39). The server import/POST conflicts retain both the archive routes and upstream Responses API. Upstream Monitor Conversation cache/MCP and About Model settings remain available. The PR remains Draft because the integration/overlap discussion above is still open.

Template-aware counting now uses upstream Service.encode_prompt, matching actual inference when prompts quote thinking tags or use the trailing effort turn. Two HTTP regressions reproduced the previous undercounts (47 versus 60, and 191 versus 408) before the fix; both now match completion usage. Counting still does not load the model or invoke tools/vision.

Current validation

  • Windows: 40 focused archive, memory, HTTP admission and template-count tests passed.
  • Windows: 240 affected server, MCP, security, lifecycle, Monitor, runconfig, Responses and structured-output tests passed. One existing upstream unclosed-socket ResourceWarning remains visible.
  • 32 Node tests passed, plus 46 import assertions, covering browser-source lifecycle, quota/reload fallback, conflicts, stale callbacks, legacy links and Rename preservation.
  • Browser script/Python syntax checks and the feature diff check against current upstream passed. A generic merge check against the historical branch HEAD reported inherited upstream SYCL whitespace; those files were preserved rather than cleaned up.
  • Isolated synthetic browser acceptance verified send, Rename, New chat retaining prior history, reopening and reload persistence, Monitor Conversation cache/MCP, and About Model settings. Console showed no warning/error entries. No production archive, GPU or real model was used.

The earlier frozen archive fixture additionally verified all 16 originals and both branches survived compaction, Chinese Rename/reload, Restore, inactive branch selection and repeated legacy import. Those older results are retained separately; manual import, branch selection and mobile layouts were not repeated in this integration, and the Node import/library/context checks passed.

One independent Native Review completed with Claude Opus 5.5 on frozen commit bba531515cc7d8032fddf514b1bbf60c6fd15144: three P2 and two P3 findings, no P0/P1. Its same-round Gemini Flash/high attempt failed with native_output_truncated; that failure is retained and is not treated as completed review evidence. All five findings were adjudicated and corrected in follow-up commit ba290b6afe141af6271e5fcee075562794d8a5ab, with its then-current deterministic validation rerun. That Native Review is historical evidence for its frozen input; the current bounded upstream integration has the separate checks above and was not submitted to another model review.


🔄 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/727 **Author:** [@medking82](https://github.com/medking82) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/chat-memory` --- ### 📝 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) ### 📄 Description This is a **Draft for integration discussion** because durable chat storage and compaction overlap [#696](https://github.com/Niko1221/Strata/pull/696), [#680](https://github.com/Niko1221/Strata/pull/680) and [#350](https://github.com/Niko1221/Strata/pull/350). It offers a bounded alternative focused on preserving full legacy branches and making retained history available through read-only MCP memory. Maintainers can assess whether to combine the pieces with those proposals. The existing web chat retains a single browser conversation. With an explicit `chat_archive_path` or `--chat-archive`, this adds a local SQLite archive, conversation and branch selection, Rename, import and full JSON backup. Without that option, existing single-chat/New chat/Undo behavior remains available. ## Behavior and preservation - Transactional, revision-checked saves prevent stale tabs from overwriting newer history. Import is atomic and existing destination IDs always win on reimport. Original legacy graphs, all branches and the selected `currNode` path are retained. - Read-only import supports same-origin `LlamaUi`/`LlamacppWebui` IndexedDB, exported JSON/JSONL and Strata backups. Baseline Strata browser records with name-only attachments retain their raw source and visibly mark missing content; malformed or unsupported legacy formats fail atomically. Remote image URLs are retained without fetching them merely to display history; historical tool calls remain archive data. - Browser Auto compact and Compact now summarize earlier rounds while keeping recent rounds verbatim and original messages in the archive. Restore full context uses those originals. Template-aware counting includes offered tools, image reserve and reply headroom. Raw API code/diff/review requests are not silently compacted. - Original persistence is required before summary generation. Storage failure and save conflict retain original context, and epoch guards prevent delayed saves or file-read callbacks from changing another selected draft. - Builtin `memory__search` and `memory__recall` reuse the existing MCP loop, preserve configured providers, and return bounded read-only text with chat/branch/message coordinates and continuation offsets. Literal search supports Chinese text; image bytes are omitted from tool results. - Private archive routes require the server's own host/port origin (HTTP or HTTPS) and configured API key and never inherit wildcard API CORS or foreign `trusted_origins`. A reverse proxy must preserve Host. No account system, filesystem coding agent, external storage service or new inference provider is added. ## Limits The 100 MB cap applies to the whole SQLite database, including duplicated search text, so usable payload capacity is lower; memory results are limited to 12,000 characters. Capacity errors return safe JSON and preserve committed history. Without a configured archive, oversized full-media browser saves preserve the text fallback and display an explicit warning. Retrieval is selective and can miss facts; persistence is not a disk-failure backup. API traffic is not automatically archived. Drafts persist on chat saves/actions; this does not add continuous autosave of unsent edits. Browser compaction is lossy, although full originals remain available. Oversized recent turns may still need shortening. This contribution is independent of document extraction and adaptive memory budgeting and leaves C++ kernels, model precision, context configuration and lazy vision unchanged. The `/strata` alias and retirement worker support the transition from an old root UI without deleting legacy browser databases or caches. ## Current upstream integration Head `23f4e24809ccf0fdbcf7a511484b1b23e36d4fc9` integrates upstream `main=6f32ec070f23ced9f50e704d854d775da52591ab` (0.1.39). The server import/POST conflicts retain both the archive routes and upstream Responses API. Upstream Monitor Conversation cache/MCP and About Model settings remain available. The PR remains Draft because the integration/overlap discussion above is still open. Template-aware counting now uses upstream `Service.encode_prompt`, matching actual inference when prompts quote thinking tags or use the trailing effort turn. Two HTTP regressions reproduced the previous undercounts (47 versus 60, and 191 versus 408) before the fix; both now match completion usage. Counting still does not load the model or invoke tools/vision. ## Current validation - Windows: 40 focused archive, memory, HTTP admission and template-count tests passed. - Windows: 240 affected server, MCP, security, lifecycle, Monitor, runconfig, Responses and structured-output tests passed. One existing upstream unclosed-socket ResourceWarning remains visible. - 32 Node tests passed, plus 46 import assertions, covering browser-source lifecycle, quota/reload fallback, conflicts, stale callbacks, legacy links and Rename preservation. - Browser script/Python syntax checks and the feature diff check against current upstream passed. A generic merge check against the historical branch HEAD reported inherited upstream SYCL whitespace; those files were preserved rather than cleaned up. - Isolated synthetic browser acceptance verified send, Rename, New chat retaining prior history, reopening and reload persistence, Monitor Conversation cache/MCP, and About Model settings. Console showed no warning/error entries. No production archive, GPU or real model was used. The earlier frozen archive fixture additionally verified all 16 originals and both branches survived compaction, Chinese Rename/reload, Restore, inactive branch selection and repeated legacy import. Those older results are retained separately; manual import, branch selection and mobile layouts were not repeated in this integration, and the Node import/library/context checks passed. One independent Native Review completed with Claude Opus 5.5 on frozen commit `bba531515cc7d8032fddf514b1bbf60c6fd15144`: three P2 and two P3 findings, no P0/P1. Its same-round Gemini Flash/high attempt failed with `native_output_truncated`; that failure is retained and is not treated as completed review evidence. All five findings were adjudicated and corrected in follow-up commit `ba290b6afe141af6271e5fcee075562794d8a5ab`, with its then-current deterministic validation rerun. That Native Review is historical evidence for its frozen input; the current bounded upstream integration has the separate checks above and was not submitted to another model review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:09 +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#2792
No description provided.