Package Manager Update Gate
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
Package Manager Update Gate is a safety boundary in the Rust OpenFrame client. Before a package update starts, it determines whether the package's installed application is actively in use. It permits an update only when the package has no relevant running process; otherwise it returns a structured block decision that identifies the processes holding the application.
The implementation is supplied by the openframe_agent_lib Cargo artifact from OpenFrame OSS Library, version v0.0.5, and runs in this repository's OpenFrame client deployment. Its source is split between the gate model and resolution module and the decision module.
flowchart LR
PackageUpdate["Package update request"] --> Resolver["Identity resolver"]
PackageUpdate --> Snapshot["Process snapshot"]
Resolver --> Identity["App identity"]
Snapshot --> Processes["Running processes"]
Identity --> Gate["Package Manager Update Gate"]
Processes --> Gate
Gate --> Clear["Clear decision"]
Gate --> Blocked["Blocked decision"]
Blocked --> Status["Update status reporting"]
Clear --> Runner["Package update runner"]
The gate deliberately separates potentially slow system discovery from the deterministic process filter:
resolve identifies whether the package represents an application and, where supported, determines the installation directory and main executable names.snapshot takes a fresh operating-system process snapshot without blocking the asynchronous caller.check converts resolver and snapshot failures into a conservative block, or delegates successful inputs to decide.decide selects qualifying running application instances and returns Clear or Blocked.| Component | Responsibility |
|---|---|
AppIdentity |
Models whether a package has no runnable application (NoApp) or an application installation directory with known or unknown main image names. |
MainImages |
Controls process matching precision. Derived restricts matches to discovered main executable names, while Unknown conservatively accepts any qualifying process below the install directory. |
Holder |
Captures the process ID, executable image path, and optional session of an application instance that prevents an update. |
GateDecision |
Represents the final verdict: Clear or Blocked. |
BlockReason |
Distinguishes an active application from an indeterminate safety condition. |
Undetermined |
Enumerates fail-closed discovery failures, including unsupported managers, missing installation data, resolver errors, and snapshot errors. |
resolve |
Resolves supported package references. Brew formulas are classified as NoApp; macOS Brew casks and Windows Winget packages use platform-specific resolution. |
snapshot |
Runs the process snapshot operation on a blocking task and translates task-join failure into an indeterminate result. |
check |
Combines a resolved identity and process snapshot, blocking whenever either prerequisite is indeterminate. |
decide |
Filters process records and produces the final clear or running-process block decision. |
For an application identity, a process is considered a holder only when all of the following are true:
NoApp always produces Clear; this is used for Brew formulas. An empty holder set also produces Clear. Any qualifying holder yields Blocked(Running), carrying every matched holder so the caller can report actionable state.
The gate treats incomplete evidence as unsafe. A resolver failure, unavailable install location, unsupported package manager, process snapshot failure, or missing installation produces Blocked(Undetermined) rather than allowing the update. This prevents an update from replacing an application when the client cannot reliably determine whether it is active.
The gate is part of the OpenFrame client's package-update flow. The command listener accepts package-update work, the package update runner coordinates it, and the order store and status reporter manage sequencing and visible outcomes. The gate itself has no update side effect: it only observes package identity and current processes, then returns a verdict for the caller to enforce.
sequenceDiagram
participant Listener as "Package Update Handler"
participant Runner as "Update Run Manager"
participant Gate as "Update Gate"
participant OS as "Operating System"
participant Status as "Status Reporter"
Listener->>Runner: Submit package update
Runner->>Gate: Resolve package identity
Gate->>OS: Query package installation
Runner->>Gate: Capture process snapshot
Gate->>OS: List running processes
Runner->>Gate: Check identity and processes
alt application is active or state is unknown
Gate-->>Runner: Blocked decision
Runner->>Status: Report waiting or rejected update
else application is not active
Gate-->>Runner: Clear decision
Runner->>Runner: Continue package update
end
Detailed implementation notes are available for the generated submodules: