Commit Graph

1105 Commits

Author SHA1 Message Date
Oliver Kieselbach aba8df6572 agent StateMachine fixes 2026-04-16 14:15:40 +02:00
Oliver Kieselbach 6e991b5ca8 update known-issues with agent work and interruptions based on this 2026-04-16 13:40:04 +02:00
Oliver Kieselbach 3cb3df2b16 completion logix fix 2026-04-16 12:52:38 +02:00
Oliver Kieselbach 21937fa950 whiteglove session timeline fix 2026-04-16 11:54:31 +02:00
Oliver Kieselbach 0fe7748684 agent metrics session limit bump to 500 2026-04-16 11:31:56 +02:00
Oliver Kieselbach 9fd2cba424 fix(agent): prevent WhiteGlove sessions from being misclassified as self-deploying
WhiteGlove (Pre-Provisioning) sessions were incorrectly classified as
self-deploying because OnDeviceSetupProvisioningComplete and the esp_exiting
handler both race ahead of the signal-correlated WhiteGlove detector (30s
timer + 10min stability window). Two WhiteGlove signals existed but were
never consumed by completion logic:

1. EventID 509 (whiteglove_started) — already detected by
   ModernDeploymentTracker but not exposed to EnrollmentTracker
2. SaveWhiteGloveSuccessResult=succeeded in DeviceSetup registry JSON —
   present in esp_provisioning_raw but invisible to ParseSubcategories
   (no *Subcategory suffix)

Adds WhiteGlove guards at both device-only completion paths:
- OnDeviceSetupProvisioningComplete (registry polling path)
- OnFinalizingSetupPhaseTriggered esp_exiting + SkipUserStatusPage path

Exposes IsWhiteGloveStartDetected and HasSaveWhiteGloveSuccessResult
through EspAndHelloTracker. Mirrors guards in CompletionStateMachine.
Backend safety net: classifies whiteglove_started events and sets
IsPreProvisioned=true early as fallback for older agents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 10:51:22 +02:00
Oliver Kieselbach 1c633b9c4d feat(backend): enriched EventTypeIndex + index-based event search endpoint
Enrich EventTypeIndex with MaxSeverity/Sources for server-side pre-filtering,
add GetSessionEventsByTypeAsync for OData-filtered event fetch (eliminates N+1),
and new /api/raw/events/search endpoint for MCP search tool pre-filtering.

- EventTypeIndex now stores MaxSeverity, MaxSeverityName, Sources per session-eventType
- GetSessionEventsByTypeAsync: OData filter on EventType within a session partition
- SearchEventsByTypesAsync: combines index lookup + filtered fetch across sessions
- SearchEventsFunction: GET /api/raw/events/search + global variant
- QueryRawEventsFunction: uses filtered fetch instead of full partition scan
- Routes registered in EndpointAccessPolicyCatalog (MemberRead + GlobalAdminOnly)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 10:34:21 +02:00
Oliver Kieselbach fee6909ec6 feat(mcp): add tool-call telemetry for production observability
Track MCP tool invocations in App Insights and UserUsageLog:
- Add ClientSource + McpToolName custom dimensions to RequestTelemetry
- Propagate tool name via X-MCP-Tool-Name header from MCP server
- Wrap all 26 tool handlers with withToolTelemetry for context propagation
- Add MCP_TOOL_LOGGING env var (default false) for optional stderr logging
- Add toolLoggingEnabled param to Bicep template for persistence

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 10:30:41 +02:00
Oliver Kieselbach 2503439585 fix(web): hide welcome message during dashboard loading to prevent flash
Gate WelcomeMessage on !loading so it only appears when sessions are
truly empty, not while the initial fetch is still in progress.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 09:51:38 +02:00
Oliver Kieselbach a544235ab7 feat(web): auto-load all sessions on search for better search UX
When search is active with <8 local results, automatically loads all
remaining sessions progressively (batch by batch) so the local search
can find matches across ALL fields (country, city, model, etc.).
Bottom button shows "Search all sessions..." with progress spinner
when search is active, keeps "Load 100 more..." for manual browsing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 09:07:31 +02:00
Oliver Kieselbach 8454aaeb97 allow excessiveeventcount threshold config in alert 2026-04-16 04:20:11 +02:00
Oliver Kieselbach 8a231352d9 admin alert UI excessiveSession 2026-04-16 04:10:57 +02:00
Oliver Kieselbach a0bfffcbd4 bulk delete speedup, session runaway alarm, Autopilot validation permissions sentance docs 2026-04-16 03:58:05 +02:00
Oliver Kieselbach 9447e3c9d8 refactor(agent): move StallProbeCollector + drop empty legacy folders
Part 5 of 5 in Monitoring/ bounded-context restructure. StallProbeCollector
lands in Enrollment/SystemSignals/. Empty Core/Tracking/Collectors/Network/
Analyzers/Flows/Replay/ directories removed. No behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 01:49:24 +02:00
Oliver Kieselbach 6d2b06d004 refactor(agent): move enrollment domain into Enrollment/ feature subfolders
Part 4 of 5 in Monitoring/ bounded-context restructure. Feature-based split:
Enrollment/ (orchestrator+persistence), Flows/, Ime/ (log parsing, parser,
positions, app/script state, replay, process watcher), SystemSignals/
(ESP/Hello/ShellCore/ModernDeployment/Provisioning/DesktopArrival), and
Completion/ (state machine, guards, handler). Pure folder move +
namespace update; no behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 01:44:46 +02:00
Oliver Kieselbach 9f053279f5 refactor(agent): move telemetry collectors/analyzers/gather into Telemetry/
Part 3 of 5 in Monitoring/ bounded-context restructure. Split by purpose
(periodic metrics, hardcoded analyzers, backend-driven gather rules,
device info). Pure folder move + namespace update; no behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 01:38:47 +02:00
Oliver Kieselbach 317677abf6 refactor(agent): move Network/ + Core upload internals to Transport/
Part 2 of 5 in Monitoring/ bounded-context restructure. Network/* plus
Core/EventSpool + Core/EventUploadOrchestrator moved into Monitoring/Transport/.
Pure folder move + namespace update; no behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 01:33:48 +02:00
Oliver Kieselbach e1117d7db8 refactor(agent): move Core orchestrators to Runtime/, flatten Interop/
Part 1 of 5 in Monitoring/ bounded-context restructure. Moves Monitoring/Core/*
(minus EventSpool/EventUploadOrchestrator/DeviceInfoProvider/EnrollmentCompletionHandler
which belong to later PRs) into Monitoring/Runtime/. Interop/ stays on
Monitoring root. Pure folder move + namespace update; no behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 01:30:05 +02:00
Oliver Kieselbach c460a9f528 optimizations, DO timeout and PerfCollector WMI to SysCall 2026-04-16 00:36:05 +02:00
Oliver Kieselbach 2e68d15978 nicer agent version string in timeline 2026-04-15 17:56:29 +02:00
Oliver Kieselbach 4d40cdf3c0 fix completion state machine (esp state wasn't tracked all the time) 2026-04-15 14:52:53 +02:00
Oliver Kieselbach 4da1540f8c added hardware hash command to guardrails 2026-04-15 01:46:32 +02:00
Oliver Kieselbach 1026f53482 fix rule state save 2026-04-15 01:26:21 +02:00
Oliver Kieselbach d178fa4ef3 consistent switcher everywhere 2026-04-15 01:18:14 +02:00
Oliver Kieselbach 47a73c08d5 changed SLA metrics to be more useful 2026-04-15 01:07:13 +02:00
Oliver Kieselbach 66587b76d3 geo report drill down has now DO usage stats as well 2026-04-15 00:52:44 +02:00
Oliver Kieselbach a3d37c67ac added more http compression (responses also) 2026-04-15 00:34:18 +02:00
Oliver Kieselbach 9b2f801530 feat: lazy loading sessions (faster page load) 2026-04-15 00:08:56 +02:00
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