Skip to content

Windows: in-app update refuses with not_controllable — a task-scheduled daemon is misdetected as the Windows service 'Schedule' #537

Closed

Description

@0721-art

Summary

On Windows, a normal (non-administrator) install cannot update in-app: POST /api/app-update commit fails with

{"error":"The local host's supervisor does not permit stopping and restarting its service: PowerShell failed: …调用“Service”时发生异常:“拒绝访问。”","code":"not_controllable"}

The local host daemon in this install is started by the scheduled task omp-web-host (AtLogOn, current user, InteractiveToken) — the shape install-tray.ps1 creates. inspectWindowsSupervisor (lib/upgrade-process.ts) resolves that daemon's supervisor to the Windows service Schedule (Task Scheduler itself) instead of the scheduled task, and then assertUpgradeProcessControl calls [UpgradeControlAccess]::Service("Schedule"), which a non-admin cannot do → access denied → the update is refused before anything is stopped.

Reproduction (against the shipped 0.7.3 code)

Calling your own inspector on the running daemon node process:

import { inspectUpgradeProcess } from "<pkg>/lib/upgrade-process.ts";
const plan = await inspectUpgradeProcess({
  pid: <pid of `node …\ompweb\bin\omp-web.js host`>,
  installDir: "C:/Users/<user>/AppData/Roaming/npm/node_modules/@kahme247/ompweb",
  role: "host",
  launch: { command: "E:/Nodev/node.exe", args: [], cwd: homedir() },
});
// → {"kind":"windows-service","name":"Schedule","configHash":"42a8607f…"}

Expected: {"kind":"windows-task","path":"\\","name":"omp-web-host", …}.

Process chain of the daemon (all the same user):

node.exe  (…\ompweb\bin\omp-web.js  host)
 └ cmd.exe  /d /s /c ""node" "…\omp-web.js" host >> …"
    └ powershell.exe  -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File "…\scripts\windows\omp-web-host.ps1"
       └ svchost.exe  (pid 3336 — the `Schedule` service's host)
          └ services.exe  → wininit.exe

Root cause

inspectWindowsSupervisor excludes service-host processes by executable path:

`$ids = @(${chain.filter((row) => !/(^|[\\/])svchost\.exe$/i.test(row.exe)).map((row) => row.pid).join(",")})`

In a non-admin session, Win32_Process returns an empty ExecutablePath (and CommandLine) for svchost.exe rows:

Schedule service: pid=3336 state=Running
svchost row: name=svchost.exe exe='' cmd=''

So the regex never matches, pid 3336 stays in $ids, and

Get-CimInstance Win32_Service | Where-Object { $ids -contains [int]$_.ProcessId }

returns Schedule — because that service is the svchost the task's tree hangs under. services.length === 1 then wins over the scheduled-task branch, even though omp-web-host is found correctly.

Suggested fix

Match service hosts by process name, not by executable path (paths are unreadable for SYSTEM-owned processes from a non-admin context):

const chain.filter((row) => !/^svchost\.exe$/i.test(row.name ?? basename(row.exe ?? "")))

or, more generally, drop any ancestor whose name (from Get-CimInstance Win32_Process) is a service host, and prefer a matched scheduled task over a service found only through such an ancestor. A regression test can stub Win32_Process rows with an empty ExecutablePath for svchost.exe and assert the supervisor is the task.

Secondary robustness note (not the main report)

launchWindows() starts the detached helper only through WMI Win32_Process.Create and waits 30 s for the pid file. On a machine where the security product kills WMI-created processes, the helper never writes anything and the only symptom is

The detached update worker cannot be started safely: The launcher did not report the started process of …\bun.exe within 30 seconds

I confirmed this is environmental for me (a plain Win32_Process.Create of powershell.exe returns 0 but the process is gone within a second and writes nothing), so I am not claiming a defect there — but a fallback (Start-Process / schtasks /run) and surfacing the WMI ReturnValue would turn a mystery timeout into an actionable message.

Workaround used

Stop the tray (node <pkg>/bin/omp-web-tray.js --stop), npm install -g @kahme247/ompweb@0.7.3 from a neutral cwd, start bin/omp-web-tray.exe -Startup detached again, then schtasks /Run /TN omp-web-host. Everything works on 0.7.3 after that.

Environment

  • Windows 11, non-admin account, node v25.9.0, npm 11.12.1
  • ompweb 0.7.2 → 0.7.3 (npm global), tray + omp-web-host scheduled task; omp runner omp/18.22.0-int.202611172157.ga645f02

Activity

  1. andrebrait commented on Nov 19, 2026

    @andrebrait
    Collaborator

    @0721-art The fix is merged in #539 (2176745) and will ship in the next release. Thanks for the detailed report and for #538.

    If you're able to, could you test it? The check runs in the version that is already installed, so the in-app update to the next release will still use 0.7.3's code. The quickest test is the same inspectUpgradeProcess call from your report, run against lib/upgrade-process.ts from current main: it should return the omp-web-host scheduled task (kind: "windows-task") instead of the Schedule service. Once you're on a release with the fix, the in-app update after it should go through without administrator rights.

  2. 0721-art commented on Nov 19, 2026

    @0721-art
    ContributorAuthor

    Verified on the same machine (21767458), non-admin account, daemon started by the omp-web-host AtLogOn task (pid 30380), launch.cwd = C:\Users\<user>:

    Installed 0.7.3 — lib/upgrade-process.ts from the package:

    {"kind":"windows-service","name":"Schedule","configHash":"42a8607f…"}

    Current main — the same call against the live daemon:

    {"kind":"windows-task","path":"\\","name":"omp-web-host",
     "scripts":["c:/users/<user>/appdata/roaming/npm/node_modules/@kahme247/ompweb/scripts/windows/omp-web-host.ps1"],
     "configHash":"0beeef23039ada2315a024f97709fd3151bc73161580daa0ef29f6b747bbdffe"}

    The fix behaves as described, and the configHash matches the one in your comment, so the task's registered shape is what the merged code expects.

    I will re-run the real in-app update as soon as a release carries the fix and report back here whether it completes without administrator rights. The update into that release still runs 0.7.3's code, so a not_controllable refusal there is the old bug, not a regression of this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions