mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#5236
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/4896
Author: @XiaoBinGan
Created: 11/1/2026
Status: 🔄 Open
Base:
main← Head:fix/update-recovers-a-lost-runtime-record📝 Commits (2)
671dfa0Fix #3977 #4872: a lost managed-runtime record is not a model that is running980fd48Read the record's state again before recovering it📊 Changes
2 files changed (+112 additions, -3 deletions)
View changed files
📝
strata_control/updater.py(+35 -3)➕
tests/terminal/test_serving_stale.py(+77 -0)📄 Description
Problem and result
A managed-runtime record whose owner host is gone is not a model that is running.
runtime.active_managed_instances()reports such a record as
state: stale(the host's lease is not held), butupdater.serving_now()returned everynon-stopped record, stale ones included.
strata updatetherefore refused with "a model is running, so nothing waschanged" although nothing was loaded - for as long as the leftover record stayed, and the app told the person to unload a
model they had never loaded.
After the change
serving_now()recovers a stale record with the same pathstrata runtime stopuses - the recordedserver and engine are verified by PID, start time and command line before anything is ended, then the private state is
cleared - and only reports what cannot be cleared (a record whose recorded child is still there, so an engine may really
be serving). A
startingorreadyinstance is reported exactly as before.Reproduction (Windows 11, Python 3.11.16, a private state file written into a temporary runtime folder, no model and no
GPU involved):
This is the same leftover record, and the same
serving_now()result, that #3977's follow-up comment captured on adesktop (
state: stale,serving_now()returning[{"profile": "app-1", "state": "stale"}], and the verified workaroundruntime.stop("app-1")clearing it).Related discussion
#3977 - the report and the maintainer's "check Task Manager next time" reply; its 2026-11-01 follow-up captures the exact
stale-record state and
serving_now()result above, and asks whether the update path could safely recover stale recordsbefore deciding an engine is serving. This does that.
#4872 - the newer report of the same false "a model is running" message with no model loaded (screenshot of the desktop).
Approach
strata_control/updater.py:serving_now()keeps every managed instance except thestaleones in the answer, as before, and returns them whenthere is one (a
startingserver is using the card, areadyone is serving).stale, each is recovered withruntime.stop(profile), which is the existing lost-host path:_stop_lostends only processes that exactly match the record (PID, start time, command line), refuses while arecorded child is still present, and clears state, marker and snapshots. The record's state is read once more first, so
a host that came back between the list and the recovery is reported rather than stopped. A record that cannot be
recovered is reported, so a lost owner with a live child never gets treated as "nothing is serving".
strata serve(no managed record) is still reported.Validation
Passed: the new test fails on an unmodified
strata_control/updater.pyand passes with the change. Withupdater.pyfrom
main(everything else unchanged):With the change:
The three cases are: a real stale record on disk is recovered and
serving_now()is empty, and the record isstoppedafterwards (not merely ignored); a
starting/readymanaged instance is still reported; a stale record whose child isstill there (the recovery refusal) is still reported as serving.
Passed:
python -m pytest tests/terminal/test_updater.py tests/terminal/test_update_feed.py tests/terminal/test_calibration.py -qon this checkout (Windows 11, Python 3.11.16): 119 passed, 4 skipped, 27 subtests passed.
Failed: none.
Not run: a real desktop engine update after a stale-record recovery (#3977's follow-up verified the manual-workaround
version of that); a POSIX lost owner with a live orphan child (the refusal branch is pinned with a mocked
runtime.stop,not with a real orphan). No GPU or model was involved, which is the point of the report.
Limits
stalerecords are recovered. A live host that reportsfailed(its server child exited) is still counted asserving, because it still holds the profile's lease and state; how a failed host releases them is #4574.
runtime.stoppath, so it can take as long as that path takes for the recorded leftovers to beverified and ended. If it cannot verify a process it leaves everything alone and the update is still refused.
serving_now()now has a side effect (it may clear a lost host's record). Callers that only wanted to look -strata update --checkdoes not use it - should note that a stale record is no longer reported.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.