Skip to content

[IsolationSession] State-aware E2E reads the real-exec malformed_id envelope from stdout after #1308 moved it to stderr #1324

Closed

Description

@theelliotm

Relevant area(s)

Windows

Brief description of your issue

The nightly windows-prerelease-isolation-session, x64, isolation-session job fails on a single assertion (69/70 passed):

[malformed_id (every id-consuming phase rejects an undecodable id)]
  FAIL: exec (real): error.code is 'malformed_id' (got '<no envelope>')

This is a stale test assertion, not a product defect. PR #1308 ("[WSLC] Stop state-aware exec failures from corrupting the output they report on") deliberately moved non-dry-run exec error envelopes from stdout to stderr, and updated the documented contract accordingly. It added a Parse-StderrEnvelope helper to the IsolationSession harness but applied it to only one of the two affected call sites.

The runtime is behaving exactly as documented in docs/state-aware-lifecycle/mxc-state-aware-sandbox-api.md:770:

Phase / outcome stdout stderr
Exec, dispatch failed Script's stdout, up to the point of failure Single JSON envelope ({error}), after the script's stderr and any buffered MXC diagnostics

tests/scripts/run_isolation_session_state_aware_tests.ps1:576 still reads the envelope from stdout for the real (non-dry-run) exec phase, so it sees <no envelope> and fails.

Evidence of the incomplete port — conversions applied in #1308 per harness:

Harness Parse-StderrEnvelope call sites
run_wslc_state_aware_tests.ps1 4 (lines 1093, 1115, 1137, 1151)
run_isolation_session_state_aware_tests.ps1 1 (line 938)

Regression window is exact:

Nightly run Created (UTC) Result
36396417892 2026-09-28 08:11 success
f8f59c0 (#1308) merged 2026-09-28 21:04 —
36541144580 2026-09-29 08:11 failure

The IsolationSession backend suite runs only in Validation.Tests.Scheduled.yml — it requires the 1es-mxc-e2e-win-prerelease-isolationsesh-x64 self-hosted image and is not part of PR validation, which is why #1308 merged green.

Steps to reproduce

  1. On a host with IsolationSession support, build the executor and run:
    tests/scripts/run_isolation_session_state_aware_tests.ps1
    
  2. Observe the test group malformed_id (every id-consuming phase rejects an undecodable id).

The underlying invocation is a state-aware exec carrying a structurally invalid id:

{ "phase": "exec",
  "sandboxId": "iso:not-a-valid-payload",
  "process": { "commandLine": "cmd.exe /c echo unreachable" } }

Expected behavior

The harness should read the real exec error envelope from stderr, matching the contract documented at mxc-state-aware-sandbox-api.md:770 and the routing in src/core/wxc/src/main.rs (finalize_state_aware_outcome -> StateAwareExit::ExecError).

Only the real exec iteration of the loop is affected. start, stop, and deprovision are non-exec phases and correctly keep their envelope on stdout; exec --dry-run also correctly keeps it on stdout, and both are already passing.

Actual behavior

tests/scripts/run_isolation_session_state_aware_tests.ps1:576 parses stdout for all four phases:

$r = Invoke-StateAware -Request $req
Assert-True ($r.ExitCode -ne 0) "$phase (real): exit code is non-zero"
$envObj = Parse-Envelope -Stdout $r.Stdout          # <-- stderr for real exec
$code = if ($envObj) { $envObj.error.code } else { '<no envelope>' }
Assert-True ($code -eq 'malformed_id') "$phase (real): error.code is 'malformed_id' (got '$code')"

For the real exec iteration stdout is empty (the workload never ran — correctly refused at the validation hook), the envelope is on stderr, and the assertion reports <no envelope>. The suite throws at scripts/ci/run_backend_validation_tests.ps1:363 and fails the job.

Notes

  • Parse-StderrEnvelope already exists in this harness (line 316); the fix is to use it for the exec iteration only.
  • Worth auditing the remaining Parse-Envelope -Stdout sites in this harness for any other real-exec error path missed by the same port.
  • Behavior is correct — the exec never ran, exited non-zero, and emitted a well-formed malformed_id envelope. Only the channel the test reads is wrong.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugSomething is not working as intended.OS-WindowsApplies specifically to Windows hosts or Windows behavior.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions