You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement W365 Agents Phase 3 readiness and execution - #1756
Adds readiness and existing-container execution to the experimental W365 Agents backend, building on the merged Phase 2 checkout/release lifecycle.
start polls readiness within a bounded client budget and succeeds only on Ready.
exec supports Windows executor stdio relay and captured/live execution through the existing Rust, .NET and Node V1.Dev JSON APIs. Commands reuse the caller-owned reservation without implicit checkout, release or replay.
Execution uses HTTP Upgrade: exec, binary framing and an explicit executable command line without a hidden shell. Native pipes preserve binary stdin/stdout/stderr, EOF and genuine exit codes. Independent bounded output queues report truncation explicitly.
Local teardown interrupts blocked I/O and cleans up execution workers. The .NET and Node APIs defer W365 execution deadlines to the native backend so service output drain is not interrupted by a second SDK timer.
Checkout now uses the verified API 3.0; release remains API 2.0, and readiness/execution remain API 1.0.
Adds offline trusted-TLS fixtures, regression coverage for duplex backpressure, early exit, prompt flushing and deadline handling, and required fixture discovery in Windows/Linux/macOS build jobs used by scheduled validation. Updates backend guidance and versioned Dev SDK references.
Limitations: Configuration and tokens remain caller-supplied. Unsupported host policy fails before service work. Typed W365 authoring APIs, create-and-run execution and PTY remain out of scope. Kill/disposal closes local execution but does not confirm remote termination or release the reservation; callers must explicitly stop/deprovision it. Broader authenticated-service and remote cancellation validation remain separate work.
Full Phase 3 validation passed on 027c7d91, including API 3.0 checkout. Local Windows checks use loopback services, generated certificates and synthetic credentials; no live-service calls were made for this validation run.
Passed: all 9 fixtures, including actual executor/example, API 3.0 checkout, API 2.0 release, readiness, binary streams, backpressure, truncation, failures and disposal.
src
cargo test --locked -p mxc-sdk --test mxc_contract_v1_1_0_alpha w365_agents
Passed: lifecycle recovery, readiness and captured/live execution fixture.
The SDK fixtures used the isolated native library rebuilt with cargo build --locked -p mxc_ffi --features 'test-support dotnetsdk' --target-dir target\w365-sdk-fixture from src (passed). $native selected src\target\w365-sdk-fixture\debug\mxc_ffi.dll; Node used that directory through MXC_FFI_DIR. Native fixtures selected the isolated executor through MXC_W365_TEST_EXECUTOR. MXC_W365_TEST_OPENSSL selected C:\Program Files\Git\ucrt64\bin\openssl.exe.
Linux/macOS/ARM64 runtime checks were not run locally. Cross-platform CI and dependency-feed-check results are pending PR builds. Live execution following API 3.0 checkout was verified separately; it was not repeated in these offline checks.
Add bounded Ready-only status polling and existing-container execution through the normal engine and native process adapters. Preserve binary stdin/stdout/stderr, EOF ownership, bounded independent output queues, explicit failures and managed local worker teardown without implicit release or replay.
Enable readiness and captured/live execution through existing experimental Dev JSON APIs alongside reviewed Phase 2 lifecycle support. Retain cross-platform SDK/native-engine coverage and Windows executor integration without changing Linux/macOS shipping CLIs. Add trusted-TLS Rust, .NET, Node and Windows executor fixtures, preserve CI discovery gates, and document lifecycle-only support and remaining service/diagnostic limitations.
Use native-tls and the platform trust store for all W365 transports. Protect execution TLS setup and initial command submission with the existing transport stack helper; cover small caller stacks and certificate/hostname rejection.
Use existing versioned Dev JSON SDK entry points for the W365 execution example and fixtures, without adding a shared engine export.
Share the W365-local User-Agent across lifecycle, readiness and exec requests, with SDK and fresh-executor regression coverage.
Keep execution fully duplex under stdin backpressure using bounded encrypted send buffering and nonblocking socket writes. Add exact-byte large-input/output regression coverage and verify local deadline/disposal while the peer does not read stdin.
Preserve confirmed guest exit codes when execution stdin teardown interrupts console forwarding. Distinguish source read failures from expected destination pipe closure, retain genuine I/O and transport errors, and cover early zero/nonzero exits and host stdin read failures through the actual executor.
Flush each forwarded output chunk in the executor and live example so newline-free prompts are visible before stdin is supplied. Preserve write/flush failures and capture behavior, with actual executor prompt and output-failure regression coverage.
Let the native W365 backend own execution deadlines in the .NET and Node Dev JSON APIs, preserving service output drain and genuine Exit codes without a duplicate SDK timeout kill. Keep other backend deadlines and cancellation/disposal unchanged, and cover late live/captured output and native stalled-peer deadlines in existing SDK fixtures.
Preserve confirmed early guest exit codes in the live execution example by distinguishing host stdin read failures from expected guest input-pipe closure. Extend the existing Windows fixture with actual-example early exit, input error, binary capture and remote failure scenarios, and build the example in required Windows fixture jobs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Update checkout requests, documentation and native/.NET/Node fixtures while preserving API 2.0 release and API 1.0 readiness/execution.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved issues can indefinitely block execution and setup, accept invalid protocol upgrades before sending commands, and impose an unagreed local deadline when the process timeout is zero.
Extends the experimental W365 Agents backend from checkout/release to readiness and repeated command execution on caller-owned reservations, building on Phase 2 and the approved backend design.
Changes:
Adds readiness polling, binary execution streams, bounded output queues, and local teardown.
Enables captured/live execution through existing Dev JSON APIs, with native-owned W365 deadlines and API 3.0 checkout.
Expands trusted-TLS fixtures, cross-platform CI discovery, and consumer documentation; remote termination and authenticated-service validation remain separate work.
File
Description
src/mxc-sdk/tests/w365_lifecycle/execution.rs
Adds execution, backpressure, teardown, and executor fixtures.
src/mxc-sdk/tests/w365_lifecycle.rs
Adds readiness coverage and updates checkout expectations.
Wake output workers on pipe writability instead of sleeping under active drain. Restore original output descriptor flags when the shared adapter transfers native stdio. Drain capture stdin before the remote-error fixture closes its connection.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved host-I/O cancellation and cleanup defects can hang execution after completion or timeout and leave stdin locked, blocking subsequent executions.
[P2] W365 asynchronous errors lose their structured details on this Rust Dev execution route: terminal_to_io retains only the message, and capture creates a fresh SDK error. Remote errors and output overflow therefore lose fields such as the remote code, sandbox ID and available exit code, contrary to docs/development/architecture/designs/1615-w365a-backend/api.md:343–346. Preserve MxcError through the process adapter, convert it to the typed SDK error at the public boundary, and retain those details in capture and wait regression tests.
Cancel blocked host writes and join output workers after a shared final-drain budget. Preserve execution failures and report undelivered output without blocking on an unavailable stderr diagnostic. Cover executor and live-example unread-output completion in offline Windows, Linux and macOS CI.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The transport accepts HTTP 101 responses without validating the exec protocol upgrade, risking command disclosure to the wrong handler and an unknown execution outcome.
[P2] When a live caller takes stdout or stderr and then drops it, these original readers keep the pipe open until execution completes, preventing the output pump from detecting BrokenPipe. Discarded output can therefore fill the 8 MiB queue and make an otherwise successful command fail with output_truncated. Drop the backend-only output readers when the waiter starts, after the adapter has duplicated them, and add a fixture that drops an output stream before the guest emits more than 8 MiB.
Enforce the shared deadline during the TLS handshake
[P2] The socket timeouts apply to individual blocking operations inside tls.connect, not to the total 30-second handshake budget. A peer that slowly fragments its TLS handshake can keep exec setup blocked beyond that budget because the next deadline check runs only after the handshake returns. Drive the handshake nonblockingly against the shared deadline, or interrupt its socket when that deadline expires.
Cancel and join host-input workers before returning from relayed execution. Preserve later console input, real read failures, and shared Unix stdio flags. Extend existing functional fixtures with repeated same-process execution and pending-input teardown.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Share a bounded worker gate for system DNS and charge DNS, TCP, TLS and HTTP upgrade to one setup deadline. Preserve service defaults without imposing a local deadline for zero or omitted process.timeout, and cover the timing boundaries in the existing offline fixtures.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow output pumps to detect caller-dropped streams while retaining stdin and control ownership. Cover boxed and native pipe transfer with discarded output above the queue limit, preserving genuine Exit and unread-output overflow behavior.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Both previously missed findings in this review are addressed:
Total TLS setup deadline — e588942: every underlying socket read/write during TLS and HTTP upgrade uses the remaining shared setup budget. Slow valid TLS fragments cannot restart that budget. The offline fixture exercises a real fragmented handshake against the production TLS client.
Retained output readers — 5b12770: W365 drops its backend-only stdout/stderr readers when the waiter starts, after adapter duplication, while retaining stdin/control ownership. Dropping a caller's output stream now lets that pump detect closure and discard later output. The fixture covers dropped stdout and stderr through both boxed streams and native pipe transfer, with more than 8 MiB discarded, exact output on the other stream and a genuine Exit of -1. Kept-open, unread streams still report output_truncated. This production fix is confined to W365; shared engine/SDK error propagation is unchanged.
The affected execution fixtures and Clippy pass on Windows and Linux. These scenarios extend the existing CI-wired fixture; macOS runtime validation remains for CI.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Two unresolved issues can leave EOF-dependent commands blocked after Ctrl-Z and cancel preserved output when a failed process is dropped before its retained reader is drained.
Include the extracted worker gate in the standalone fixture that compiles filesystem_probe directly, restoring its cross-platform build.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Latch Ctrl-Z EOF after pending console text drains and avoid cancelling retained output after a terminal execution failure. Extend existing fixtures for text followed directly by Ctrl-Z and disposal before draining the preserved overflow prefix.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because an omitted critical finding indicates diagnostic writes can still hang on full, unread pipes in both entry points despite bounded draining.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because final diagnostic writes can hang on a full stderr pipe after the output worker succeeds, bypassing the drain timeout.
Generate non-CA TLS server certificates with digital-signature usage and serverAuth purpose rather than relying on OpenSSL defaults. Include the original error in upgrade fixture assertion failures.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A full, unread stderr pipe can cause the final blocking diagnostic to hang indefinitely despite the five-second output-drain limit, requiring a bounded, cancellable write path and regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The final diagnostic write can block indefinitely when guest output fills an unread stderr or shared output pipe, causing the executor and live example to hang despite the drain timeout.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A full, unread stderr pipe can cause the final blocking diagnostic write to hang beyond deadline budgets even after relays finish, and the existing fixture does not cover this case.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A critical issue remains: exactly-full stderr can cause the final diagnostic write to block indefinitely, bypassing the five-second drain budget and preventing exit.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The final error diagnostic can block indefinitely on a full stderr pipe, and case-sensitive environment serialization can violate Windows last-entry-wins override behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📖 Description
Adds readiness and existing-container execution to the experimental W365 Agents backend, building on the merged Phase 2 checkout/release lifecycle.
startpolls readiness within a bounded client budget and succeeds only onReady.execsupports Windows executor stdio relay and captured/live execution through the existing Rust, .NET and Node V1.Dev JSON APIs. Commands reuse the caller-owned reservation without implicit checkout, release or replay.Upgrade: exec, binary framing and an explicit executable command line without a hidden shell. Native pipes preserve binary stdin/stdout/stderr, EOF and genuine exit codes. Independent bounded output queues report truncation explicitly.3.0; release remains API2.0, and readiness/execution remain API1.0.Adds offline trusted-TLS fixtures, regression coverage for duplex backpressure, early exit, prompt flushing and deadline handling, and required fixture discovery in Windows/Linux/macOS build jobs used by scheduled validation. Updates backend guidance and versioned Dev SDK references.
Limitations: Configuration and tokens remain caller-supplied. Unsupported host policy fails before service work. Typed W365 authoring APIs, create-and-run execution and PTY remain out of scope. Kill/disposal closes local execution but does not confirm remote termination or release the reservation; callers must explicitly stop/deprovision it. Broader authenticated-service and remote cancellation validation remain separate work.
🔗 References
Refs #1615 — maintainer-applied
feature-accepted; remains open.Design/API proposal: #1619 (merged).
Phase 2 prerequisite: #1723 (merged).
🔍 Validation
Full Phase 3 validation passed on
027c7d91, including API 3.0 checkout. Local Windows checks use loopback services, generated certificates and synthetic credentials; no live-service calls were made for this validation run.srccargo build --locked -p wxc --features test-support --target-dir target\w365-fixturesrccargo build --locked -p mxc-sdk --example w365_execution --features test-support --target-dir target\w365-fixturesrccargo test --locked -p mxc-sdk --test w365_lifecycle --features test-support --target-dir target\w365-fixture -- --include-ignoredsrccargo test --locked -p mxc-sdk --test mxc_contract_v1_1_0_alpha w365_agentssrccargo test --locked -p mxc_ffi --lib w365srccargo fmt --all -- --checksrccargo clippy --locked -p mxc-sdk --lib --example w365_execution --test w365_lifecycle --features test-support -- -D warningsdotnet run --project sdk\dotnet\Microsoft.Mxc.Sdk.Tests --framework net10.0 --no-restore "-p:MxcTestPrebuiltNativeLibrary=$native" -- -class Microsoft.Mxc.Sdk.Tests.V1.MxcLifecycleW365Tests -class Microsoft.Mxc.Sdk.Tests.DevEntryPointTestsdotnet run --project sdk\dotnet\Microsoft.Mxc.Sdk.Tests --framework net8.0 --no-restore "-p:MxcTestPrebuiltNativeLibrary=$native" -- -class Microsoft.Mxc.Sdk.Tests.V1.MxcLifecycleW365Tests -class Microsoft.Mxc.Sdk.Tests.DevEntryPointTestssdk\nodenpm run buildsdk\nodenpm run build:test-unitsdk\nodenode --test dist-tests\tests\unit\v1-dev.test.jssdk\node\tests\integrationnpm run buildsdk\node\tests\integrationnode --test dist\w365-fixture.jsThe SDK fixtures used the isolated native library rebuilt with
cargo build --locked -p mxc_ffi --features 'test-support dotnetsdk' --target-dir target\w365-sdk-fixturefromsrc(passed).$nativeselectedsrc\target\w365-sdk-fixture\debug\mxc_ffi.dll; Node used that directory throughMXC_FFI_DIR. Native fixtures selected the isolated executor throughMXC_W365_TEST_EXECUTOR.MXC_W365_TEST_OPENSSLselectedC:\Program Files\Git\ucrt64\bin\openssl.exe.Linux/macOS/ARM64 runtime checks were not run locally. Cross-platform CI and
dependency-feed-checkresults are pending PR builds. Live execution following API 3.0 checkout was verified separately; it was not repeated in these offline checks.✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow