Skip to content

Extend Required-only telemetry to all supported contracts - #1733

Open
Richie Gomez (richiemsft) wants to merge 4 commits into
mainfrom
user/richiemsft/required-telemetry-all-contracts
Open

Richie Gomez (richiemsft) wants to merge 4 commits into
mainfrom
user/richiemsft/required-telemetry-all-contracts

Conversation

@richiemsft

@richiemsft Richie Gomez (richiemsft) commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

📖 Description

Extend the existing Required-only telemetry path to 0.9.0-alpha and 1.0.0, alongside 1.1.0-alpha, on eligible Windows builds. All three contracts collect only MXC.ExecutionStart, MXC.ExecutionEnd, MXC.Error, and MXC.ProcessExited, regardless of request opt-in, stored consent, or administrative policy.

SDK breaking change — P0 compatibility alert, intentional: existing V1 callers can no longer suppress these four events with enabled: false, consent withdrawal, or administrative policy. The older contracts also stop emitting optional event families. This implements the already-approved design confirmed by the requester; the specific exception is documented in the versioning guide. No separate approved spec URL was supplied, so the spec-link checklist item remains unchecked. This is a behavioral compatibility alert, not a claim of a security vulnerability.

One shared, explicit three-contract selector now controls both initialization and session event inventory. Typed Rust creation and lifecycle normalization preserve their already-selected contract so they follow the same Required path as JSON-based callers. Truly unattributed internal requests retain their existing request/consent/policy gates and optional inventory.

Requested containment attribution is independent of the optional telemetry preference. JSON "process" and Rust V1 Containment::Process retain sandbox kind "process" even when the resolved backend is ProcessContainer and telemetry is omitted. This metadata is internal, is not serialized, and does not change policy hashes or optional-field presence.

Build eligibility, signed routing, debug test-mode restrictions, non-Windows no-ops, provider ownership, event identities/payloads, local diagnostics, and execution/cleanup behavior are unchanged. Consent-management API/CLI signatures, stored records, serialization, SDK contract targets, and released schemas are unchanged.

Existing Windows ETW smoke and scheduled IsolationSession scenarios now cover all three contracts. The trace oracle checks actual Required classification and privacy tags, rejects all excluded event families, and retains failure, process-exit, correlation, and cleanup assertions. SDK documentation and public comments explain the changed collection behavior.

🔗 References

Refs #1588; follows #1575 and #1673. The related issue is already closed; this PR does not change issue state.

See docs/telemetry.md, docs/development/architecture/versioning.md#approved-telemetry-behavior-change, and the existing telemetry architecture/CI runbook.

🔍 Validation

Rust commands were run from src\. Required-eligible local checks used $env:MXC_TELEMETRY_COMPONENT_PATH='' and $env:MXC_TELEMETRY_TEST_KEYWORDS='1'; ordinary-debug checks left the component empty and removed the keyword setting. These local test builds have no Microsoft routing.

Exact command Result
cargo test --locked -p mxc-sdk --lib --features test-support,isolation_session -- telemetry mxc_engine exec_stream owned_thread state_aware_sdk config_parser sdk_input Passed: 532 tests in ordinary-debug mode and 532 in Required-eligible local test mode.
cargo fmt --all -- --check Passed.
cargo clippy --locked --workspace --all-targets --features test-support,isolation_session -- -D warnings Passed.
cargo build --locked -p wxc --features test-support,isolation_session Passed for the local-only Required-eligible executor.
tests\scripts\test_telemetry_etw_assertions.ps1 -WxcExePath src\target\debug\wxc-exec.exe Passed: offline trace oracle/negative controls, all 18 lifecycle requests through real CLI/backend dry-run validation, missing-network rejection, and all three contracts' deliberate unsupported-backend failures.
tests\scripts\run_telemetry_consent_smoke_test.ps1 -BinDir src\target\debug Passed: isolated consent CLI management behavior.
node scripts\check-telemetry-policy-parity.js Passed: policy, consent, result, protocol, and status-reason parity.
npm test from sdk\node\ Passed: 452 passed, 22 skipped, 0 failed.
git diff --check Passed.
tests\scripts\run_telemetry_etw_smoke_test.ps1 -BinDir src\target\debug -CheckKeywords Blocked at prerequisite: host is not Administrator; no live ETW capture performed locally.

PowerShell parser checks passed for all four modified .ps1 files.

Regression-before/fix-after evidence: temporarily restoring the original development-only selector made all three selected regression tests fail; restoring the explicit supported-contract selector passed:

cargo test --locked -p mxc-sdk --lib --features test-support,isolation_session -- init_for_request_ignores_request_flag_consent_and_policy_for_supported_contracts contracts_select_event_inventory supported_contracts_skip_verbose_transport

An intermediate eligible run failed with Windows Access is denied in the unchanged consent-store test write_through_replace_handles_new_and_existing_records. The subsequent complete 532-test run passed; no consent-store implementation or assertion was changed.

CI follow-up: the initial Linux ARM64 and macOS jobs exposed a test-setup error: the cross-platform telemetry matrix unconditionally unwrapped Windows-only consent persistence. The test now requires persistence to succeed on Windows and to return an error elsewhere; all contract/build-eligibility assertions still run on every platform. No production behavior or CI gate was changed. Initial Linux x64 separately failed in the unchanged Bubblewrap descendant-probe test with Text file busy (os error 26); that code is outside this PR.

Follow-up local validation passed:

Exact command from src\ Result
cargo test --locked -p mxc-sdk --lib --features test-support,isolation_session -- telemetry Passed: 284 tests in ordinary-debug mode and 284 in Required-eligible local test mode. An earlier attempt encountered the same unchanged consent-store temporary-file failure described above; the complete rerun passed.
cargo check --locked -p mxc-sdk --lib --tests --target x86_64-unknown-linux-gnu Passed: Linux library and test compilation. Linux execution is not available locally because WSL has no installed distribution.
cargo fmt --all -- --check Passed.
cargo clippy --locked -p mxc-sdk --lib --tests --features test-support,isolation_session -- -D warnings Passed.

On follow-up commit c60c99d7, CI run 43082310397 passed the previously failing macOS Test step and both Linux architectures' Test common contracts and state-aware SDK boundaries steps. Linux x64 also passed the unchanged Bubblewrap version-module tests that previously encountered Text file busy. Remaining job steps and other CI checks are still running; this is not a claim that the entire workflow has passed.

Copilot review follow-up: preserve 1.0.0 attribution in the Rust creation adapter, not just lifecycle normalization. A regression calls public v1::run with telemetry omitted/false, denied consent, and policy 0; it checks matching Required start/error/end records for the unsupported-backend failure and no optional events. Existing Windows release workspace tests run this public-API scenario. The ETW oracle now requires unique session IDs and correlation roots across all three lifecycles; four new negative controls consistently reuse lifecycle 1/2 attribution throughout lifecycle 3.

Both regressions failed before their respective fixes: the public API emitted zero starts rather than one in the Required-eligible build, and the old oracle accepted the consistently reused third lifecycle. After fixing them:

Exact command Result
cargo test --locked -p mxc-sdk --lib --features test-support,isolation_session -- telemetry policy::tests policy::exact policy::sdk_v1_conformance configs::process_container v1::tests mxc_engine::run::attribution_tests from src\ Passed: 404 tests in Required-eligible mode and 404 in ordinary-debug mode, including the public creation regression and SDK conformance fixtures.
cargo fmt --all -- --check from src\ Passed.
cargo clippy --locked --workspace --all-targets --features test-support,isolation_session -- -D warnings from src\ Passed.
cargo check --locked -p mxc-sdk --lib --tests --target x86_64-unknown-linux-gnu from src\ Passed.
tests\scripts\test_telemetry_etw_assertions.ps1 -WxcExePath src\target\debug\wxc-exec.exe Passed, including all four new lifecycle-3 reuse controls and the existing 18-request real CLI/backend dry-run scenarios.

Attribution review follow-up: move requested-containment metadata from optional telemetry settings to the internal execution request, and update the shared engine and executor readers. The typed creation adapter retains the original containment before backend resolution. No public SDK signatures or schemas change.

The new JSON/public Rust regression reproduced the reported failure before the fix: the omitted-telemetry JSON request emitted sandbox kind "processcontainer" instead of "process". After the fix, actual JSON and public v1::run invocations with omitted/false telemetry assert "process" on both start and end records under denied consent and policy 0. These tests run in the existing Windows release workspace suite. Parser coverage additionally checks all three contracts with omitted telemetry, an empty object, and explicit false while preserving optional-field presence. Existing policy-hash and lifecycle-binding coverage passes.

Exact command Result
cargo test --locked -p mxc-sdk --lib --features test-support,isolation_session -- telemetry policy::tests policy::exact policy::sdk_v1_conformance configs::process_container v1::tests mxc_engine state_aware_binding policy_identity config_parser from src\ Passed: 654 tests in Required-eligible mode and 654 in ordinary-debug mode.
cargo fmt --all -- --check from src\ Passed.
cargo clippy --locked --workspace --all-targets --features test-support,isolation_session -- -D warnings from src\ Passed.
cargo check --locked -p mxc-sdk -p lxc --all-targets --target x86_64-unknown-linux-gnu from src\ Passed: SDK, Linux executor, and test compilation.
cargo build --locked -p wxc --features "test-support isolation_session" from src\ Passed: rebuilt local Required-eligible executor.
tests\scripts\test_telemetry_etw_assertions.ps1 -WxcExePath src\target\debug\wxc-exec.exe Passed: complete offline oracle and real CLI/backend dry-run scenarios.
git diff --check Passed.

All reported checks on 389741b1 passed before this attribution follow-up; checks for the new follow-up commit are pending.

Not run locally: live IsolationSession ETW capture (tests\scripts\run_telemetry_etw_smoke_test.ps1 -BinDir src\target\debug -IsolationSessionLifecycle -CheckKeywords -SkipClean), privileged release real-store/HKLM mutation tests, and signed-component ingestion acceptance. Existing Windows build jobs and scheduled isolation-session validation retain their wiring for these scenarios. Local oracle/unit results do not prove Microsoft ingestion. .NET runtime/AOT tests were not run because .NET edits are comments only. CI results for the latest changes are pending.

✅ Checklist

  • Signed the Contributor License Agreement
  • Linked to an issue
  • For features or changes requiring a spec: linked the issue with maintainer-applied feature-accepted
  • For implementation: linked the required approved and merged design/API spec, or explained why no spec is required
  • Feature issue remains open unless this PR completes all agreed implementation, validation, and documentation
  • Updated documentation (if applicable)
  • Updated Copilot instructions (if build, architecture, or conventions changed)
  • If this PR changes Cargo.lock, the dependency-feed-check check passes (see pull request builds)

📋 Issue Type

  • Bug fix
  • Feature
  • Task

Apply the approved four-event inventory to 0.9.0-alpha and 1.0.0 as well as 1.1.0-alpha. Preserve selected typed lifecycle attribution, unattributed-request behavior, consent management, and build gates. Extend existing functional CI scenarios and align SDK documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd8d86b8-5fcd-4f6d-a834-d126b5c3d4d9
Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:43
@azure-pipelines

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

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

The telemetry change breaks published V1 behavior by emitting Required events despite disabled telemetry or withdrawn consent and dropping optional events, requiring explicit maintainer acceptance or preservation of V1 behavior before shipping.

3 open issues
What changed in this PR

Extends MXC’s Required-only Windows telemetry behavior to 0.9.0-alpha and 1.0.0, alongside 1.1.0-alpha, following the earlier telemetry and signed-routing changes.

Changes:

  • Shares contract selection between telemetry initialization and event inventory, and preserves typed Rust lifecycle attribution.
  • Expands ETW validation to three contracts, including disabled request telemetry, denied consent, and restrictive policy.
  • Updates SDK comments and documentation to explain Required collection and the intentional V1 compatibility exception.
File Description
tests/​scripts/​test_telemetry_etw_assertions.ps1 Expands offline trace controls and request validation to three contracts.
tests/​scripts/​run_telemetry_etw_smoke_test.ps1 Exercises Required collection across contracts and consent/policy states.
tests/​scripts/​run_isolation_session_state_aware_tests.ps1 Runs one telemetry lifecycle per supported contract.
tests/​scripts/​README.md Updates telemetry test coverage and prerequisites.
tests/​scripts/​lib/​TelemetryEtwAssertions.ps1 Checks three lifecycles and Required event metadata.
src/​mxc-sdk/​tests/​wxc_e2e_tests_e2e_telemetry_etw.rs Updates live ETW tests for consent-independent Required collection.
src/​mxc-sdk/​src/​telemetry.rs Clarifies optional-consent API documentation.
src/​mxc-sdk/​src/​state_aware_sdk.rs Updates contract-attribution expectations in tests.
src/​mxc-sdk/​src/​options.rs Documents telemetry options as compatibility preferences.
src/​mxc-sdk/​src/​core/​mxc_engine/​verbose_telemetry.rs Tests verbose-transport exclusion for all supported contracts.
src/​mxc-sdk/​src/​core/​mxc_engine/​state_aware.rs Tests lifecycle telemetry with opt-out, denied consent, and restrictive policy.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​session.rs Uses the shared Required-event selector for sessions.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​mod.rs Adds the shared contract selector and expands authorization tests.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​events.rs Updates supported-contract event inventory expectations.
src/​mxc-sdk/​src/​core/​mxc_common/​sdk_input.rs Documents retained typed lifecycle contract attribution.
src/​mxc-sdk/​src/​core/​mxc_common/​models.rs Clarifies telemetry preference and contract-attribution comments.
src/​mxc-sdk/​src/​core/​mxc_common/​config_parser.rs Preserves contract attribution during typed lifecycle normalization.
src/​mxc-sdk/​README.md Explains Required telemetry behavior for Rust callers.
sdk/​node/​src/​v1/​types.ts Updates telemetry configuration comments only.
sdk/​node/​README.md Explains Required collection and consent-management limits.
sdk/​dotnet/​README.md Explains Required telemetry behavior for .NET callers.
sdk/​dotnet/​Microsoft.Mxc.Sdk/​V1/​LifecycleTypes.cs Updates lifecycle telemetry comments only.
sdk/​dotnet/​Microsoft.Mxc.Sdk/​V1/​ExecutionOptions.cs Updates creation-option telemetry comments only.
sdk/​dotnet/​Microsoft.Mxc.Sdk/​V1/​ContainerRequestSections.cs Clarifies telemetry configuration comments only.
README.md Describes Required telemetry across supported contracts.
docs/​telemetry.md Updates collection, compatibility, and consent guidance.
docs/​schema.md Clarifies the telemetry field’s compatibility role.
docs/​development/​build-and-test/​ci-validation-infrastructure.md Documents expanded ETW validation scenarios.
docs/​development/​architecture/​versioning.md Records the intentional telemetry compatibility exception.
docs/​development/​architecture/​telemetry.md Updates event selection, authorization, and acceptance guidance.
docs/​development/​architecture/​telemetry-consent-design.md Separates consent management from Required collection.
docs/​api-reference/​rust/​v1/​types.md Updates the Rust telemetry type description.
docs/​api-reference/​rust/​v1/​api.md Clarifies Rust consent API semantics.
docs/​api-reference/​node/​v1/​types.md Updates the Node telemetry type description.
docs/​api-reference/​node/​v1/​api.md Clarifies Node consent API semantics.
docs/​api-reference/​dotnet/​v1/​types.md Updates the .NET telemetry type description.
docs/​api-reference/​dotnet/​v1/​api.md Clarifies .NET consent API semantics.
.github/​copilot-instructions.md Aligns contributor guidance with Required telemetry behavior.

Review effort: Balanced

Keep the supported-contract matrix running on every platform, but expect Windows-only consent persistence to fail on Linux and macOS. Preserve Windows persistence checks and every build-eligibility assertion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd8d86b8-5fcd-4f6d-a834-d126b5c3d4d9
Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:55

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

The change breaks existing V1 telemetry opt-out behavior and leaves typed Rust V1 creation outside the intended Required-only collection path.

4 open issues

Review effort: Balanced

…identities

Address Copilot review feedback by retaining the selected V1 contract in the creation adapter and testing Required events through public v1::run with opt-out and denied consent. Check session/root uniqueness across all three ETW lifecycles with consistent-reuse negative controls. Preserve genuinely unattributed requests and the approved compatibility decision.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd8d86b8-5fcd-4f6d-a834-d126b5c3d4d9
Copilot AI balanced review requested due to automatic review settings November 11, 2026 19:20

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

Expanded consent-free collection requires human review of live Windows ETW lifecycle, signed-component routing, and ingestion acceptance evidence that offline and local test-mode results do not establish.

No open issues 🎉

4 resolved since last review

Review effort: Balanced

@richiemsft
Richie Gomez (richiemsft) marked this pull request as ready for review November 11, 2026 19:30
@richiemsft
Richie Gomez (richiemsft) requested a review from a team November 11, 2026 19:30
@richiemsft
Richie Gomez (richiemsft) requested a review from a team as a code owner November 11, 2026 19:30

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tentative approval, pending resolution of inline feedback. Reviewed the complete change with independent Anthropic and OpenAI checks: one agreed, previously reported compatibility alert; one additional finding survived verification; two other concerns were excluded as pre-existing or outside the agreed scope.

The P0 / SDK breaking change alert in the existing thread remains a compatibility alert even though the change is intentional. This approval does not independently establish release-owner acceptance of the documented V1 exception; it does not add a duplicate inline comment.

All reported checks for 389741b17daf97ada8ce5d4523ba6ebb00324a31 passed. Windows x64/arm64 job evidence includes live ETW smoke coverage; the public Rust creation regression and lifecycle-3 reuse controls also ran. No local builds were run. Local tests were skipped because host load exceeded the review limit and this host cannot capture Windows ETW. Head-specific scheduled IsolationSession capture, the ignored standalone Rust ETW tests, and signed-component ingestion acceptance were not verified.

– Copilot, on behalf of Carlos

Keep containment attribution on the internal execution request independently of optional telemetry settings. Preserve the Rust Process alias, update engine and executor readers, and regress JSON and public V1 emission without changing preference presence or policy hashes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cd8d86b8-5fcd-4f6d-a834-d126b5c3d4d9

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

Human review is needed because Windows checks remain in progress and the available evidence does not establish live three-contract ETW lifecycle capture or signed-component ingestion acceptance for this revision.

No open issues 🎉

Review effort: Balanced

@richiemsft

Copy link
Copy Markdown
Contributor Author

CI diagnosis for a4f8f19 / run 43094292584: the four failed jobs are infrastructure failures in artifact upload, not failed compiler/test steps. Linux x64 and ARM64 plus macOS ARM64 failed Upload binaries; Windows ARM64 failed Upload local-only telemetry test executor. The artifact API returned HTML (<!DOCTYPE ...) instead of JSON after five attempts (CreateArtifact / FinalizeArtifact). Build/test steps before those uploads succeeded. Windows ARM64 consent/ETW/release smoke steps after the failed upload were skipped, so those checks are not claimed passed. GitHub Status currently reports a major Actions outage (November 11, 2026), consistent with these failures. No code or CI-gate changes are warranted. Leave retries until service recovery, then rerun the failed jobs and dependent checks.

@richiemsft

Copy link
Copy Markdown
Contributor Author

Attempt 2 follow-up: Linux x64/ARM64 and macOS ARM64 recovered and passed. Windows ARM64 now failed in the unchanged isolation_session integration test dev_json_lifecycle_preserves_execution_and_caller_ownership at captured exec. The native IsoSessionOps.RunProcessWithOptionsAsync API reported failure to initialize its worker process wrapper: 0x8007042a, extendedError=0x8007001F. This same scenario passed on ARM64 in attempt 1 of the identical a4f8f19 commit, and on Windows x64. This suggests an intermittent native-host failure, not another artifact outage; it does not prove a root cause. Started a targeted retry of Windows ARM64 and dependent checks, without changing code, skipping the scenario, or adding retries inside the test. Results are pending.

@richiemsft

Copy link
Copy Markdown
Contributor Author

Attempt 3 completed successfully on unchanged commit a4f8f19. Windows ARM64 passed, including dev_json_lifecycle_preserves_execution_and_caller_ownership (the previously failing scenario), the isolated telemetry ETW smoke test, release-path consent test, and artifact uploads. The full Build workflow and all 31 currently reported PR checks are successful, including dependent SDK integration/package checks. No code changes, assertion changes, or test-local retries were needed.

@richiemsft

Copy link
Copy Markdown
Contributor Author

Gudge (@MGudgin) / Branden Bonaby (@bbonaby) can you take a look?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants