Platform Tool Updater Standard
OpenFrame Documentation
Get the most out of OpenFrame · Book 30 minutes with Conrad, 25 years in IT. He'll show you what Mingo and Fae can take off your list.
OpenFrame Documentation
Platform Tool Updater Standard is the OpenFrame client agent's update strategy for a tool installed as a regular executable rather than as a managed operating-system service or a macOS GUI application. It implements the common update contract supplied by OpenFrame OSS Library, stops the running tool, protects the current executable with a backup, writes the replacement binary, and restores the backup if the write phase fails.
The implementation is supplied by the openframe_agent_lib Cargo dependency from OpenFrame OSS Library at version v0.0.5. The tenant repository runs it through the OpenFrame client; the implementation source is standard.rs.
StandardToolUpdater owns the executable replacement lifecycle for an Installation::Standard record:
It does not choose which version to apply, persist tool records, or publish installed versions. Those activities belong to the surrounding tool update service and common updater orchestration.
The standard updater is one implementation of the ToolUpdater lifecycle. The factory selects it for standard installations. On non-macOS platforms, the factory also temporarily uses it for GUI application installations while a platform-specific GUI updater is unavailable.
flowchart LR
UpdateMessage["Tool update message"] --> UpdateService["Tool Agent Update Service"]
UpdateService --> Orchestrator["Common updater orchestration"]
Orchestrator --> Factory["Updater factory"]
Factory --> StandardUpdater["Platform Tool Updater Standard"]
Factory --> ServiceUpdater["Service tool updater"]
Factory --> GuiUpdater["GUI application updater"]
StandardUpdater --> KillService["Tool kill service"]
StandardUpdater --> DirectoryManager["Directory manager"]
StandardUpdater --> DownloadService["Download and binary writer"]
StandardUpdater --> RunManager["Tool run manager"]
DownloadService --> Executable["Updated executable"]
RunManager --> Executable
The common updater module defines four asynchronous lifecycle operations:
| Operation | Standard updater behavior |
|---|---|
prepare |
Stops the tool, resolves its executable path, clears stale aside state, logs survivors, and backs up the executable. |
apply |
Downloads and writes the new executable. It returns no replacement installation metadata because the installation remains standard. |
finalize |
Removes the backup and leaves restart execution to the run manager. |
rollback |
Restores the backed-up executable after a failed apply operation. |
The updater factory dispatches by installation kind. A standard installation, represented by Installation::Standard, always selects StandardToolUpdater.
flowchart TD
Start["Installed tool"] --> InstallationType{"Installation type?"}
InstallationType -->|"Standard"| StandardUpdater["Standard tool updater"]
InstallationType -->|"Service"| ServiceUpdater["Service tool updater"]
InstallationType -->|"GUI application on macOS"| GuiUpdater["GUI application updater"]
InstallationType -->|"GUI application on other systems"| FallbackUpdater["Standard tool updater fallback"]
StandardToolUpdater::new receives a ToolUpdaterDeps value. Although the dependency bundle includes a command-parameter resolver, the standard updater directly uses the following dependencies:
| Dependency | Use in this module |
|---|---|
| Tool kill service | Stops processes whose command matches the tool agent identifier before the binary is changed. |
| Directory manager | Resolves the canonical executable path for the installed tool. |
| Download service | Participates in downloading and writing the replacement binary through the common helper. |
The update inputs are:
| Input | Relevant fields | Purpose |
|---|---|---|
| Installed tool | Tool agent identifier, installation descriptor, executable path | Identifies the executable and determines where it is stored. |
| Download configuration | Operating system, source link, source filename, target filename, installation type | Identifies the artifact selected for the client platform. |
| Update context | Optional backup path and restart flag | Carries state between lifecycle phases. |
If an executable path is absolute, the directory manager uses it directly. If it is relative, it resolves it below the client application-support directory and the tool agent identifier. When the path is omitted, the default executable name is agent.exe on Windows and agent on other supported platforms.
The common orchestration invokes preparation, application, and finalization in sequence. It catches an error from application, attempts rollback, then returns the original application error. A finalization failure is reported to the caller but does not cause the common orchestration to invoke rollback.
sequenceDiagram
participant Service as Tool Agent Update Service
participant Core as Common Update Orchestrator
participant Standard as Standard Tool Updater
participant Kill as Tool Kill Service
participant Files as Tool File System
participant Download as Download Service
participant Runner as Tool Run Manager
Service->>Core: run update for installed tool and configuration
Core->>Standard: prepare tool
Standard->>Kill: stop tool by agent identifier
Standard->>Files: resolve executable, clear aside, create backup
Standard-->>Core: update context with backup and restart required
Core->>Standard: apply tool and configuration
Standard->>Download: download and write executable
alt application succeeds
Standard-->>Core: unchanged installation metadata
Core->>Standard: finalize tool and context
Standard->>Files: remove backup
Standard-->>Core: success
Core-->>Service: update complete
Service->>Runner: resume supervised tool execution
else application fails
Standard-->>Core: application error
Core->>Standard: rollback tool and context
Standard->>Files: restore executable from backup
Standard-->>Core: rollback result
Core-->>Service: application error
end
Preparation is deliberately destructive only after the running process has been stopped:
UpdateContext containing that optional path and needs_restart: true.The context allows later phases to operate on the exact backup created for this update, rather than recomputing or guessing a rollback path.
Application resolves the same executable path and delegates artifact retrieval and replacement to the common binary-download helper. The helper receives the download configuration, destination path, and tool agent identifier. This separates transport and file-write behavior from installation-specific lifecycle decisions.
The standard updater returns None for replacement installation metadata. In other words, a standard executable update does not change the Installation classification or its path description.
On successful application, finalization removes the backup. The updater does not launch the executable itself; it logs that it will be automatically restarted by the tool run manager. The restart flag in the context documents that requirement to the surrounding workflow.
This boundary prevents the updater from competing with the client runtime's supervision and coordination responsibilities.
Only an apply failure initiates the rollback branch in the common orchestrator. The updater recalculates the target executable path and asks the common restore helper to replace it from the backup path recorded in the context.
flowchart TD
Prepare["Prepare update"] --> StopTool["Stop running tool"]
StopTool --> StopOk{"Tool stopped?"}
StopOk -->|"No"| Abort["Return preparation error"]
StopOk -->|"Yes"| Backup["Clear stale aside state and back up executable"]
Backup --> Apply["Download and write replacement"]
Apply --> ApplyOk{"Write succeeded?"}
ApplyOk -->|"Yes"| Finalize["Remove backup"]
Finalize --> Restart["Run manager restarts tool"]
ApplyOk -->|"No"| Rollback["Restore executable from backup"]
Rollback --> Failed["Return application error"]
If restoration also fails, common orchestration logs that secondary failure while preserving the original application failure as the returned error. Operators should therefore examine both the primary update error and rollback log entries when a device remains in an inconsistent state.
The tool update service is the policy and persistence boundary around this updater. Before invoking the update process, it:
The standard updater therefore assumes that it is given a valid installed-tool record and a download configuration already chosen for the host. Its concerns are local process control, executable replacement, and recovery.
When changing Platform Tool Updater Standard, keep these invariants intact:
DirectoryManager rather than constructing installation paths directly; it centralizes absolute, relative, and default executable-path rules.UpdateContext as the sole rollback source for the active update.For questions, implementation feedback, or coordination with maintainers, use the OpenMSP Slack community.