[PR #2615] [CLOSED] [GUI] add opt-in web chat editing, retry and history rewind #4168

Closed
opened 2026-11-07 15:33:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2615
Author: @uppet
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: web-chat-history-editing


📝 Commits (3)

  • da5914d web: add opt-in message editing and history rewind
  • 8deae1f web: give chat settings a visible, descriptive entry
  • a768457 web: validate history editing against 0.2.0-beta

📊 Changes

7 files changed (+775 additions, -13 deletions)

View changed files

📝 docs/DETAILS.md (+12 -0)
➕ serve/test_web_history.js (+306 -0)
➕ serve/test_web_history.py (+73 -0)
➕ serve/test_web_history_browser.cjs (+183 -0)
📝 serve/web/app.css (+17 -0)
📝 serve/web/app.js (+175 -8)
📝 serve/web/index.html (+9 -5)

📄 Description

Problem and result

When an answer loops or takes a wrong turn, Stop ends generation but the Python server's web chat cannot repair the conversation already sent to the model. Users have to start again or carry the bad answer into subsequent requests.

This adds an opt-in Edit chat history setting under a visible Chat settings button. Users can edit a question and regenerate, correct an assistant answer without generating, regenerate an existing answer, or remove a message and everything after it. A one-step Undo restores the previous history. Editing an earlier turn removes its descendants so the next request uses the corrected conversation.

  • #271: related message-level chat controls.
  • #1787: broader chat-history management; this change does not add a multi-chat sidebar.
  • This updates the existing PR following the 0.2.0-beta tracker-reset notice. Maintainer agreement on this feature's scope has not been recorded. Keeping the PR as a draft for that discussion; the reset notice is not treated as scope approval.

Approach

The feature stays in the existing serve/web client and is off by default. Its preference is saved only in this browser. It does not change the server API, engine, or desktop app.

History changes wait until generation, including Stop finalization, has finished. User edits preserve available attachments; assistant edits remove stale reasoning, tools, errors and timing metadata. Tool results are removed with their parent turn. Missing attachment content after a reload blocks regeneration and asks for reattachment. The composer is locked during an edit, with Save/Cancel and Ctrl/Cmd+Enter/Escape controls.

The rebase preserves main's model-card sampling defaults and explicit overrides. Regression coverage includes edit/retry requests and a fix for New chat leaving an old Undo available after removing the entire conversation.

Validation

Tested source: a768457c8dc71a672bc4a24ffa7ef7de494aa578, rebased onto main e88ee39d1d6be6e3364183af3b39b62a7ed6f211 (0.2.0-beta). Environment: Ubuntu under WSL2/Linux x86_64, Python 3.10.12, Node v24.4.0, Chrome/153.0.8010.12. The runtime checks used a fresh virtual environment with only the repository's pinned requirements.txt; rich and textual were absent.

Passed:

  • python3 -m unittest serve.test_web_history serve.test_web_sampling -v: 22 tests passed, with Node present and no skips. Covers editing/truncation, attachment handling, stale tool cleanup, Undo, Stop/failure boundaries, keyboard controls, and default/legacy/explicit/greedy sampling through real edit/retry request construction.
  • /tmp/strata-pr2615-runtime-20261020/bin/python tools/minimal_server_smoke.py --report ../runtime-smoke-20261020.json: passed. The embedded terminal-runtime suite reported Ran 39 tests in 91.002s; OK (skipped=3): 36 executed, three Windows-only skips. This uses a fake engine, not GPU inference.
  • WEBCHAT_BASELINE_REF=e88ee39d1d6be6e3364183af3b39b62a7ed6f211 node serve/test_web_history_browser.cjs: 7 browser workflows passed. CHROME_BIN pointed to Chromium and puppeteer-core was available as a development tool; neither is a new runtime dependency. The harness serves mock SSE on loopback and blocks external requests. It compares the default-off message DOM and outgoing API payload with unmodified main, then checks settings persistence, user/assistant edits, attachments and unsent drafts, regeneration, truncation, Undo, Stop finalization, and 320/390px layouts. Observed: 7 mock requests, one aborted stream, zero real-model requests, zero page errors.
  • node --check serve/web/app.js, node --check serve/test_web_history.js, node --check serve/test_web_history_browser.cjs, and git diff --check: all passed.

Failed:

  • /tmp/strata-pr2615-runtime-20261020/bin/python -m unittest discover -s serve -p 'test_*.py' -v: 884 passed, one failure, 14 skips (Ran 899 tests in 331.706s; FAILED (failures=1, skipped=14)). The failure is test_lifeline.Lifeline.test_the_portable_watcher_ends_the_child_when_the_server_is_killed: AssertionError: False is not true : the child outlived a killed server (watcher). All 22 web-history/sampling tests passed within this run. Skips concern optional SDK/tokenizer/schema fixtures and Windows-only checks.
  • Isolated comparison: /tmp/strata-pr2615-runtime-20261020/bin/python -m unittest serve.test_lifeline.Lifeline.test_the_portable_watcher_ends_the_child_when_the_server_is_killed -v failed with the same assertion on both this PR (15.075s) and a clean detached checkout of main e88ee39d1d6be6e3364183af3b39b62a7ed6f211 (15.078s), using the same environment. The lifeline code and test are unchanged in this PR. This establishes a baseline failure in this environment; its root cause is not established here, and this PR does not claim a fully green server suite.
  • Resolved during the rebase: the first focused run failed one old assertion expecting the previous hardcoded sampling defaults (temperature: 0.6, top_p: 0.95, top_k: 20). The assertion was updated to main's current behavior: omit untouched defaults and let the server select the model-card values. Added edit/retry regression coverage; the final 22-test run passed.

Not run:

  • GitHub Actions for this head: Minimal serving runtime and Title area currently report action_required, with no test jobs started. Maintainer approval is needed for the fork workflows; the local results above do not claim a CI pass.
  • Real-model/GPU inference, performance measurements, and native Windows browser/server execution. The browser checks use mock SSE, so they do not establish model quality or hardware performance.
  • CUDA, HIP, SYCL and Metal builds: no backend source or build files changed.
  • Desktop apps/host tests: this PR changes the Python server's existing web page, not the desktop app.

Limits

Undo is one in-memory snapshot, cleared by a new ordinary question, New chat, or reload. Attachment contents are not persisted by the existing chat storage, so reloaded attachments need reattachment before replay. Editing or regenerating can run tools again; the editor warns about this.

The default-off comparison covers message DOM and API payload against the stated main revision, not the entire page: the visible Chat settings label and layout are intentional changes even when history editing is off. No performance improvement is claimed. Feature scope still needs maintainer agreement, and the server-suite baseline failure above remains unresolved.


🔄 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/2615 **Author:** [@uppet](https://github.com/uppet) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `web-chat-history-editing` --- ### 📝 Commits (3) - [`da5914d`](https://github.com/Niko1221/Strata/commit/da5914dc20d039355f9d4157da5aabd13af0bf0c) web: add opt-in message editing and history rewind - [`8deae1f`](https://github.com/Niko1221/Strata/commit/8deae1f501811086c4f21063e3057534723fe351) web: give chat settings a visible, descriptive entry - [`a768457`](https://github.com/Niko1221/Strata/commit/a768457c8dc71a672bc4a24ffa7ef7de494aa578) web: validate history editing against 0.2.0-beta ### 📊 Changes **7 files changed** (+775 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+12 -0) ➕ `serve/test_web_history.js` (+306 -0) ➕ `serve/test_web_history.py` (+73 -0) ➕ `serve/test_web_history_browser.cjs` (+183 -0) 📝 `serve/web/app.css` (+17 -0) 📝 `serve/web/app.js` (+175 -8) 📝 `serve/web/index.html` (+9 -5) </details> ### 📄 Description ## Problem and result When an answer loops or takes a wrong turn, Stop ends generation but the Python server's web chat cannot repair the conversation already sent to the model. Users have to start again or carry the bad answer into subsequent requests. This adds an opt-in **Edit chat history** setting under a visible **Chat settings** button. Users can edit a question and regenerate, correct an assistant answer without generating, regenerate an existing answer, or remove a message and everything after it. A one-step Undo restores the previous history. Editing an earlier turn removes its descendants so the next request uses the corrected conversation. ## Related discussion - [#271](https://github.com/Niko1221/Strata/issues/271): related message-level chat controls. - [#1787](https://github.com/Niko1221/Strata/issues/1787): broader chat-history management; this change does not add a multi-chat sidebar. - This updates the existing PR following the [0.2.0-beta tracker-reset notice](https://github.com/Niko1221/Strata/pull/2615#issuecomment-6273860120). Maintainer agreement on this feature's scope has not been recorded. Keeping the PR as a draft for that discussion; the reset notice is not treated as scope approval. ## Approach The feature stays in the existing `serve/web` client and is **off by default**. Its preference is saved only in this browser. It does not change the server API, engine, or desktop app. History changes wait until generation, including Stop finalization, has finished. User edits preserve available attachments; assistant edits remove stale reasoning, tools, errors and timing metadata. Tool results are removed with their parent turn. Missing attachment content after a reload blocks regeneration and asks for reattachment. The composer is locked during an edit, with Save/Cancel and Ctrl/Cmd+Enter/Escape controls. The rebase preserves main's model-card sampling defaults and explicit overrides. Regression coverage includes edit/retry requests and a fix for New chat leaving an old Undo available after removing the entire conversation. ## Validation Tested source: `a768457c8dc71a672bc4a24ffa7ef7de494aa578`, rebased onto main `e88ee39d1d6be6e3364183af3b39b62a7ed6f211` (0.2.0-beta). Environment: Ubuntu under WSL2/Linux x86_64, Python 3.10.12, Node v24.4.0, Chrome/153.0.8010.12. The runtime checks used a fresh virtual environment with only the repository's pinned `requirements.txt`; `rich` and `textual` were absent. **Passed:** - `python3 -m unittest serve.test_web_history serve.test_web_sampling -v`: **22 tests passed**, with Node present and no skips. Covers editing/truncation, attachment handling, stale tool cleanup, Undo, Stop/failure boundaries, keyboard controls, and default/legacy/explicit/greedy sampling through real edit/retry request construction. - `/tmp/strata-pr2615-runtime-20261020/bin/python tools/minimal_server_smoke.py --report ../runtime-smoke-20261020.json`: **passed**. The embedded terminal-runtime suite reported `Ran 39 tests in 91.002s; OK (skipped=3)`: 36 executed, three Windows-only skips. This uses a fake engine, not GPU inference. - `WEBCHAT_BASELINE_REF=e88ee39d1d6be6e3364183af3b39b62a7ed6f211 node serve/test_web_history_browser.cjs`: **7 browser workflows passed**. `CHROME_BIN` pointed to Chromium and `puppeteer-core` was available as a development tool; neither is a new runtime dependency. The harness serves mock SSE on loopback and blocks external requests. It compares the default-off message DOM and outgoing API payload with unmodified main, then checks settings persistence, user/assistant edits, attachments and unsent drafts, regeneration, truncation, Undo, Stop finalization, and 320/390px layouts. Observed: 7 mock requests, one aborted stream, zero real-model requests, zero page errors. - `node --check serve/web/app.js`, `node --check serve/test_web_history.js`, `node --check serve/test_web_history_browser.cjs`, and `git diff --check`: all passed. **Failed:** - `/tmp/strata-pr2615-runtime-20261020/bin/python -m unittest discover -s serve -p 'test_*.py' -v`: **884 passed, one failure, 14 skips** (`Ran 899 tests in 331.706s; FAILED (failures=1, skipped=14)`). The failure is `test_lifeline.Lifeline.test_the_portable_watcher_ends_the_child_when_the_server_is_killed`: `AssertionError: False is not true : the child outlived a killed server (watcher)`. All 22 web-history/sampling tests passed within this run. Skips concern optional SDK/tokenizer/schema fixtures and Windows-only checks. - Isolated comparison: `/tmp/strata-pr2615-runtime-20261020/bin/python -m unittest serve.test_lifeline.Lifeline.test_the_portable_watcher_ends_the_child_when_the_server_is_killed -v` failed with the same assertion on both this PR (15.075s) and a clean detached checkout of main `e88ee39d1d6be6e3364183af3b39b62a7ed6f211` (15.078s), using the same environment. The lifeline code and test are unchanged in this PR. This establishes a baseline failure in this environment; its root cause is not established here, and this PR does not claim a fully green server suite. - Resolved during the rebase: the first focused run failed one old assertion expecting the previous hardcoded sampling defaults (`temperature: 0.6`, `top_p: 0.95`, `top_k: 20`). The assertion was updated to main's current behavior: omit untouched defaults and let the server select the model-card values. Added edit/retry regression coverage; the final 22-test run passed. **Not run:** - GitHub Actions for this head: [Minimal serving runtime](https://github.com/Niko1221/Strata/actions/runs/39377581889) and [Title area](https://github.com/Niko1221/Strata/actions/runs/39377581990) currently report `action_required`, with no test jobs started. Maintainer approval is needed for the fork workflows; the local results above do not claim a CI pass. - Real-model/GPU inference, performance measurements, and native Windows browser/server execution. The browser checks use mock SSE, so they do not establish model quality or hardware performance. - CUDA, HIP, SYCL and Metal builds: no backend source or build files changed. - Desktop `apps/host` tests: this PR changes the Python server's existing web page, not the desktop app. ## Limits Undo is one in-memory snapshot, cleared by a new ordinary question, New chat, or reload. Attachment contents are not persisted by the existing chat storage, so reloaded attachments need reattachment before replay. Editing or regenerating can run tools again; the editor warns about this. The default-off comparison covers message DOM and API payload against the stated main revision, not the entire page: the visible Chat settings label and layout are intentional changes even when history editing is off. No performance improvement is claimed. Feature scope still needs maintainer agreement, and the server-suite baseline failure above remains unresolved. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:33:44 +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#4168
No description provided.