Skip to content

Find per-user and MSIX-packaged AI apps in the ai_tools Windows collector - #50771

Open
juan-fdz-hawa wants to merge 1 commit into
mainfrom
50704-ai_tools-apps-collector-on-windows-cant-see-per-user-installed-ai-apps
Open

Find per-user and MSIX-packaged AI apps in the ai_tools Windows collector#50771
juan-fdz-hawa wants to merge 1 commit into
mainfrom
50704-ai_tools-apps-collector-on-windows-cant-see-per-user-installed-ai-apps

Conversation

@juan-fdz-hawa

@juan-fdz-hawa juan-fdz-hawa commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
Screenshot 2026-08-07 at 3 32 25 PM

Resolves #50704

scanApps read only HKLM plus the calling process's CURRENT_USER. Because fleetd runs as NT AUTHORITY\SYSTEM, CURRENT_USER resolves to SYSTEM's own empty hive, so per-user Electron/Squirrel installers (Ollama, ChatGPT desktop, LM Studio) were invisible — none of them offers a machine-wide install to begin with.

Walk the loaded hives under HKEY_USERS for real user SIDs, skipping _Classes hives and service accounts. Machine-wide roots are still searched first so an app installed both ways keeps scope "system".

Checklist for submitter

If some of the following don't apply, delete the relevant line.

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • New Features

    • Added Windows MSIX/Appx discovery for installed and per-user packages.
    • App records now include improved vendor, version, installation path, source, and scope details.
    • Combined registry and MSIX/Appx scanning reduces duplicate application entries.
    • Expanded registry scanning across machine, current-user, and loaded real-user profiles.
  • Bug Fixes

    • Unreadable registry locations, directories, and manifests no longer interrupt collection.
    • Resource-only packages and invalid metadata are filtered out.
    • Improved handling of package identity and publisher information.

@juan-fdz-hawa

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f10083b-9f4c-45f6-940a-fed4a8481626

📥 Commits

Reviewing files that changed from the base of the PR and between e53f89e and 6055e47.

📒 Files selected for processing (2)
  • orbit/pkg/table/ai_tools/internal/apps/appx.go
  • orbit/pkg/table/ai_tools/internal/apps/appx_scan_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • orbit/pkg/table/ai_tools/internal/apps/appx.go

Walkthrough

Windows app scanning now discovers uninstall entries from machine-wide, current-user, and loaded real-user registry hives. It filters non-user hives and skips registry access failures. Appx/MSIX scanning reads staged and per-user package directories, filters resource packages, extracts metadata, and assigns scope. A shared collector deduplicates registry and Appx results while preserving discovery order and metadata. Tests cover parsing, scanning, vendor extraction, hive filtering, and collection behavior.

Possibly related PRs

  • fleetdm/fleet#49243: This PR extends the Windows registry-based app scanning code introduced by that pull request.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the Windows collector changes for per-user and MSIX-packaged AI applications.
Description check ✅ Passed The description links issue #50704, explains the root cause and fix, and records automated and manual testing.
Linked Issues check ✅ Passed The changes enumerate real user hives, detect per-user applications, retain machine-wide precedence, and address issue #50704 objectives.
Out of Scope Changes check ✅ Passed The implementation, shared collection logic, MSIX support, documentation, and tests are related to the Windows app detection objectives.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 50704-ai_tools-apps-collector-on-windows-cant-see-per-user-installed-ai-apps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@orbit/pkg/table/ai_tools/internal/apps/usersid.go`:
- Around line 26-29: The isRealUserHive logic must validate complete SIDs rather
than accepting any non-empty suffix after a known prefix. In
orbit/pkg/table/ai_tools/internal/apps/usersid.go lines 26-29, update
isRealUserHive to require decimal SID segments and the correct segment count for
every accepted SID form. In
orbit/pkg/table/ai_tools/internal/apps/usersid_test.go lines 12-33, add coverage
for malformed suffixes including non-numeric segments and incorrect segment
counts.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 70e15708-8735-4917-8c4c-fa8f32f89e2a

📥 Commits

Reviewing files that changed from the base of the PR and between f656ac5 and 2763e08.

📒 Files selected for processing (3)
  • orbit/pkg/table/ai_tools/internal/apps/apps_windows.go
  • orbit/pkg/table/ai_tools/internal/apps/usersid.go
  • orbit/pkg/table/ai_tools/internal/apps/usersid_test.go

Comment thread orbit/pkg/table/ai_tools/internal/apps/usersid.go
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.46835% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.54%. Comparing base (f292c7d) to head (6055e47).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
orbit/pkg/table/ai_tools/internal/apps/appx.go 96.80% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #50771      +/-   ##
==========================================
+ Coverage   68.50%   68.54%   +0.04%     
==========================================
  Files        3974     3980       +6     
  Lines      255606   256253     +647     
  Branches    13658    13658              
==========================================
+ Hits       175108   175661     +553     
- Misses      64901    64975      +74     
- Partials    15597    15617      +20     
Flag Coverage Δ
backend 69.65% <97.46%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@juan-fdz-hawa
juan-fdz-hawa force-pushed the 50704-ai_tools-apps-collector-on-windows-cant-see-per-user-installed-ai-apps branch from 2763e08 to e961610 Compare August 7, 2026 18:01
@juan-fdz-hawa juan-fdz-hawa changed the title Enumerate HKEY_USERS in the ai_tools Windows apps collector Find per-user and MSIX-packaged AI apps in the ai_tools Windows collector Aug 7, 2026
@juan-fdz-hawa
juan-fdz-hawa marked this pull request as ready for review August 7, 2026 19:38
@juan-fdz-hawa
juan-fdz-hawa requested a review from a team as a code owner August 7, 2026 19:38
@juan-fdz-hawa juan-fdz-hawa self-assigned this Aug 7, 2026
@juan-fdz-hawa
juan-fdz-hawa force-pushed the 50704-ai_tools-apps-collector-on-windows-cant-see-per-user-installed-ai-apps branch from e961610 to e53f89e Compare August 7, 2026 19:38
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@orbit/pkg/table/ai_tools/internal/apps/appx_scan_test.go`:
- Around line 60-71: Extend TestScanAppxDirsResourcePackageSkipped to create a
package with a custom resource ID and a manifest containing
<Properties><ResourcePackage>true</ResourcePackage></Properties>. Verify
scanAppxDirs produces zero apps, covering resource packages that do not use the
split. prefix.

In `@orbit/pkg/table/ai_tools/internal/apps/appx.go`:
- Around line 43-45: The resource-package check in appxPackage.isResourcePackage
must use Properties/ResourcePackage from readAppxManifest() when the manifest is
readable, while retaining the split. ResourceID prefix check only as the
unreadable-manifest fallback. In
orbit/pkg/table/ai_tools/internal/apps/appx.go#L43-L45, update the
manifest-based candidate filtering accordingly; in
orbit/pkg/table/ai_tools/internal/apps/appx_scan_test.go#L60-L71, add coverage
for a non-split. ResourceID with ResourcePackage=true.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2681906b-0762-4f69-a5c9-7cc569a1f580

📥 Commits

Reviewing files that changed from the base of the PR and between fc97ff2 and e53f89e.

⛔ Files ignored due to path filters (1)
  • orbit/pkg/table/ai_tools/README.md is excluded by !**/*.md
📒 Files selected for processing (10)
  • orbit/pkg/table/ai_tools/internal/apps/apps.go
  • orbit/pkg/table/ai_tools/internal/apps/apps_windows.go
  • orbit/pkg/table/ai_tools/internal/apps/appx.go
  • orbit/pkg/table/ai_tools/internal/apps/appx_scan_test.go
  • orbit/pkg/table/ai_tools/internal/apps/appx_test.go
  • orbit/pkg/table/ai_tools/internal/apps/appx_windows.go
  • orbit/pkg/table/ai_tools/internal/apps/collect.go
  • orbit/pkg/table/ai_tools/internal/apps/collect_test.go
  • orbit/pkg/table/ai_tools/internal/apps/usersid.go
  • orbit/pkg/table/ai_tools/internal/apps/usersid_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • orbit/pkg/table/ai_tools/internal/apps/usersid.go
  • orbit/pkg/table/ai_tools/internal/apps/usersid_test.go

Comment thread orbit/pkg/table/ai_tools/internal/apps/appx_scan_test.go
Comment thread orbit/pkg/table/ai_tools/internal/apps/appx.go
…ctor

Resolves #50704

The apps collector read only HKLM and CURRENT_USER uninstall keys. Because
the extension runs as SYSTEM, CURRENT_USER resolves to SYSTEM's own empty
hive, so per-user Electron/Squirrel installers (Ollama, LM Studio) that
offer no machine-wide option were invisible. Walk real users' loaded hives
under HKEY_USERS instead, filtering to account SIDs (S-1-5-21-, S-1-12-1-)
and skipping the redundant _Classes sub-hives.

That still misses MSIX/Store packages, which register in the AppModel
repository and never write an uninstall entry at all. Add a second pass
over it, taking identity and version from the package full name.
@juan-fdz-hawa
juan-fdz-hawa force-pushed the 50704-ai_tools-apps-collector-on-windows-cant-see-per-user-installed-ai-apps branch from e53f89e to 6055e47 Compare August 7, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ai_tools: apps collector on Windows can't see per-user-installed AI apps (Ollama, ChatGPT desktop, LM Studio)

1 participant