Skip to content

windows_mdm: link enrollment row via DevDetail at first management session#46268

Merged
getvictor merged 7 commits into
mainfrom
victor/45380-windows-mdm-row
Jun 2, 2026
Merged

windows_mdm: link enrollment row via DevDetail at first management session#46268
getvictor merged 7 commits into
mainfrom
victor/45380-windows-mdm-row

Conversation

@getvictor

@getvictor getvictor commented May 27, 2026

Copy link
Copy Markdown
Member

Closes the race after Windows BYOD MDM enrollment (Settings > Access work or school > Connect) where mdm_windows_enrollments.host_uuid stayed empty for ~10s while osquery's distributed-read cycle ran directIngestMDMDeviceID Windows. During that gap any server-side lookup keyed on host UUID via MDMWindowsGetEnrolledDeviceWithHostUUID returned NotFound.

processIncomingMDMCmds now inspects unlinked enrollments on every management session: it parses any incoming Results for ./DevDetail/Ext/Microsoft/SMBIOSSerialNumber, looks up the Windows host by hardware_serial, and updates host_uuid. If still unlinked after processing the incoming message, it appends a Get for that LocURI to the response so the device replies on the next round-trip. The Get is idempotent and reinjected each session until linkage succeeds.

The post-link UPN/SCIM/DEP bookkeeping previously inlined in directIngestMDMDeviceIDWindows is extracted into a shared helper (osquery_utils.LinkWindowsHostMDMEnrollment) so both the new SyncML path and the osquery direct-ingest backstop run it exactly once per linkage.

New datastore method WindowsHostLiteByHardwareSerial does a Windows-only serial lookup and returns NotFound when two Windows hosts share a serial, so we never mis-link on virtualization-shared SMBIOS values.

For Autopilot and Entra-during-OOBE the host record does not exist until fleetd installs later in ESP, so the osquery backstop and the name-based fallback in setup_experience.go remain in place for those flows.

Related issue: Resolves #45380

Checklist for submitter

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

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
  • Timeouts are implemented and retries are limited to avoid infinite loops

Testing

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

Summary by CodeRabbit

  • New Features

    • Immediately link Windows BYOD MDM enrollments to host records during the first management session when a device serial is present, and prompt the device to resend serial info if missing.
    • Detect and ignore placeholder/ambiguous hardware serials to avoid incorrect host linking.
    • Reduce noisy warnings for internal-sync command IDs.
  • Bug Fixes

    • Resolve a race causing Windows MDM enrollments to remain unlinked for several seconds.
  • Tests

    • Added coverage for serial-based linkage, retry behavior, placeholder detection, and internal-command ID handling.

…ssion

Closes the race after Windows BYOD MDM enrollment (Settings > Access work
or school > Connect) where mdm_windows_enrollments.host_uuid stayed empty
for ~10s while osquery's distributed-read cycle ran directIngestMDMDeviceID
Windows. During that gap any server-side lookup keyed on host UUID via
MDMWindowsGetEnrolledDeviceWithHostUUID returned NotFound.

processIncomingMDMCmds now inspects unlinked enrollments on every
management session: it parses any incoming Results for
./DevDetail/Ext/Microsoft/SMBIOSSerialNumber, looks up the Windows host
by hardware_serial, and updates host_uuid. If still unlinked after
processing the incoming message, it appends a Get for that LocURI to the
response so the device replies on the next round-trip. The Get is
idempotent and reinjected each session until linkage succeeds.

The post-link UPN/SCIM/DEP bookkeeping previously inlined in
directIngestMDMDeviceIDWindows is extracted into a shared helper
(osquery_utils.LinkWindowsHostMDMEnrollment) so both the new SyncML path
and the osquery direct-ingest backstop run it exactly once per linkage.

New datastore method WindowsHostLiteByHardwareSerial does a Windows-only
serial lookup and returns NotFound when two Windows hosts share a serial,
so we never mis-link on virtualization-shared SMBIOS values.

For Autopilot and Entra-during-OOBE the host record does not exist until
fleetd installs later in ESP, so the osquery backstop and the name-based
fallback in setup_experience.go remain in place for those flows.

Refs #45380
@getvictor getvictor requested a review from Copilot May 27, 2026 17:03
@getvictor

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@getvictor

Copy link
Copy Markdown
Member Author

/agentic_review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented May 27, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0)

Grey Divider


Remediation recommended

1. Stale HostUUID not corrected ✓ Resolved 🐞 Bug ☼ Reliability
Description
tryLinkUnlinkedEnrollmentFromDevDetail only sets enrolledDevice.HostUUID when
LinkWindowsHostMDMEnrollment returns updated=true, so if the row was already linked (updated=false)
but the in-memory enrolledDevice still has HostUUID="", the rest of the request will continue to
behave as unlinked. This can cause the server to inject redundant DevDetail Gets and keep downstream
logic in the same request seeing an empty HostUUID even though the DB linkage already exists.
Code

server/service/microsoft_mdm.go[R1739-1748]

Evidence
The code sets in-memory HostUUID only on updated==true, while LinkWindowsHostMDMEnrollment
explicitly returns without further action on updated==false. Since processIncomingMDMCmds
decides whether to append the DevDetail Get based solely on the in-memory enrolledDevice.HostUUID,
a stale/empty in-memory value will cause redundant Gets and keep the request behaving as unlinked
even if DB linkage already exists; reader-backed enrollment reads plus writer-backed updates make
such stale state possible.

server/service/microsoft_mdm.go[1708-1748]
server/service/microsoft_mdm.go[1906-1913]
server/service/osquery_utils/queries.go[3053-3060]
server/datastore/mysql/microsoft_mdm.go[67-97]
server/datastore/mysql/microsoft_mdm.go[1146-1158]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`tryLinkUnlinkedEnrollmentFromDevDetail` updates `enrolledDevice.HostUUID` only when `LinkWindowsHostMDMEnrollment` reports `updated=true`. If the enrollment row is already linked to the same host (so `updated=false`) but the `enrolledDevice` object used in the request still has an empty `HostUUID`, the remainder of `processIncomingMDMCmds` will still treat it as unlinked and append the DevDetail Get.
This can happen when the enrollment was linked by another path or when reads can be stale relative to writes (e.g., reader vs writer connections).
### Issue Context
- `LinkWindowsHostMDMEnrollment` returns early when `updated=false`.
- `processIncomingMDMCmds` appends a Get whenever `enrolledDevice.HostUUID == ""`.
- `MDMWindowsGetEnrolledDeviceWithDeviceID` is reader-backed while the update uses the writer.
### Fix Focus Areas
- server/service/microsoft_mdm.go[1708-1748]
- server/service/microsoft_mdm.go[1906-1913]
- server/service/osquery_utils/queries.go[3053-3060]
- server/datastore/mysql/microsoft_mdm.go[67-97]
- server/datastore/mysql/microsoft_mdm.go[1146-1158]
### Suggested fix
After a successful host lookup by serial and a successful call to `LinkWindowsHostMDMEnrollment` (err == nil), set `enrolledDevice.HostUUID = host.UUID` even when `updated == false`.
This is safe because `UpdateMDMWindowsEnrollmentsHostUUID` only returns `updated=false` when the row already has the same `host_uuid` value (it updates only when `host_uuid <> ?`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Copilot AI 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.

Pull request overview

This PR closes a post-enrollment race for Windows (notably BYOD) where mdm_windows_enrollments.host_uuid remains empty until osquery’s next distributed-read cycle, causing server-side lookups by host UUID to miss the enrollment. It makes the SyncML management session proactively link the enrollment to the host by requesting and consuming ./DevDetail/Ext/Microsoft/SMBIOSSerialNumber, and centralizes the “post-link bookkeeping” in a shared helper.

Changes:

  • Add a shared LinkWindowsHostMDMEnrollment helper to perform the enrollment→host link plus one-time post-link reconciliation (IDP mapping/SCIM/DEP flag updates).
  • In Windows MDM SyncML processing, attempt linkage from incoming DevDetail Results and inject an idempotent DevDetail Get when still unlinked.
  • Add datastore support for looking up a Windows host by hardware_serial (with ambiguity protection) plus accompanying tests.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
server/service/osquery_utils/queries.go Extracts shared Windows enrollment↔host linkage + post-link bookkeeping into LinkWindowsHostMDMEnrollment.
server/service/microsoft_mdm.go Adds DevDetail-based linkage attempt during management sessions and reinjects a DevDetail Get until linked.
server/service/mdm_test.go Adds unit coverage for the DevDetail-based linkage behavior (Get injected, link on Results, retry behavior).
server/mock/datastore_mock.go Extends mock datastore with WindowsHostLiteByHardwareSerial support for tests.
server/fleet/datastore.go Adds WindowsHostLiteByHardwareSerial to the datastore interface.
server/datastore/mysql/microsoft_mdm.go Implements Windows-only host lookup by hardware_serial with ambiguity handling.
server/datastore/mysql/microsoft_mdm_test.go Adds MySQL datastore tests for WindowsHostLiteByHardwareSerial.
changes/45380-windows-mdm-enrollment-row-linkage Adds changelog entry describing the race fix and new linkage mechanism.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/service/microsoft_mdm.go Outdated
Comment thread server/service/microsoft_mdm.go Outdated
Comment thread server/service/osquery_utils/queries.go Outdated
Comment thread server/datastore/mysql/microsoft_mdm.go Outdated
@coderabbitai

coderabbitai Bot commented May 27, 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

Run ID: ce0155c8-649a-418c-a5c7-e6fe60229cf2

📥 Commits

Reviewing files that changed from the base of the PR and between 0f5a921 and 681083b.

📒 Files selected for processing (1)
  • changes/45380-windows-mdm-enrollment-row-linkage
✅ Files skipped from review due to trivial changes (1)
  • changes/45380-windows-mdm-enrollment-row-linkage

Walkthrough

This pull request implements automatic linkage of unlinked Windows MDM enrollments to Fleet hosts during the first management session using SMBIOS serial data from OMA-DM DevDetail results. Previously, enrollment-to-host linkage relied on osquery distributed-read backfill, which could leave the enrollment unlinked for several seconds. The new mechanism extracts the SMBIOS serial from SyncML DevDetail results, resolves the corresponding Windows host by hardware serial, and establishes the linkage immediately. If the enrollment remains unlinked after processing (no DevDetail result received), the server injects a SyncML Get command for the serial so the device returns it on the next round-trip, enabling linkage in a subsequent session.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: implementing a new primary linkage mechanism for Windows MDM enrollments via DevDetail serial at the first management session.
Description check ✅ Passed The PR description comprehensively covers the problem, solution, key changes, and testing performed. All major checklist items are addressed with explicit checkbox markings.
Linked Issues check ✅ Passed The PR fully addresses all five objectives from issue #45380: populates host_uuid server-side via DevDetail serial lookup, enables deterministic server lookups, keeps osquery as backstop, prevents mis-linking with ambiguous serials, and maintains Autopilot/OOBE flow support.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the Windows MDM enrollment linkage objectives: datastore methods, helper functions, SyncML processing logic, and comprehensive tests for the new linkage flow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch victor/45380-windows-mdm-row

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 and usage tips.

@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: 4

🤖 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 `@server/datastore/mysql/microsoft_mdm.go`:
- Line 207: The SELECT for first-session linkage currently uses a replica
connection via ds.reader(ctx) which can return stale NotFound results; change
the read to use the primary connection (e.g., replace ds.reader(ctx) with
ds.writer(ctx) or call ctxdb.RequirePrimary(ctx) before invoking
sqlx.SelectContext) for the sqlx.SelectContext call that queries into &hosts
using stmt and hardwareSerial so this race-sensitive first-session lookup always
hits primary.

In `@server/service/microsoft_mdm.go`:
- Around line 1713-1725: The loop that extracts the SMBIOS serial currently only
inspects the first item (op.Cmd.Items[0]) and must be changed to scan all items
in each Results command: inside the for _, op := range reqMsg.GetOrderedCmds()
block (checking op.Verb == mdm_types.CmdResults and len(op.Cmd.Items) > 0),
iterate over op.Cmd.Items, for each item check item.Source != nil &&
*item.Source == devDetailSMBIOSSerialNumberURI and item.Data != nil, then set
serial = strings.TrimSpace(item.Data.Content) and break out once found; keep the
existing continue guards for non-Results commands unchanged.
- Around line 1739-1747: The call to osquery_utils.LinkWindowsHostMDMEnrollment
can return (false, nil) when another path already linked the DB row, but the
current code only sets enrolledDevice.HostUUID when updated==true; change the
logic in the block around LinkWindowsHostMDMEnrollment (in microsoft_mdm.go) so
that if err==nil you always set enrolledDevice.HostUUID = host.UUID (regardless
of the updated boolean) after the call to LinkWindowsHostMDMEnrollment to ensure
the in-memory enrollment reflects the DB state and prevents requeuing DevDetail
Get or skipping ESP progression.

In `@server/service/osquery_utils/queries.go`:
- Around line 3054-3099: The current flow can leave the enrollment half-linked
if UpdateMDMWindowsEnrollmentsHostUUID returns updated==true but later datastore
actions fail; make the host-UUID update and the follow-up reconciliation
(UpdateMDMInstalledFromDEP, ReplaceHostDeviceMapping,
SetOrUpdateHostSCIMUserMapping/DeleteHostSCIMUserMapping and the
MDMWindowsGetEnrolledDeviceWithDeviceID read) atomic or reliably retryable. Fix
by performing the UpdateMDMWindowsEnrollmentsHostUUID and all subsequent updates
inside a single datastore transaction (or, if transactions aren't available,
implement a compensating rollback or clear the updated flag on failure) so that
either all of UpdateMDMInstalledFromDEP/ReplaceHostDeviceMapping/SCIM mapping
changes commit together with the host UUID or none do; locate this change around
the block that calls UpdateMDMWindowsEnrollmentsHostUUID,
MDMWindowsGetEnrolledDeviceWithDeviceID, UpdateMDMInstalledFromDEP,
ReplaceHostDeviceMapping, SetOrUpdateHostSCIMUserMapping, and
DeleteHostSCIMUserMapping.
🪄 Autofix (Beta)

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

Run ID: 2760b014-2cb9-4110-ae73-830563d94017

📥 Commits

Reviewing files that changed from the base of the PR and between 1cf6cce and 7fdaa92.

📒 Files selected for processing (8)
  • changes/45380-windows-mdm-enrollment-row-linkage
  • server/datastore/mysql/microsoft_mdm.go
  • server/datastore/mysql/microsoft_mdm_test.go
  • server/fleet/datastore.go
  • server/mock/datastore_mock.go
  • server/service/mdm_test.go
  • server/service/microsoft_mdm.go
  • server/service/osquery_utils/queries.go

Comment thread server/datastore/mysql/microsoft_mdm.go
Comment thread server/service/microsoft_mdm.go Outdated
Comment thread server/service/microsoft_mdm.go Outdated
Comment thread server/service/osquery_utils/queries.go
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.70175% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.82%. Comparing base (1cf6cce) to head (681083b).
⚠️ Report is 170 commits behind head on main.

Files with missing lines Patch % Lines
server/service/osquery_utils/queries.go 65.62% 5 Missing and 6 partials ⚠️
server/service/microsoft_mdm.go 81.25% 6 Missing and 3 partials ⚠️
server/datastore/mysql/microsoft_mdm.go 90.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #46268      +/-   ##
==========================================
- Coverage   66.84%   66.82%   -0.02%     
==========================================
  Files        2761     2773      +12     
  Lines      220856   223013    +2157     
  Branches    10879    10879              
==========================================
+ Hits       147628   149030    +1402     
- Misses      59861    60396     +535     
- Partials    13367    13587     +220     
Flag Coverage Δ
backend 68.60% <80.70%> (-0.05%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

- Always refresh enrolledDevice.HostUUID after a successful host lookup
  + link, even when UpdateMDMWindowsEnrollmentsHostUUID reports
  updated=false. The "no change" outcome from UpdateMDMWindowsEnrollmentsHostUUID
  also covers the case where the row was already linked to the same
  hostUUID by a concurrent path, so the in-memory enrolledDevice must
  still pick up the linkage to avoid reinjecting a redundant DevDetail
  Get for the rest of the request.
- Scan every Item in every Results command, not just Items[0]. SyncML
  Results can carry multiple items, so the SMBIOS serial may not be the
  first one.
- Use ds.writer(ctx) for WindowsHostLiteByHardwareSerial. The lookup
  runs immediately after osquery's enroll write, and replica lag was
  producing false NotFound results that delayed linkage.
- Clarify LinkWindowsHostMDMEnrollment docstring: updated=false also
  covers "no row matched mdmDeviceID", not only "already linked to this
  host".
- Replace curly quotes with ASCII '' in two comments.

Adds two regression tests covering the multi-item Results case and the
updated=false in-memory refresh path.
@getvictor

Copy link
Copy Markdown
Member Author

@claude review once

Comment thread server/service/microsoft_mdm.go
getvictor added 2 commits May 27, 2026 18:32
The DevDetail/SMBIOSSerialNumber Get injected by processIncomingMDMCmds
for unlinked enrollments is never inserted into windows_mdm_commands
because it is a protocol-level linkage probe, not a queued command. With
a fresh UUID CmdID each session, the device's Status/Results reply on
the next session left MDMWindowsSaveResponse logging "unmatched Windows
MDM commands" once per session until linkage completed, since BYOD
enrollments in the unlinked window typically have no other pending
commands to suppress the warning.

Use a stable fleet-internal CmdID prefix ("fleet-internal-") for these
server-injected probes. MDMWindowsSaveResponse now filters CmdRefs with
that prefix out before deciding whether to warn, so a properly
functioning linkage probe is silent and real unmatched-command alerts
remain visible. Cross-session correlation is now also possible since the
CmdID is stable.

No DB schema or windows_mdm_commands changes; the probe still lives only
in the SyncML envelope and the message-level audit in
windows_mdm_responses.
@getvictor getvictor marked this pull request as ready for review May 29, 2026 00:37
@getvictor getvictor requested a review from a team as a code owner May 29, 2026 00:37

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@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 `@server/fleet/datastore.go`:
- Around line 2114-2115: Update the doc comment for
WindowsHostLiteByHardwareSerial to state its unique-match semantics: explain
that it returns a HostLite when exactly one host matches the provided
hardwareSerial, returns NotFound when no host is found, and also returns
NotFound when more than one Windows host shares the same hardwareSerial (i.e.,
duplicate-detection prevents returning an arbitrary match); mention why this
protects against mis-linking on virtualization-shared SMBIOS values so
callers/implementers understand the contract.
🪄 Autofix (Beta)

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

Run ID: 216c9042-ef41-4e48-92ca-269355674316

📥 Commits

Reviewing files that changed from the base of the PR and between 7fdaa92 and 36202ee.

📒 Files selected for processing (10)
  • server/datastore/mysql/hosts.go
  • server/datastore/mysql/microsoft_mdm.go
  • server/fleet/datastore.go
  • server/fleet/hosts.go
  • server/fleet/hosts_test.go
  • server/fleet/microsoft_mdm.go
  • server/fleet/microsoft_mdm_test.go
  • server/service/mdm_test.go
  • server/service/microsoft_mdm.go
  • server/service/osquery_utils/queries.go
✅ Files skipped from review due to trivial changes (1)
  • server/datastore/mysql/hosts.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • server/service/osquery_utils/queries.go
  • server/service/microsoft_mdm.go

Comment thread server/fleet/datastore.go
if !updated {
return false, nil
}
device, err := ds.MDMWindowsGetEnrolledDeviceWithDeviceID(ctx, mdmDeviceID)

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.

Does this need to go to the primary?

@getvictor getvictor May 29, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch. I'll explicitly set the hostUUID for the returned device to make sure it doesn't have a stale value. It doesn't seem to be used, but it doesn't hurt to be explicit.

@getvictor getvictor requested a review from ksykulev May 29, 2026 23:34
@getvictor

Copy link
Copy Markdown
Member Author

@ksykulev ready for re-review

@@ -0,0 +1 @@
- Fixed a race after Windows BYOD MDM enrollment (Settings > Access work or school > Connect) where `mdm_windows_enrollments.host_uuid` stayed empty for several seconds, causing server-side enrollment lookups to miss. The enrollment is now linked to the Fleet host record at the first management session via OMA-DM DevDetail/SMBIOSSerialNumber instead of waiting for osquery's distributed-read backfill.

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.

Lol you can always tell it's generated by Claude when it says "race" vs "race condition".

Comment thread changes/45380-windows-mdm-enrollment-row-linkage Outdated
Co-authored-by: Konstantin Sykulev <konst@sykulev.com>
@getvictor getvictor requested a review from ksykulev June 2, 2026 01:03
@getvictor

Copy link
Copy Markdown
Member Author

@ksykulev ready for re-review

@getvictor getvictor merged commit ea5b156 into main Jun 2, 2026
42 checks passed
@getvictor getvictor deleted the victor/45380-windows-mdm-row branch June 2, 2026 14:41
@coderabbitai coderabbitai Bot mentioned this pull request Jun 2, 2026
12 tasks
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.

Windows MDM enrollment row is not linked to the Fleet host record at enrollment time

3 participants