osquery_perf: Windows MDM push - #46777
Conversation
Relax the Windows MDM DMClient poll schedule in-session, gated on the host's fleetd (orbit) version and reconciled against a persisted applied-state column. - getPollScheduleCommands: desired-relaxed (orbit >= 1.56.0, via GetHostOrbitInfo) vs applied (mdm_windows_enrollments.poll_schedule_relaxed). Emits one Replace on .../Poll/IntervalForFirstSetOfRetries (60 relax / 1 restore) only when they differ. - windowsMDMHostSupportsSync: missing/unlinked host or unknown version => not-capable (stay on the fast poll, the safe default). - Migration 20260601204606 adds poll_schedule_relaxed TINYINT(1) NOT NULL DEFAULT 0. - Datastore setter + enrolled-device SELECT + interface + regenerated mock. - Tests: TestGetPollScheduleCommands, testMDMWindowsPollScheduleRelaxed, migration test.
…dm-wake # Conflicts: # server/datastore/mysql/schema.sql # server/service/microsoft_mdm_test.go
…edule setter; tidy tests
…dm-wake # Conflicts: # server/datastore/mysql/schema.sql
|
@coderabbitai full review |
|
/agentic_review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Pull request overview
Updates osquery-perf’s Windows MDM simulation to exercise the new “server requests on-demand sync” wake path (instead of relying only on a fixed poll interval), and adds a metric to track how many Windows MDM sessions were triggered by that wake signal.
Changes:
- Add
mdmOnDemandSyncsstats counter and include it in periodic stats logging. - Add a buffered wake channel for Windows MDM agents, advertise
CapabilityWindowsMDMSync, and trigger on-demand OMA-DM sessions whenWindowsMDMSyncRequestis set in orbit config. - Refactor the Windows MDM loop to support variable poll intervals (honoring DMClient poll Replace commands) and wake-triggered sessions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/osquery-perf/osquery_perf/stats.go | Adds an on-demand sync counter and logs it alongside existing MDM session stats. |
| cmd/osquery-perf/agent.go | Implements Windows MDM wake signaling, capability advertisement, and a refactored Windows MDM loop that supports on-demand sessions and poll schedule updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #46777 +/- ##
==========================================
- Coverage 66.91% 66.90% -0.01%
==========================================
Files 2833 2834 +1
Lines 224964 225171 +207
Branches 11620 11620
==========================================
+ Hits 150526 150647 +121
- Misses 60781 60845 +64
- Partials 13657 13679 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis change adds client-side on-demand Windows MDM check-in support to the osquery-perf simulator. The agent now advertises Possibly related issues
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
There was a problem hiding this comment.
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.

Related issue: Resolves #46567
Note: Hide whitespace for better review
Testing
Summary by CodeRabbit