Skip to content

Improve MXC execution telemetry and lifecycle correlation - #1575

Open
Richie Gomez (richiemsft) wants to merge 8 commits into
mainfrom
feat/TelemetryImprovement
Open

Richie Gomez (richiemsft) wants to merge 8 commits into
mainfrom
feat/TelemetryImprovement

Conversation

@richiemsft

@richiemsft Richie Gomez (richiemsft) commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Improve execution telemetry and correlate events across a container lifecycle.

  • Replace MXC.Execution with MXC.ExecutionStart and MXC.ExecutionEnd, including SDK streaming/PTY and container lifecycle paths.
  • Add mxc.session_id to all 11 event families. Reuse the persisted random lifecycle root across executor processes and preserve each streaming handle's attribution across threads and cleanup.
  • Add the bounded mxc.capture_denials mode to Start/End and share the existing capability classifier with backend diagnostics.
  • Preserve per-invocation opt-in, live consent/policy checks, provider ownership, terminal-event handling, and non-Windows no-op behavior.
  • Update the unreleased consent resource to version 4 to disclose lifecycle correlation, with explicit re-consent for earlier grants.
  • Update event documentation and regression coverage.

Collectors must update filters and queries from MXC.Execution to the new Start/End names. Start describes a pre-dispatch attempt, not a successful process launch; missing End is not definitive evidence of a crash.

The version-4 disclosure remains subject to Privacy and release-owner review before shipping.

References

Fixes #1588. #1517

  • docs/telemetry.md
  • docs/development/architecture/telemetry.md
  • docs/development/architecture/telemetry-consent-design.md

Validation

  • cargo fmt --all -- --check
  • cargo test -q -p mxc-sdk --lib telemetry - 274 passed.
  • cargo test -q -p mxc-sdk --lib mxc_engine - 106 passed.
  • cargo test -q -p mxc-sdk --lib --features isolation_session telemetry - 275 passed.
  • IsolationSession streaming and worker regression suites: exec_stream - 29 passed; owned_thread - 9 passed.
  • cargo clippy -q -p mxc-sdk --lib --tests --features isolation_session -- -D warnings
  • cargo clippy -q -p mxc-sdk --lib --tests -- -D warnings
  • cargo clippy -q -p wxc --bin wxc-exec -- -D warnings
  • dotnet run --project Microsoft.Mxc.Sdk.Tests\Microsoft.Mxc.Sdk.Tests.csproj -- -class '*MxcTelemetryTests*' - 100 passed.
  • PowerShell parser checks for all three modified telemetry smoke/release scripts, consent JSON parsing, and git diff --check.

No new VM deployment or live telemetry sends were performed for this submission.

Checklist

Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHub
Actions build; it runs on merge to main, and Microsoft reviewers with write access can trigger it
on a PR with /azp run. See pull request builds.

If the dependency-feed-check check fails on a new dependency, the crate must be added to
the feed before the PR can pass. See pull request builds
for the steps.

Microsoft Reviewers: Open in CodeFlow

Emit execution Start/End events, add lifecycle session correlation and
denial-capture mode attribution, and preserve invocation isolation across
streaming operations and backend cleanup.

Update consent disclosure, event documentation, and regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e46bdb3-c7d8-46aa-af26-56f317c36a58
Copilot AI balanced review requested due to automatic review settings October 26, 2026 17:44

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.

🟡 Changes recommended

Invocation context is lost across backend thread boundaries, and missing session IDs incorrectly suppress authorized streaming telemetry.

2 open issues
What changed in this PR

This PR adds execution Start/End telemetry and lifecycle-wide session correlation across MXC executors and SDK operations.

Changes:

  • Replace MXC.Execution with Start/End events and add session IDs and bounded denial-capture modes.
  • Preserve attribution across streaming-handle operations and persist lifecycle correlation roots.
  • Update consent disclosure to version 4, documentation, and regression coverage.
File Description
tests/​scripts/​run_telemetry_etw_smoke_test.ps1 Validate execution pairs, attribution, and consent v4.
tests/​scripts/​run_telemetry_consent_smoke_test.ps1 Update consent expectations to v4.
tests/​scripts/​run_telemetry_consent_release_test.ps1 Update release consent checks to v4.
src/​tools/​wxc/​src/​main.rs Initialize session attribution and emit execution Start.
src/​tools/​mxc_darwin/​src/​main.rs Add the execution Start call.
src/​tools/​lxc/​src/​main.rs Add the execution Start call.
src/​mxc-sdk/​tests/​wxc_e2e_tests_e2e_telemetry_etw.rs Check new event names and attribution fields.
src/​mxc-sdk/​src/​core/​mxc_telemetry/​mod.rs Emit Start/End events and session fields.
src/​mxc-sdk/​src/​core/​mxc_engine/​state_aware.rs Instrument lifecycle dispatch with session scopes and Start events.
src/​mxc-sdk/​src/​core/​mxc_engine/​mod.rs Retain streaming-handle attribution during operations and cleanup.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​session.rs Add scoped session and learning-mode context.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​mod.rs Integrate Start/End emission and invocation suppression.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​events.rs Add learning-mode classification and event test support.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​correlation_state.rs Persist late-enabled lifecycle roots and clear stale state.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​consent_prompt.rs Update disclosure text assertions.
src/​mxc-sdk/​src/​core/​mxc_common/​process_util.rs Extract Windows parent-process and image-path helpers.
src/​mxc-sdk/​src/​core/​mxc_common/​models.rs Centralize learning-mode capability classification.
src/​mxc-sdk/​src/​core/​mxc_common/​diagnostic.rs Reuse process helpers for local diagnostics.
src/​mxc-sdk/​src/​backends/​process_container/​common/​appcontainer_runner.rs Reuse the shared capability classifier.
src/​mxc-sdk/​resources/​telemetry/​consent/​en-US.json Introduce v4 lifecycle-correlation disclosure.
sdk/​dotnet/​Microsoft.Mxc.Sdk.Tests/​MxcTelemetryTests.cs Align .NET consent tests with v4.
docs/​telemetry.md Explain execution pairs and lifecycle correlation.
docs/​development/​architecture/​telemetry.md Document event contracts and correlation persistence.
docs/​development/​architecture/​telemetry-consent-design.md Document re-consent and collector migration requirements.

Review effort: Balanced

Comment thread src/mxc-sdk/src/core/mxc_common/telemetry/session.rs Outdated
Comment thread src/mxc-sdk/src/core/mxc_common/telemetry/session.rs Outdated
Restore complete invocation context across IsolationSession workers and moved streaming handles. Preserve upstream fallback removal and session lifecycle support.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e46bdb3-c7d8-46aa-af26-56f317c36a58
Copilot AI balanced review requested due to automatic review settings October 26, 2026 18:16

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.

🟡 Changes recommended

Scheduled Windows validation still lacks functional assertions for telemetry correlation through a real cross-process container lifecycle.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread src/mxc-sdk/src/core/mxc_engine/state_aware.rs
Align release consent fixtures with resource v4, gate Windows-only attribution readers, and validate cross-process lifecycle correlation with isolated local ETW capture on scheduled IsolationSession hosts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e46bdb3-c7d8-46aa-af26-56f317c36a58
Copilot AI balanced review requested due to automatic review settings October 26, 2026 18:50

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.

🔵 Needs a closer look

Scheduled lifecycle validation has a blocking request defect, while successful real-host ETW validation and Privacy/release-owner review remain outstanding.

2 open issues

Review effort: Balanced

Comment thread tests/scripts/run_isolation_session_state_aware_tests.ps1
Validate the actual lifecycle scenario requests through real CLI dry-runs, with telemetry disabled and a missing-network rejection control, before publishing the test executor artifact.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e46bdb3-c7d8-46aa-af26-56f317c36a58
Copilot AI balanced review requested due to automatic review settings October 26, 2026 19:04

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.

🔵 Needs a closer look

Supported-host lifecycle ETW execution remains unverified, and the revised disclosure still requires Privacy and release-owner review.

1 open issue
1 resolved since last review

Review effort: Balanced

Match actual tracerpt XML rather than numeric System task IDs, and exercise the real layout in the offline regression fixture without weakening pair or lifecycle assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e46bdb3-c7d8-46aa-af26-56f317c36a58
Copilot AI balanced review requested due to automatic review settings October 26, 2026 19:26

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.

🔵 Needs a closer look

Supported-host lifecycle ETW execution evidence remains outstanding, and the revised disclosure requires Privacy and release-owner review before shipping.

1 open issue

Review effort: Balanced

@richiemsft
Richie Gomez (richiemsft) marked this pull request as ready for review October 26, 2026 20:20
@richiemsft
Richie Gomez (richiemsft) requested a review from a team as a code owner October 26, 2026 20:20
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@richiemsft

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Preserve lifecycle telemetry validation alongside the shared Node integration suite dispatcher.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 08308f81-0ab1-4b64-9efa-f373a119e864
Copilot AI balanced review requested due to automatic review settings October 27, 2026 16:59

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.

🔵 Needs a closer look

Privacy-sensitive correlation changes still need real-host lifecycle ETW validation evidence and Privacy/release-owner review of the updated disclosure.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Preserve telemetry session and execution event handling alongside captured MicroVM dispatch. Combine validation artifact guidance and cover captured execution telemetry outcomes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 08308f81-0ab1-4b64-9efa-f373a119e864
Copilot AI balanced review requested due to automatic review settings October 28, 2026 16:50

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.

🔵 Needs a closer look

The version-4 consent disclosure and lifecycle telemetry inventory require Privacy/release-owner review, while the CI-wired real-host lifecycle ETW scenario still lacks execution evidence.

No open issues 🎉

Review effort: Balanced

@richiemsft

Richie Gomez (richiemsft) commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Retain IsolationSession lifecycle telemetry alongside the required development SDK integration scenarios and fail-closed suite checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 08308f81-0ab1-4b64-9efa-f373a119e864
Copilot AI balanced review requested due to automatic review settings October 29, 2026 16:53

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.

🔵 Needs a closer look

The version-4 consent and telemetry disclosures require Privacy and release-owner review, while the cross-process lifecycle ETW scenario lacks execution evidence from an elevated, supported Windows host.

No open issues 🎉

Review effort: Balanced

This branch has not been deployed

No deployments
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.

Improve execution telemetry and connect events from the same container

2 participants