Tool Uninstall Service
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
The Tool Uninstall Service removes every integrated tool recorded on an OpenFrame client endpoint. It is implemented by the openframe_agent_lib dependency from OpenFrame OSS Library, which this repository runs through its OpenFrame client. The service is a local cleanup coordinator: it reads the persisted tool inventory, stops processes, invokes each tool's configured uninstall command, and performs platform-specific residual cleanup.
Its primary operation, uninstall_all, is deliberately best-effort across the inventory. A failure for one tool is logged and does not prevent attempts to remove later tools. Within a single tool's operation, however, required stages fail fast so a failed stop, command, or command exit status is visible rather than treated as a successful removal.
Tool Uninstall Service is responsible for the following endpoint-local work:
osqueryd asset for tool identifiers containing fleet.It does not delete the installed-tool record itself, report a per-tool result to a remote service, or retry a failed uninstaller. Those concerns remain with the surrounding client lifecycle and tool-management services.
The client platform uninstaller assembles this service during integrated-tool cleanup. It creates the installed-tool store, initial-configuration and agent-configuration services, parameter resolver, process-kill service, and directory manager, then calls uninstall_all. This cleanup is therefore part of removal of the OpenFrame client, rather than a message-driven tool update workflow.
A deactivation path can request client self-uninstallation; the platform uninstall flow then delegates integrated-tool removal to Tool Uninstall Service. The service works entirely from local state and the recorded tool metadata once invoked.
flowchart TD
Deactivation["Deactivation Service"] -->|"requests client uninstall"| ClientUninstall["Client platform uninstaller"]
ClientUninstall -->|"creates dependencies"| ToolUninstall["Tool Uninstall Service"]
ToolUninstall -->|"reads inventory"| InstalledTools["Installed Tools Service"]
ToolUninstall -->|"resolves arguments"| Params["Tool Command Parameters Resolver"]
ToolUninstall -->|"stops processes"| Kill["Tool Kill Service"]
ToolUninstall -->|"locates executable"| Directories["Directory Manager"]
ToolUninstall -->|"runs configured command"| ToolProcess["Integrated tool process"]
ToolUninstall -->|"removes residual service"| SystemService["System service adapter"]
| Component | Role |
|---|---|
ToolUninstallService |
Holds the inventory service, command parameter resolver, process-kill service, and directory manager required by the removal workflow. |
new |
Receives the four client services and constructs the coordinator without performing I/O. |
uninstall_all |
Loads all recorded tools, processes them sequentially, removes any leftover registered service for service installations, and continues after per-tool failures. |
| Internal single-tool workflow | Stops the tool, optionally stops osqueryd, resolves arguments, runs the executable, checks its status, and performs post-command cleanup. |
The inventory is represented by InstalledTool, including the stable tool-agent identifier, optional uninstall arguments, installation variant, assets, and record state. The installation variant distinguishes standard binaries, GUI applications, and system services; GUI and service variants drive the specialized cleanup behavior.
The service uses client-library services supplied by the OpenFrame OSS Library dependency:
| Dependency | Interaction during removal |
|---|---|
| Installed Tools Service | Reads the local JSON-backed list of installed tools. If the inventory file does not exist, it returns an empty list and the workflow succeeds without invoking any tool. |
| Tool Command Parameters Resolver | Replaces command placeholders before process launch. Resolution can read the initial server configuration and agent machine identity and can derive local token and asset paths. |
| Tool Kill Service | Stops the installed tool before removal, stops the osqueryd asset for Fleet-related tools, and removes processes still associated with the executable path after a successful uninstall command. |
| Directory Manager | Resolves the tool executable path. Absolute executable paths are used directly; relative paths are located under the client application-support directory and tool identifier; missing paths use the platform default agent name. |
| System Service adapter | Attempts a residual service removal for Service installations. On Windows this delegates to the platform service implementation; on non-Windows targets it is a no-op. |
| Platform GUI cleanup | On macOS, removes the application bundle for GUI applications. On Windows, unregisters the GUI application's autorun entry. |
flowchart LR
Inventory["Installed tool inventory"] --> ToolUninstall["Tool Uninstall Service"]
ToolUninstall --> Params["Parameter resolver"]
Params --> Configuration["Client configuration"]
ToolUninstall --> Paths["Directory Manager"]
Paths --> Executable["Tool executable"]
ToolUninstall --> Kill["Process cleanup"]
ToolUninstall --> Service["Residual service cleanup"]
ToolUninstall --> Gui["GUI bundle or autorun cleanup"]
For each record, Tool Uninstall Service performs the following sequence:
fleet without regard to case, the service stops the osqueryd asset. This is explicitly a targeted compatibility measure for the current Fleet integration.flowchart TD
Start["Load installed tools"] --> HasTools{"Any installed tools?"}
HasTools -->|"no"| Complete["Complete successfully"]
HasTools -->|"yes"| NextTool["Select next tool"]
NextTool --> Stop["Stop recorded tool process"]
Stop --> Fleet{"Fleet tool identifier?"}
Fleet -->|"yes"| StopOsquery["Stop osqueryd asset"]
Fleet -->|"no"| HasCommand{"Uninstall command present?"}
StopOsquery --> HasCommand
HasCommand -->|"no"| GuiCleanup["Clean GUI artifacts if applicable"]
HasCommand -->|"yes"| Resolve["Resolve command arguments"]
Resolve --> Exists{"Executable exists?"}
Exists -->|"no"| GuiCleanup
Exists -->|"yes"| Execute["Run uninstall command"]
Execute --> Success{"Exited successfully within 90 seconds?"}
Success -->|"yes"| ProcessCleanup["Stop remaining executable processes"]
ProcessCleanup --> GuiCleanup
Success -->|"no"| ToolFailure["Log tool failure"]
GuiCleanup --> ServiceCleanup["Remove residual service if applicable"]
ToolFailure --> ServiceCleanup
ServiceCleanup --> More{"More tools?"}
More -->|"yes"| NextTool
More -->|"no"| Complete
The uninstaller process is launched through Tokio with kill_on_drop enabled and separate piped readers for standard output and error output. Readers split byte streams on carriage-return or newline boundaries, convert output lossily to text, trim it, and emit non-empty lines through structured logs. This ensures interactive or verbose uninstallers remain observable without waiting until process completion.
The operation has two time bounds:
| Limit | Value | Behavior |
|---|---|---|
| Uninstall command execution | 90 seconds | The child is killed and the tool result fails if it does not exit in time. |
| Output drain after command completion | 5 seconds per stream | A reader still held open, such as by a detached child that inherited a pipe, is aborted after a warning. |
The output-drain limit prevents a completed uninstaller from blocking the client cleanup flow indefinitely because a descendant process kept standard output or error open.
Tool Uninstall Service distinguishes failure inside a tool workflow from failure across the inventory:
uninstall_all logs the contextual error and continues with the next installed-tool record.sequenceDiagram
participant Caller as Client Uninstaller
participant Service as Tool Uninstall Service
participant Inventory as Installed Tools Service
participant Killer as Tool Kill Service
participant Process as Tool Uninstaller
Caller->>Service: uninstall_all()
Service->>Inventory: get_all()
Inventory-->>Service: installed tools
loop Each recorded tool
Service->>Killer: stop_installed_tool()
Service->>Process: executable with resolved arguments
Process-->>Service: output and exit status
alt Successful exit
Service->>Killer: stop_tool_by_path()
Service->>Service: clean GUI and service remnants
else Failed, timed out, or non-zero exit
Service->>Service: log failure and clean residual service
end
end
Service-->>Caller: aggregate completion
| Installation or platform condition | Behavior |
|---|---|
| Standard installation | Stops the recorded process, then uses the configured uninstaller when available. |
| Service installation | Follows the standard single-tool flow and additionally attempts to remove the named residual service. |
| GUI application on macOS | Attempts to remove the recorded application bundle after command execution, after a missing command, or after a missing executable. |
| GUI application on Windows | Attempts to unregister the tool's autorun entry on the same GUI cleanup paths. |
| Windows command spawn failure | Emits additional file-lock diagnostics before returning the spawn error. |
| Non-Windows system service cleanup | The system-service removal call is a no-op, preserving cross-platform control flow. |
osqueryd handling depends on a substring match in the tool-agent identifier. Changes to Fleet naming or asset ownership should revisit this condition.The implementation belongs to the openframe_agent_lib Cargo dependency from OpenFrame OSS Library, pinned by this repository at version v0.0.5. The OpenFrame OSS Tenant repository publishes the openframe_client Cargo artifact and runs the library code in its OpenFrame client distribution. The authoritative implementation is tool_uninstall_service.rs.