mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2615] [CLOSED] [GUI] add opt-in web chat editing, retry and history rewind #4168
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4168
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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)
da5914dweb: add opt-in message editing and history rewind8deae1fweb: give chat settings a visible, descriptive entrya768457web: 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.
Related discussion
Approach
The feature stays in the existing
serve/webclient 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 maine88ee39d1d6be6e3364183af3b39b62a7ed6f211(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 pinnedrequirements.txt;richandtextualwere 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 reportedRan 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_BINpointed to Chromium andpuppeteer-corewas 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, andgit 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 istest_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./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 -vfailed with the same assertion on both this PR (15.075s) and a clean detached checkout of maine88ee39d1d6be6e3364183af3b39b62a7ed6f211(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.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:
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.apps/hosttests: 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.