mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #645] [CLOSED] Update the engine from the web app, cautiously #2739
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#2739
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/645
Author: @demetree
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:update-from-ui📝 Commits (6)
e35dc44Update the engine from the web app, cautiouslyf7943cbClean up the archive and staging copy; document the updater681bde2Three fixes the browser found, by running it30f08b4Review fixes: restore the test file I clobbered, and fix what the review found234681dRestructure the run loop, and check the card where the release's archs are knownb01086aMatch the download step by key, not by its label📊 Changes
9 files changed (+2204 additions, -0 deletions)
View changed files
📝
docs/DETAILS.md(+25 -0)📝
docs/INSTALL.md(+21 -0)📝
serve/server.py(+109 -0)➕
serve/test_update.py(+594 -0)➕
serve/test_update_http.py(+440 -0)➕
serve/update.py(+733 -0)📝
serve/web/app.css(+24 -0)📝
serve/web/app.js(+240 -0)📝
serve/web/index.html(+18 -0)📄 Description
Please read #670 first
I did not know, when I started this, that
setup.pyalready replaces an outdated engine:update_installed_engine()runs on everySTART-HERE.bat(setup.py:3042, 3058), andUPDATE.bat(#475) does it deliberately without starting the model.
get_prebuilt()even checks the release's ownarchsagainst your GPU after unpacking.So this is a second way to reach one outcome — replacing the engine binary — not a missing
capability. #670 asks where you would rather it live, with three options, and says plainly that if the
answer is "keep it to showing the version" then most of this should be closed. I would rather ask than
presume. The engine half of updating already exists; the progress and the backup do not exist anywhere.
What it actually is
An Update the engine card in the About tab. Not a whole-install update: that is
UPDATE.bat, whichalso does
git pull, the Python packages, and each model's settings and draft subset. This touches theengine files only, and says so on the card.
Nine steps, and the order is the safety property:
BUILD.jsonwithreleases/latest--help, before the installed one is touched.strata-update/backup-<timestamp>, three keptBUILD.jsonbackNothing on disk changes until step 7. From step 8 on, any failure restores the backup and the card says
so, naming the folder.
One correction to my earlier description of this
I previously claimed the card check ran before the download and refused in 0.3–0.5 s instead of
fetching 124 MB. That was wrong, and wrong in an interesting way: it compared the card against the
installed engine's
archs, because the release'sBUILD.jsonis inside the zip. In the onlyreachable real case — a card below 7.5 running
STRATA_EXPERIMENTAL_SM60=1, whose engine listssm_61— it passed, and the 124 MB download went ahead anyway. The 0.3–0.5 s figure only existedbecause I had hand-edited
BUILD.jsonto make it fire.It now runs at step 4, where the release's own architectures are known, which is where
get_prebuilt()does the same check. Still four steps before anything changes, and the message is specific:
The cost is the download. The benefit is that it is no longer a guess — and it can now catch the case
that actually bites, a release that drops an architecture the installed one had. There is a test
pinning exactly that: a 6.1 card must be allowed when the release carries
archs: [61]and theinstalled engine claimed
[75, 86, 89, 120].Refusals, each measured rather than assumed
ZipFile.testzip()before extracting anythingBUILD.jsondisagrees with the tagarchs/ptxvs the card, at step 4check()unload()refuses withbusyAn unknown card is not refused: a wrong refusal costs the user their update, a wrong install costs
them an engine that will not start, and they can always update by hand.
Progress, not a spinner
Replacing a 113 MB binary and stopping the model is not a "Working..." moment. Every step is listed with
its own state, the download reports its own byte count, and the failure line says what was restored
and names the folder. The bar shows the download's byte percent while downloading and the step percent
after it — the first version flashed 100% during the check phase, because that phase has one step and
the run has nine.
State is polled, matching the rest of the panel. An update left running is picked up again when the page
reopens, so the card shows how it ended.
Guards
Both POST routes carry the same
_own_pagecheck as/settingsand/unload: JSON only, no foreignOrigin, so a cross-site form post cannot trigger an update.GET /api/update/stateonly reads. Oneupdate at a time. And it stops the model first, through the same
unload()the UI already uses.Integrity: a real limit, not an oversight
The release publishes no checksum and
BUILD.jsoncarries none. What is verified: the download sizeagainst the API, every member's CRC, every member's path, the version inside, the release's own
architectures, and the staged binary running. That catches a truncated download, a corrupt archive, a
wrong artifact and an incompatible one — and it is not proof the bytes came from your release.
Closing that needs a checksum in the release process; #670 asks whether you want one.
Tests
No network, no GPU, no 124 MB download — the release JSON, the download and the archive are built
locally. The HTTP test builds a real
Service(MockEngine(...), ByteTokenizer(), ChatTemplate(...))theway
serve/test_server.pydoes, so a missing attribute is a real bug rather than a gap in the test, andit no longer depends on the GPU of whichever machine runs it. Cases that must not update are asserted
as firmly as the ones that must: truncated download, corrupt archive, unsafe path, version mismatch, an
engine that will not run, an incompatible card, a downgrade, a missing asset, an update while busy.
Rollback was verified over real files by forcing a failure after the apply step: every installed file
came back byte-for-byte (SHA-256 before and after), with the backup left on disk.
Note on
serve/test_security.py: two or three tests there flake on this machine withConnectionAbortedError, on a pristine checkout with these changes stashed (3/5 runs). A Windowsloopback socket flake, unrelated to this PR.
Measured on
Windows 11, GTX 1070 (compute capability 6.1), Xeon E5-2680, driver 582.66, CUDA 12.6. Refusal timings
and the download timing are from this machine. The card refusal is specific to a GPU below 7.5, so a
supported card takes the normal path — and on this machine the full success path was exercised against a
local archive holding the engine that does run here, not against your release.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.