Doctor Healing
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
Doctor Healing is the remediation layer of the OpenFrame Client doctor workflow. It receives diagnostic CheckResult values from the surrounding doctor subsystem, extracts the remediations requested by failed checks, and executes every distinct action once. In the current implementation, the supported action is installing the Microsoft Edge WebView2 Runtime when the WebView2 diagnostic reports it missing.
The module is implemented by the openframe_agent_lib Rust library from OpenFrame OSS Library, which this repository runs through the OpenFrame Client. The Windows-specific installer is implemented in the library's WebView2 installer source.
Doctor Healing does not decide whether a machine is healthy. Health checks assign remediations, and doctor reporting owns diagnostic status and presentation. Healing consumes those results and produces remediation outcomes; it does not mutate the original report.
flowchart TD
Checks["Doctor health checks"] -->|"CheckResult values"| Report["Doctor report"]
Report -->|"results with remediation"| Pending["pending()"]
Pending -->|"unique remediations"| Heal["heal()"]
Heal -->|"InstallWebview2"| Installer["WebView2 installer"]
Installer -->|"HealOutcome"| Results["HealResult collection"]
Installer -->|"re-check runtime"| WebViewCheck["WebView2 runtime check"]
Heal --> Logs["Tracing logs"]
| Component | Responsibility |
|---|---|
pending |
Scans supplied check results, takes each attached remediation, and returns a deduplicated list in first-seen order. |
heal |
Iterates over pending remediations, logs each attempt, dispatches the action, and returns one HealResult per action. |
HealResult |
Associates the remediation that was attempted with its final HealOutcome. |
HealOutcome |
Represents either a verified repair or a failure message suitable for reporting and logs. |
| WebView2 installer | Windows-only implementation that downloads, verifies, silently installs, and then detects the runtime. |
The orchestrator intentionally treats remediations as a sequence, rather than stopping after an individual failure. Consequently, a failed action is captured in its own HealResult while subsequent distinct actions can still run if the remediation set grows in the future.
flowchart TD
Start["Receive doctor check results"] --> Collect["Collect attached remediations"]
Collect --> Unique["Keep first occurrence of each remediation"]
Unique --> Next["Select next remediation"]
Next --> Run["Run mapped healing action"]
Run --> Status{"Action healed?"}
Status -->|"yes"| RecordSuccess["Record Healed result"]
Status -->|"no"| RecordFailure["Record failure message"]
RecordSuccess --> More{"More remediations?"}
RecordFailure --> More
More -->|"yes"| Next
More -->|"no"| Finish["Return all healing results"]
The pending function uses equality on remediation values to remove duplicates. This prevents the same repair from running repeatedly when multiple checks recommend it, while preserving the order in which the doctor workflow encountered it.
Remediation::InstallWebview2 is dispatched to the WebView2 installer. The installer is applicable only on Windows. On other operating systems, it reports a failed outcome explaining that WebView2 installation is Windows-only; it does not attempt a cross-platform substitute.
On Windows, the OpenFrame Client normally runs with elevated service privileges. The installer stages the Microsoft Evergreen bootstrapper under the agent's secured directory with a random file name, then uses a silent, machine-wide installation attempt.
sequenceDiagram
participant Heal as "Doctor Healing"
participant Installer as "WebView2 Installer"
participant Microsoft as "Microsoft Download"
participant PowerShell
participant RuntimeCheck as "Runtime Check"
Heal->>Installer: Run InstallWebview2 remediation
Installer->>Microsoft: Download Evergreen bootstrapper
Installer->>Installer: Stream bytes to secured temporary file
Installer->>PowerShell: Verify Authenticode signature
PowerShell-->>Installer: Microsoft signature status
Installer->>Installer: Run silent machine-wide installer
loop "Up to 12 verification attempts"
Installer->>RuntimeCheck: Check WebView2 registration
RuntimeCheck-->>Installer: Pass or not yet available
end
Installer-->>Heal: Healed or Failed
The installer includes several controls around the downloaded executable:
The verification phase runs even while evaluating the installer process result. This accommodates the bootstrapper spawning an updater child that completes registration after the bootstrapper exits. A zero exit code alone is not considered a verified repair: the runtime must be detected machine-wide.
Each failed remediation is converted into HealOutcome::Failed with contextual error text. Examples include download failures, oversized content, a failed or timed-out signature check, inability to start the installer, a nonzero installer exit status, and the runtime remaining undetected after polling.
The module logs the remediation before dispatch, logs a success after a verified repair, and logs the remediation plus error text on failure. Callers should retain the returned HealResult values alongside the original doctor report so that diagnostic findings and attempted repairs remain distinguishable.
To add a remediation:
Remediation variant in the doctor reporting model.CheckResult.Healed only after independently verifying the required condition.The dispatcher currently has a single InstallWebview2 branch. Its explicit matching makes unsupported remediation variants a compile-time maintenance concern when the remediation model changes.
Doctor Healing is local agent behavior. It uses the client platform abstraction for secured directories and PowerShell resolution, and it reuses the doctor WebView2 runtime check as its verification source. It does not call the OpenFrame gateway or API directly, does not publish a remediation event, and does not alter agent registration, authentication, or tool-management state.