Commit Graph

1077 Commits

Author SHA1 Message Date
Oliver Kieselbach 01e29da0f2 feat: Server SessionActions and action signal consolidation on agent side 2026-04-14 23:42:10 +02:00
Oliver Kieselbach 95cb8a3a7e feat: define harmless event ids for collectors 2026-04-14 22:56:16 +02:00
Oliver Kieselbach 0d74b5a1f2 fix session search and analyze rule KO button 2026-04-14 22:13:32 +02:00
Oliver Kieselbach 78cccae908 eventdata projection to support also older event schema for new rule ANALYZE-ESP-002 2026-04-14 21:51:57 +02:00
Oliver Kieselbach 45edbab0e1 feat: enhanced analyze rule engine (in not_in support) MarkSessionAsFailed support, new ESP rule for cert errors 2026-04-14 21:46:20 +02:00
Oliver Kieselbach 3dbfdc0dba fix: make DevPrep shadow lookup fire-and-forget
The shadow validator previously awaited the Graph round-trip inline,
adding 200ms-30s of latency to every RegisterSession/Ingest response
on opted-in tenants — defeating the "shadow, never blocks" intent.

Detach the lookup as Task.Run with captured locals so the agent gets
its OK immediately. Result is logged at Warning level (Information
gets filtered by sampling/log-level config and never surfaced).

Drop the now-unused EnrichRequestTelemetryWithDeviceAssociation method
and its tests — Activity.AddTag from a detached task wouldn't make it
into the request telemetry anyway, since the parent activity has
already stopped by the time the background lookup completes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 20:33:14 +02:00
Oliver Kieselbach 54c2c80904 fix: wire DeviceAssociationValidator through ValidateSecurityAsync
The DevPrep shadow validator was never executed because the
ValidateSecurityAsync extension constructed SecurityValidator without
passing DeviceAssociationValidator, so _deviceAssociationValidator was
always null and the gate at SecurityValidator.cs:370 silently skipped
the lookup — even with ValidateDeviceAssociation=true on the tenant.

Inject the validator via DI into all 9 agent-facing functions
(RegisterSession, IngestEvents, GetAgentConfig, ReportAgentError,
GetDiagnosticsUploadUrl + 4 Bootstrap variants) and thread it through
the extension to SecurityValidator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 18:40:45 +02:00
Oliver Kieselbach 52fcfce271 feat: allow agent downgrade 2026-04-14 17:51:50 +02:00
Oliver Kieselbach 6702e1d43b feat: added DevPrepValidator (device association) and restructured agent to distinguish Classic vs v2 autopilot flow, in addition option for dev build added 2026-04-14 16:09:32 +02:00
Oliver Kieselbach d391900d6d added stateMachine discrepancy check events for further validation of stateMachine and upcoming final switch 2026-04-14 14:55:05 +02:00
Oliver Kieselbach aa747d4a35 extracted ShellCoreTracker + ProvisioningStatusTracker from EspAndHelloTracker
Completes the composition split: EspAndHelloTracker is now a thin coordinator
(~290 LOC) that forwards events between four focused sub-trackers:

  - HelloTracker              (820 LOC, previously extracted)
  - ModernDeploymentTracker   (480 LOC, previously extracted)
  - ShellCoreTracker          (325 LOC, NEW)
  - ProvisioningStatusTracker (650 LOC, NEW)

ShellCoreTracker owns Shell-Core 62404/62407 handling, ESP-exit + WhiteGlove
fire-once guards, failure classification + backfill. Cross-notifies HelloTracker
on Hello wizard start and ESP exit. Core processing extracted to ProcessEvent
with primitive inputs so tests drive it without EventLogWatcher.

ProvisioningStatusTracker owns registry polling (RegNotifyChangeKeyValue),
category/subcategory parsing for both flat + nested JSON formats, subcategory
transition detection with noise filtering, categorySucceeded resolution,
DeviceSetup fallback timer (5s recheck after 30s for Win 25H2/26200 builds
that never set the boolean), and the public snapshot APIs.

Coordinator's public API (events, properties, methods) preserved byte-for-byte
for CollectorCoordinator + EnrollmentTracker — no integration changes required.

Adds 50 xUnit tests:
  - ShellCoreTrackerTests (20): Hello wizard start notification, WhiteGlove
    fire-once, all 6 failure keywords, ESP exit flow, WhiteGlove-vs-Exiting
    regex precedence, backfill dedup semantics.
  - ProvisioningStatusTrackerTests (30): first-seen / resolved / failure paths,
    flat + nested subcategory formats, state inference, snapshot APIs,
    noise-filtering of notStarted→in_progress transitions, progression to
    succeeded as a transition event, JSON helper edge cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 13:21:45 +02:00
Oliver Kieselbach a8f6325ea9 extracted HelloTracker from EspAndHelloTracker
Moves WHfB policy detection, UDR event handling (300/301/358/360/362/376),
HelloForBusiness watcher (3024/6045), Hello wait/completion timers and
HelloOutcome state machine into a dedicated HelloTracker class (820 LOC).

Cross-boundary with ESP (Shell-Core 62404/62407) is narrowed to two
explicit notify methods: NotifyHelloWizardStarted + NotifyEspExited.

Public API of EspAndHelloTracker is unchanged — IsPolicyConfigured,
IsHelloCompleted, HelloOutcome, StartHelloWaitTimer, ForceMarkHelloCompleted,
ResetForEspResumption and the HelloCompleted event now delegate to the
composed HelloTracker. CollectorCoordinator + EnrollmentTracker integration
requires no changes.

Adds 29 xUnit tests covering: UDR terminal events, 6045 skip HRESULT,
wait/completion timer paths (policy-enabled extended wait, policy-disabled
immediate completion, wizard-started vs wizard-not-started outcomes),
cross-boundary notifications, ForceMarkHelloCompleted semantics and
ResetForEspResumption state reset.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 13:05:15 +02:00
Oliver Kieselbach 97fb112c00 extracted ModernDeploymentTracker 2026-04-14 12:54:52 +02:00
Oliver Kieselbach 4fbcfb51b4 refactor web structure (progress page using hooks) 2026-04-14 12:23:27 +02:00
Oliver Kieselbach 95949abdd3 refactor web structure (session details page uses hooks) 2026-04-14 12:09:53 +02:00
Oliver Kieselbach ebc588c460 refactor web structure (re-org to utils) 2026-04-14 11:29:55 +02:00
Oliver Kieselbach a3e8e0449a refactor web structure (re-org to utils) 2026-04-14 11:29:22 +02:00
Oliver Kieselbach 7f38026cf1 refactor web dashboard (hook sessions) 2026-04-14 11:00:42 +02:00
Oliver Kieselbach cbe13da680 refactor web dashboard (filter hooks) 2026-04-14 10:41:47 +02:00
Oliver Kieselbach 29cacac1c6 refactor web project structure 2026-04-14 10:26:13 +02:00
Oliver Kieselbach fbfcfed667 updated skill 2026-04-14 10:16:00 +02:00
Oliver Kieselbach cfc412d5ff added SLA telemetry 2026-04-14 10:15:01 +02:00
Oliver Kieselbach eb0df61b47 refactor web project structure 2026-04-14 10:02:16 +02:00
Oliver Kieselbach 8a3e3c4550 refactor web project structure 2026-04-14 10:02:02 +02:00
Oliver Kieselbach 91ba78c19b refactor web project structure 2026-04-14 09:49:02 +02:00
Oliver Kieselbach 665a9a14cc better agent self-update observability 2026-04-14 09:33:44 +02:00
Oliver Kieselbach 000f7e390d more parallel fetches for better performance 2026-04-14 02:30:38 +02:00
Oliver Kieselbach fa1128212f added agent core tests 2026-04-14 01:39:48 +02:00
Oliver Kieselbach bb3efae5dc refactor CollectorCoordinator (method logic extraction) 2026-04-14 01:00:24 +02:00
Oliver Kieselbach 918d6c0ee7 Refactor MonitoringService for better reliability and testability 2026-04-13 23:51:24 +02:00
Oliver Kieselbach f2bbee6aa7 agent feat: added CompletionStateMachine enhance reliability and testability 2026-04-13 22:14:44 +02:00
Oliver Kieselbach 559167863c fix SLA page layout 2026-04-13 21:08:42 +02:00
Oliver Kieselbach 8ab14f0d0a fix immediate view of SLA config creation 2026-04-13 20:54:15 +02:00
Oliver Kieselbach 0ced90850a fixed styling 2026-04-13 20:41:23 +02:00
Oliver Kieselbach c415872e46 feat: SLA tracking dashboard with notifications 2026-04-13 20:19:24 +02:00
Oliver Kieselbach 17c39dd1b1 better failure logging 2026-04-13 16:39:55 +02:00
Oliver Kieselbach bba1d55860 added more usage metrics (apps/scripts) 2026-04-13 15:54:56 +02:00
Oliver Kieselbach 2342acf5a6 new aggregated usage metrics for apps and scripts
bugfix scroll to analyze rule (top X rules firing listing card)
2026-04-13 15:32:27 +02:00
Oliver Kieselbach 96a383bb38 bug fix rule stats and chagned stats to be more useful 2026-04-13 15:12:29 +02:00
Oliver Kieselbach 565c5faa16 Merge branch 'main' of https://github.com/okieselbach/Autopilot-Monitor 2026-04-13 14:12:23 +02:00
Oliver Kieselbach 62918c9cbf added rule stats 2026-04-13 14:12:19 +02:00
Oliver Kieselbach ef8d027877 Merge pull request #42 from okieselbach/claude/add-event-backfill-0cjfb 2026-04-12 18:33:49 +02:00
Oliver Kieselbach 37cc7540bf sanitize appname rowkey 2026-04-12 18:32:01 +02:00
Claude 4d73c86641 feat: add event backfill for targeted ModernDeployment events (Event 509)
Solves the timing gap where WhiteGlove Event 509 fires during OOBE
before the agent starts (pre MDM-enroll). On startup the agent now
scans the ManagementService event log for targeted events within a
configurable lookback window (default 30 min) and emits them with
a backfilled=true marker for trace analysis.

Key changes:
- Extract ProcessModernDeploymentRecord from live handler for reuse
  by both EventLogWatcher callback and EventLogReader backfill
- Add BackfillTargetedModernDeploymentEvents() with persisted state
  (whiteglove-backfill.json) so subsequent agent restarts skip the
  scan and avoid duplicate emissions
- Add config fields ModernDeploymentBackfillEnabled and
  ModernDeploymentBackfillLookbackMinutes to CollectorConfiguration
- Wire up stateDirectory and config in MonitoringService
- All emitted events now carry Data["backfilled"] = true/false

https://claude.ai/code/session_01ToApHGezTGcSkA6NVbVZkG
2026-04-12 10:11:19 +00:00
Oliver Kieselbach 7220020a55 bug fix in CVE cache chunking 2026-04-11 11:17:48 +02:00
Oliver Kieselbach 1a5ab674b0 more whitglove detection logic (event 509) 2026-04-11 00:41:45 +02:00
Oliver Kieselbach 074de590dd Merge branch 'main' of https://github.com/okieselbach/Autopilot-Monitor 2026-04-10 18:28:35 +02:00
Oliver Kieselbach e5c53eb772 enrich event data for analyze rules 2026-04-10 18:28:31 +02:00
okieselbach 32bc9da60c chore: regenerate rules/dist from individual files 2026-04-10 16:13:38 +00:00
Oliver Kieselbach 625809423f Better app failure detection and reporting 2026-04-10 18:12:30 +02:00