fix(updater): harden upgrade restart and rollback#569
Closed
xiami762 wants to merge 3 commits into
Closed
Conversation
Contributor
Author
|
reimplement in #571 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR hardens the self-update restart path for remotely bound and custom-host deployments. It keeps the existing upgrade architecture while fixing dependency-sync timeouts, service-config handoff, daemon shutdown/readiness races, source-only rollback behavior, and failure-state retention.
Key Changes
uv sync --no-python-downloadswithout--frozen;TimeoutExpired.stdoutandTimeoutExpired.stderrin structured logs.distdirectories;webui/distwhen the downloaded source archive does not contain one;ServiceConfiginto the backend environment and handoff arguments;--service-config-jsonby rebuilding the config from the existing host/port and restart CLI arguments;rollback_failedstate and its last error when recovery fails;Impact Scope
_FLOCKS_SERVICE_CONFIGenvironment snapshot. It is generated automatically; there are no new required user settings or secrets.webui/distduring source replacement but does not change frontend-build atomicity.Business Logic to Review
flocks.updater.updater._sync_project_dependencies--default-index.TimeoutExpiredpath logs normalized stdout/stderr.flocks.updater.restart_handoff._prepare_upgrade_handoverflocks.updater.updater._prepare_upgrade_handoverflocks.cli.service_manager._stop_all_unlockedandflocks.updater.restart_handoff._stop_supervisor_before_restartflocks.cli.service_manager._wait_for_supervisor_readyhealthy/staticsupervisor payload is insufficient without a reachable local TCP listener.flocks.updater.updater.resolve_upgrade_runtime_staterollback_faileddiagnostics remain available across a normal start attempt.flocks.cli.service_supervisor.SupervisorDaemonWhy This Approach
The change intentionally applies focused fixes to the existing updater/handoff/supervisor contracts instead of rewriting the upgrade state machine. It uses data already available in legacy handoff arguments for backward compatibility, keeps platform-specific lifecycle behavior isolated, and adds regression tests at each failure seam. Frontend build atomicity is explicitly outside this PR's scope.
Test Plan
.venv/bin/ruff checkon all changed Python filesgit diff --checkOne pre-existing stale test is excluded from the selected suite because it monkeypatches a helper that no longer exists:
test_run_reports_pending_install_receipt_after_pro_bundle_tasks.Compatibility, Migration & Rollback
webui/distis preserved when the incoming source archive omits it.rollback_failedandlast_errorare retained while temporary upgrade-page artifacts are cleaned.