mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4018] [CLOSED] [GUI] Update and restart from the server's web page (strata update, then the same server again) #4877
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#4877
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/4018
Author: @elightcap
Created: 10/24/2026
Status: ❌ Closed
Base:
main← Head:serve-update-button📝 Commits (1)
f2faca9Web page: Update and restart (strata update from the server, then the same server again)📊 Changes
6 files changed (+590 additions, -2 deletions)
View changed files
📝
docs/DETAILS.md(+12 -0)➕
serve/self_update.py(+244 -0)📝
serve/server.py(+46 -1)➕
serve/test_self_update.py(+199 -0)📝
serve/web/app.js(+77 -1)📝
serve/web/index.html(+12 -0)📄 Description
Problem and result
To update a running server today you go to a terminal: stop the server, run
strata update, then start the server again with the same command and environment. For a server started by a script (run-<model>.shwith its own environment variables) that means finding and re-running that script.With this change the server's web page has an Updates card on the About tab:
strata update --checkand shows what would change, for example "Engine: 0.1.47 → 0.1.48 (189 MiB download)". It reads the signed feed and changes nothing.server_draining, the same as a draining server. Running requests get up to 5 minutes to finish.strata update --model-config <this server's run config>.Related discussion
None for this design. #1266 (closed in the 0.2.0-beta tracker reset, not rejected) added a different engine-update card built on its own updater (
serve/update.py, #1265), from beforestrata updateexisted. This one usesstrata update, so the feed signature, the test start, rollback and the "takes effect after a test start" rules stay in one place.Approach
serve/self_update.pyholds the state behindGET /updateandPOST /update {"action": "check" | "install"}, runsstrata, and does the restart (os.execveofsys.executable+sys.orig_argv, with the environment and folder recorded at the start ofmain()).POST /updatefollows the same rules as/config: JSON from Strata's own page only (_own_page), behind the API key."exe": "component:strata-engine", withstrataon the PATH (or in~/.local/bin) and noSTRATA_NO_ACQUIRE. In every other case it shows the reason instead:strata serve,strata launchor the app started it (main(argv),--owner-fd,--ready-file, a lifecycle sink);exe, whichstrata updatewould not change.exeis read beforewith_component_engine()swaps in the package folder. Read after the swap, the reference is gone.while not svc.updater.restart_wanted), not only on Ctrl+C. Signalling the main thread would not work here:_thread.interrupt_main()does nothing when SIGINT is ignored, which is the case for a server started in the background (nohup ./run-<model>.sh &). The first version used it and the restart never happened in that setup.GET /updateonly reads state. The About tab does show one more card.Validation
Passed:
python -m pytest serve/test_self_update.py, 8 tests (Linux, Python 3.13, this branch onorigin/main7dd5cf18). They use a fakestratathat prints the real--checkand--output jsonlformats, and cover:--model-config, then restarts, with 503server_drainingmeanwhile;text/plain, foreignOrigin, unknown action;python -m pytest serveon this branch: 1026 passed, 15 skipped (the lifeline test below deselected). That run was before the last two small edits: closing the update's pipes, and the wording of the not-supported message.serve/test_self_update.pywas run again after them and passes.serve/server.py --engine mock, started in the background, with a fakestrataon PATH, driven in headless Chromium: check, Update and restart, then the restart in place (same PID, new instance id, chat answers), the page reloads and shows an "Updated" toast.run-agents.shwith"exe": "component:strata-engine"and an API key on 0.0.0.0):Failed:
serve/test_lifeline.py::Lifeline::test_the_portable_watcher_ends_the_child_when_the_server_is_killedfails on this machine with and without this change (checked with the change stashed). Not related.Not run:
strata updatethat installs a new engine from the button on GPU hardware. The update and restart are tested with a fakestrata; the real update's test start isstrata update's own and is unchanged.execveand should behave as on Linux, but it was not run there.strata updatein a terminal" reason there; not run on Windows.Limits
strata serve,strata launchor the app does not get the button. Those would need their parent to do the restart.strata serveruns from the Terminal's own folder does not get the button anyway.--port 0would come back on a new port after the restart.🤖 Generated with Claude Code
https://claude.ai/code/session_013gUv2Q9PHQERdYCFX4DUNm
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.