ai_tools: apps collector on Windows can't see per-user-installed AI apps (Ollama, ChatGPT desktop, LM Studio)
Fleet versions
- Discovered: 4.90.0-rc.2608041622 (branch
rc-minor-fleet-v4.90.0) - Reproduced: 4.90.0-rc.2608041622 (branch
rc-minor-fleet-v4.90.0)
Web browser and operating system: N/A — ai_tools osquery table (fleetd), Windows 11 host
💥 Actual behavior
On Windows, the ai_tools table's type='apps' collector returns zero rows for common per-user-installed AI desktop apps (Ollama, ChatGPT desktop, LM Studio), even when they are genuinely installed and actively running.
🛠️ Expected behavior
Apps installed and running under the interactive user's own profile should be detected, matching the multi-user detection behavior already implemented on macOS/Linux.
🧑💻 Steps to reproduce
These steps:
- [x] Have been confirmed to consistently lead to reproduction in multiple Fleet instances.
- [ ] Describe the workflow that led to the error, but have not yet been reproduced in multiple Fleet instances.
- On a Windows host running fleetd, install Ollama using its standard installer as the interactive user (no elevation/admin required).
- Confirm via direct registry inspection that its uninstall entry exists only at
HKEY_USERS\<user-SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\...— nothing underHKLM. - Launch Ollama and confirm it's genuinely running (e.g. via Task Manager, or
SELECT * FROM ai_tools WHERE type='sockets';shows its local listener). - Query
SELECT * FROM ai_tools WHERE type='apps'; - Observe no row for Ollama, despite it being installed and actively running.
🕯️ More info (optional)
Root cause: orbit/pkg/table/ai_tools/internal/apps/apps_windows.go's scanApps() only reads HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (both the 64-bit and WOW6432Node hives) plus registry.CURRENT_USER. Because fleetd/Orbit runs as NT AUTHORITY\SYSTEM, CURRENT_USER in that process always resolves to the SYSTEM account's own (effectively empty) hive — never the real interactive user's. This reproduces for any per-user Electron/Squirrel-style installer (confirmed for Ollama; the same applies to ChatGPT desktop and LM Studio), since none of them offer a machine-wide/HKLM install option to begin with.
Suggested fix: enumerate loaded hives under HKEY_USERS for real user SIDs (mirroring the existing multi-user homes.Home enumeration pattern already used on macOS/Linux) instead of relying on the calling process's own CURRENT_USER.
Found while QA'ing #47619 (ai_tools fleetd table).
Verdict: ✅ PASS — verified end-to-end on a real Windows host, with the root cause empirically demonstrated and both halves of the fix exercised.
Fix: #50771 "Find per-user and MSIX-packaged AI apps in the ai_tools Windows collector" (56e2a285)
RC status: ✅ cherry-picked into rc-minor-fleetd-v1.59.0 via ee17edf281; ai_tools tree identical to main
Host: cabbage (id 80), Windows 11 Home 25H2 x86_64, osquery 5.23.1, orbit 26.8.25221 built from the RC branch
Test plan execution
| # | Step | Result |
|---|---|---|
| 1 | Install Ollama as the interactive user, no elevation | ✅ Ollama version 0.32.8, publisher Ollama, install location C:\Users\xpkoa\AppData\Local\Programs\Ollama\ |
| 2 | Confirm the uninstall entry exists only under HKEY_USERS\<SID>, nothing in HKLM |
✅ see registry table below |
| 3 | Confirm it's genuinely running (type='sockets' shows its local listener) |
✅ ollama.exe listening on port 11434, pid 28872 |
| 4-5 | Query SELECT * FROM ai_tools WHERE type='apps' |
✅ ollama row present — this was the bug (no row) |
Step 2 — registry provenance, queried live on the host:
| Hive | Ollama DisplayName entries |
|---|---|
HKLM\...\CurrentVersion\Uninstall |
0 |
HKLM\SOFTWARE\WOW6432Node\...\Uninstall |
0 |
HKEY_USERS\S-1-5-21-…-1001\...\Uninstall |
1 |
Exactly the precondition the ticket describes: the app is recorded only in the installing user's hive.
Root cause demonstrated, not merely inferred. Querying HKEY_CURRENT_USER\...\Uninstall as the SYSTEM-context agent sees it returns 0 total entries — not zero Ollama entries, zero entries of any kind. That is direct confirmation of the ticket's analysis: the pre-fix collector read HKLM (0 Ollama entries) plus CURRENT_USER (SYSTEM's own empty hive), so a per-user install could never be found.
Steps 4-5 — type='apps' result:
| name | version | source | scope | running | pid | port | path |
|---|---|---|---|---|---|---|---|
ollama |
0.32.8 | registry | user | 1 | 28872 | 11434 | C:\Users\xpkoa\AppData\Local\Programs\Ollama\ |
claude-desktop |
1.22209.3.0 | appx | user | 1 | 49244 | 0 | C:\Program Files\WindowsApps\Claude_1.22209.3.0_x64__pzs8sxrjxfjjc |
Both halves of #50771 confirmed:
HKEY_USERSwalk — theollamarow,source=registry,scope=user, found in the interactive user's hive by an agent running asNT AUTHORITY\SYSTEM.- MSIX/Appx pass — the
claude-desktoprow,source=appx, correctly scopeduser. MSIX packages register nowhere near the uninstall keys, so this is a genuinely separate code path.
Liveness cross-check: the apps row reports pid=28872 / port=11434, and the independent sockets collector reports ollama.exe on 11434 at pid 28872 — the same PID derived from a different code path, confirming markRunning() and the knownApps port mapping (ollama → 11434) are both correct. The sockets pass also surfaced ollama app.exe on ephemeral port 54516 (identifier=unknown), which is the GUI helper — expected, not a defect.
Code review
uninstallRoots() in apps_windows.go builds an ordered root list: HKLM + WOW6432Node (system) → CURRENT_USER (user, retained so the collector still works when running unprivileged) → HKEY_USERS\<SID> for each real-user hive (user). Machine-wide roots come first, so an app installed both ways keeps scope=system, preserving prior behavior.
isRealUserHive() (usersid.go) accepts only S-1-5-21- (local/domain) and S-1-12-1- (Entra ID) SID prefixes and rejects *_Classes hives, correctly excluding service accounts and per-user class registrations. scanAppx() shares the same collector, so an app discovered by both passes is reported once. Code comments match the ticket's root-cause analysis precisely.
| Check | Result |
|---|---|
GOOS=windows go build ./orbit/pkg/table/ai_tools/... |
✅ clean |
GOOS=windows go vet ./.../apps/... |
✅ clean |
go test ./.../apps/... (platform-neutral appx.go, collect.go, usersid.go) |
✅ pass |
| Windows CI coverage | the cherry-pick adds the package to .github/workflows/test-go-windows.yml |
Re-confirmed against the later #51093 fix
After the substring-matching fix landed (branch 51093-ai_tools-apps-issues-with-fuzzy-logic, cherry-picked onto the RC as orbit 26.8.51093), this ticket's behavior was re-verified on the same host — no regression:
| name | identifier | version | source | scope | running | pid | port |
|---|---|---|---|---|---|---|---|
Ollama version 0.32.8 |
ollama |
0.32.8 | registry | user | 1 | 25176 | 11434 |
Claude |
claude-desktop |
1.22209.3.0 | appx | user | 1 | 12232 | 0 |
Agents now see each user's apps Ollama and ChatGPT desktop Hidden tools come clear