Repository navigation
feat(client-updater): standalone service that swaps the client binary CU-86ah4w34y - #1783
Closed
danylo-babenko-flamingo wants to merge 34 commits into
Closed
danylo-babenko-flamingo wants to merge 34 commits into
danylo-babenko-flamingo wants to merge 34 commits into
Conversation
…en logic New OS service (com.openframe.client-updater) that owns the openframe-client binary swap — a second process is required because Windows locks a running executable. Reuses the client's shared_token.enc when available and falls back to its own OAuth2 client_credentials refresh from agent_config.json; tokens are held in memory only.
Crate part of oss-tenant 3a409150f; that commit's CI matrix entries were oss-tenant's workflow and land here in a separate CI commit.
…to-rollback Update phases run Downloading through VerifyingBoot and Observing. The new binary must write a version-matching boot marker within 90s, then survive a 10-minute observation window; failure at either gate rolls back to the last-known-good reserve. Promotion to the LKG anchor happens only after observation passes.
…s from reserve A message carrying rollback: true is allowed to downgrade; when the target version matches the .lkg reserve it restores offline without a download.
…ng calls, secured-dir perms Durable state writes, corrected JetStream ACK semantics, blocking filesystem calls moved off the async runtime, and hardened secured-directory permissions.
Sidecar *_tests.rs per module: updater state machine, atomic replace, encryption round-trip, versions_match, archive extraction, and phase-string parity with the client's probe contract.
…recovery Applies the 11 external review findings: redelivered duplicates can no longer cancel a live observation window; the backup path is precomputed so a failed replace cannot brick the install; macOS service stop tolerates not-loaded and polls for real termination; crash recovery runs before token wait and NATS connect; promotion requires the service to actually be running; dedicated 300s client download timeout; ACK wait raised to 600s; +crt-static for Windows builds.
oss-lib CI enforces cargo fmt --check; the crate arrived verbatim from oss-tenant, which is unformatted.
… client swap The updater now owns CLIENT_UPDATE end to end: removes the in-client update service, state machine, platform update scripts, and updater launcher. Tool listeners route through park_or_dispatch, which probes the updater's state file and holds messages with AckKind::Progress keep-alives every 60s while a swap is in flight, preserving the JetStream redelivery budget until the new client processes them after restart. Also adds the updater version flag and updater log source. Adapts oss-tenant commits 3813b1443, 6a3851a90, 9afd7f8df, 3346dba1e, and 012127cdb to the agent-lib layout.
Adds the updater's Makefile lint/build/test steps to the test-rust matrix (macOS + Windows), matching the client's steps.
…updater-service-v2
…updater-service-v2 # Conflicts: # clients/openframe-client/src/lib.rs # clients/openframe-client/src/listener/openframe_client_update_listener.rs
# Conflicts: # clients/openframe-client/src/lib.rs
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
denys-gif
reviewed
Sep 3, 2026
…updater-service-v2 # Conflicts: # clients/openframe-client/src/lib.rs # clients/openframe-client/src/listener/openframe_client_update_listener.rs
…e, RAII slot, log rotation
denys-gif
reviewed
Sep 15, 2026
denys-gif
reviewed
Sep 15, 2026
denys-gif
reviewed
Sep 15, 2026
denys-gif
reviewed
Sep 15, 2026
denys-gif
reviewed
Sep 15, 2026
denys-gif
reviewed
Sep 15, 2026
…updater-service-v2
…updater-service-v2
…es, and make the LKG durable
This was referenced Sep 22, 2026
# Conflicts: # clients/openframe-client/Cargo.toml # clients/openframe-client/src/config/update_config.rs # clients/openframe-client/src/services/openframe_client_update_service.rs
…updater-service-v2 # Conflicts: # clients/openframe-client/src/services/tool_run_manager.rs # clients/openframe-client/src/services/update_cleanup_service.rs # clients/openframe-client/src/services/update_handler_service.rs
…updater-service-v2 # Conflicts: # clients/openframe-client/src/lib.rs # clients/openframe-client/src/listener/client_update_gate.rs # clients/openframe-client/src/listener/mod.rs # clients/openframe-client/src/listener/tool_installation_message_listener.rs # clients/openframe-client/src/models/mod.rs # clients/openframe-client/src/services/mod.rs # clients/openframe-client/src/services/openframe_client_update_service.rs # clients/openframe-client/src/services/tool_run_manager.rs # clients/openframe-client/src/services/tool_run_manager_tests.rs # clients/openframe-client/src/services/update_handler_service.rs
…tore path, query_running everywhere
… act only for clients that delegate updates
…tes on client-update.v2
…the updater's staged binary included
…updater-service-v2
Contributor
🦩 Flamingo Code ReviewNot reviewed yet. The tests and checks of this commit ran; the review itself starts when you ask. When it is ready:
Or comment 🧪 Tests and mutationChecks
Updated 2026-10-27 00:00 UTC · workflow run |
…the delivery engine
…updater-service-v2 # Conflicts: # clients/openframe-client/src/services/last_known_good_service.rs # clients/openframe-client/src/services/openframe_client_update_service.rs # clients/openframe-client/src/services/update_state_service.rs
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.
ClickUp task: CU-86ah4w34y Create OpenFrame client updater service
Change-Set: openframe-client-updater
What
Moves the openframe-client binary swap out of the client into a standalone OS service,
openframe-client-updater(com.openframe.client-updater). Windows locks a running executable, so the client cannot replace itself; the updater is a second, independently supervised process that owns client updates and the swap. The client keeps one update duty: installing and updating the updater like any other integrated tool. Neither process ever replaces itself.Ported from openframe-oss-tenant #2180 and brought up to date with main (delivery engine,
ToolOps, per-tenant log key). Client updates come only from the delivery engine. The JetStreamCLIENT_UPDATEpath, the post-boot auto-rollback (CU-86ajbgc93) and the last-known-good ratchet of the original port are removed; see "Not in this PR".How an update arrives
Only through the delivery engine, on
machine.{id}.client-update.v2. The backend paces the rollout in batches, retries, catches up offline machines and reads the outcome frommachine.{id}.delivery.result. The updater handles a delivery as main's in-client handler did:Results stay in
{secured}/updater_deliveries.jsonuntil their stream has stored them, so a crash or a NATS outage can't lose one.How an update runs
downloading(all attempts within 360 s),verifying, then the new binary is staged next to the client's.draining: the client stops taking new work and waits for running tool operations and scripts, the same drain and 600 s cap as before its own restart, then confirms through{secured}/client_drained. The updater stops the client on the confirmation, or after 660 s regardless.stopping_service,replacing_binary(the backup path is persisted before the binary is touched; rename-based swap with retries),starting_service,verifying_boot: the new binary must writeboot.markerwith the target version within 90 s. An unknown service state after the start is left to the boot marker; only a confirmed stop counts against the new binary.completedprogress plusinstalled-agentwith the new version are published.rolledBack: true.Older clients
A client older than this release still updates itself. On every boot the new client writes
{secured}/client_update_delegatedwith its version, just beforeboot.marker, and the updater acts only while the two match. Until then it stays silent onclient-update.v2and the running client answers the delivery itself. This also covers a downgrade back to an older client.Migration: the updater gets installed everywhere and sits idle on old clients, the old clients update themselves into this release, and from then on the updater owns updates.
Crash recovery
On start, before any network access, the updater finishes whatever an interrupted update left:
Updates and recovery share one restore path (
client_binary::restore_previous_binary). Once nothing is in flight, staged binaries and backups left next to the client are swept. The outcome is published once NATS is connected, and the interrupted delivery is answered then.Tokens
The updater reuses the client's
shared_token.enc(AES-GCM). If the client is down or the token is unusable, it refreshes on its own via OAuth2client_credentialsfromagent_config.json. Tokens are kept in memory only.Client side (
openframe-agent-lib)client-update.v2handler, the update service and its state, the PowerShell and shell update scripts, the updater launcher, and the cleanup service.follow_updater_drains) through the restart gate. While the updater shows a phase fromdrainingtoverifying_boot, no new tool operation starts: delivery-engine commands are answered busy, tool messages still on JetStream are parked with progress acks, andToolOpsrefuses new locks (also for internal paths such as mesh self-heal).BootMarkerServicewritesclient_update_delegatedandboot.markeron every boot, throughatomic_writelike the other secured files, and deletes the last-known-good anchor and.lkgreserve binary earlier clients kept.LogSourceKind::Updater), and anopenframe-client-updater-versionbuild feature pins the updater version like the other tools.Not in this PR
CLIENT_UPDATEpath: the updater reads nomachine.all.client-update, so an environment needsCLIENT_UPDATEon the delivery engine before it runs this client (see "Before release")..lkgreserve, promotion,rollback: truerestore). The engine's sequences handle out-of-order deliveries, and a request below the booted version is answered DONE without running.Before release
CLIENT_UPDATEon the delivery engine wherever this client runs. dev and qa have it since openframe-saas-tenant#4195. Stage and prod still send client updates over JetStream, which this client no longer reads:openframe.delivery.enabled.CLIENT_UPDATE: truemust be inconfigs/stageandconfigs/prodbefore this client is published there, or machines that reach it get no further updates until it is.CLIENT_UPDATEneeds a longer result timeout than the engine's 600 s default (download + drain + swap): openframe-saas-tenant#2254 sets 1800 s on dev; stage and prod take it with the switch above.machine.*.client-update-progress(saas-tenantmanifests/tenant/templates/nats/configmap.yaml, and the oss-tenant equivalent). Nothing on the backend reads it yet; until it is allowed, NATS rejects the progress messages. The delivery-engine subjects are already allowed on saas.client-updaterentry in the shared gateway's asset map, are needed before openframe-saas-tenant#2254 registers the tool.Commits since review round 2
48809c2d7drop post-boot observation and auto-rollback33267bda4drop the last-known-good ratchet03a719e1bsplit the update flow, one restore path,query_runningeverywhere (review round 2)ab73d1f38drain the client before a swap; act only for clients that delegate updatesf1cd16fecanswer delivery-engine client updates onclient-update.v27cc95f2fbsweep update leftovers on uninstall again7c200d915take client updates only from the delivery engine: the JetStream listener, its consumer settings and the reconnect re-provisioning go; outcomes are DONE or FAILED as on maindd0e950d2write the update markers throughatomic_write(main's fix(client): recover from corrupt secured files and flush writes to disk CU-17tkuw60gmz #2846 flushes it to disk)978c9e56e,3e20f9d92,689ee1c6amerge mainTests
clippy -D warnings,fmt --check; built and tested on macOS and Windows intest.yml--features bin,fmt --checkChange set
flamingo-stack/openframe-oss-lib#1783: these pull requests are one change, reviewed together.Linked work
Linked by the
Depends-On/Change-Setlines in these descriptions; this block is maintained by the hub.