Repository navigation
Conversation
ExecSandboxProcess kept the trait's default kill_for_timeout, a plain kill, so an exec that its caller's deadline ended reported the killed process's exit code. Record the request, then kill, and report an exit observed afterwards as ErrorKind::TimedOut with the message "sandbox execution timed out", the text TelemetryProcess uses: the kill may have been refused, so the message claims no termination. A timeout the backend reports and a waiter failure are unchanged. Verified: cargo fmt --all -- --check; cargo clippy -p mxc-sdk --all-targets --all-features --locked -- -D warnings; cargo test -p mxc-sdk --lib --locked exec_stream; a mutation check, 7 of 7 mutations detected; Build run 47223511072; trial run 47223712482, where 9 of 10 isolation-session jobs passed and the other failed only the post-exit output check (#1898). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2a155d40-78af-49e8-a116-b24a41698eb7
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Timeout handling can replace confirmed or already-observed exit results with TimedOut, breaking SDK behavior, and lacks deterministic caller-deadline regression coverage.
3 open issues
What changed in this PR
Updates lifecycle execution timeout reporting to address the Node SDK exit-code inconsistency in #1895.
Changes:
- Records timeout requests before termination and reports subsequent exits as timeouts.
- Adds regression tests for accepted and refused kills, repeated waits, and preserved waiter failures.
| File | Description |
|---|---|
src/mxc-sdk/src/core/mxc_common/exec_stream.rs |
Adds timeout tracking, result classification, and regression tests. |
Review effort: Max
state_aware_exec_killed_for_a_caller_timeout_reports_a_timeout builds an exec's ExecSandboxProcess from the IsolationSession backend as the engine does, without the engine's telemetry wrapper, requests a timeout kill, and expects ErrorKind::TimedOut. Release builds route telemetry, and with it active the wrapper reports the timeout itself, so a test through the public API passes without the override. Verified on a development host with IsolationSession, in a release build: the test passed 10 of 10 runs, and failed 4 of 4 with exit code 1 with the override's request recording disabled; isolation_session.rs passed; cargo fmt --all -- --check; cargo clippy -p mxc-sdk --all-targets --all-features --locked -- -D warnings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2a155d40-78af-49e8-a116-b24a41698eb7
There was a problem hiding this comment.
🔵 Needs a closer look
Reporting TimedOut after W365 refuses a timeout kill conflicts with its documented remote-termination requirement, requiring maintainers and W365 owners to approve the compatibility tradeoff.
No open issues 🎉
1 resolved since last review
Review effort: Max
Gudge (MGudgin)
left a comment
There was a problem hiding this comment.
Summary
Requesting changes for finding 1 from the review of 17767b5. The same W365 case is already discussed in this inline thread; this review references it rather than adding a duplicate inline comment.
High — SDK breaking change: preserve W365's confirmed remote exit
Location: src/mxc-sdk/src/core/mxc_common/exec_stream.rs:375
Attribution: introduced_by_change on the telemetry-inactive path. The new timeout_requested conversion changes a successful W365 terminal result that the base adapter preserved.
A Rust caller can obtain a MxcProcess through v1::dev::spawn_in_container_json. If W365 has published a genuine remote EXIT before the caller's deadline expires, but the adapter has not consumed it, kill_for_timeout() returns remote_termination_unsupported. After the caller handles that refusal, wait() previously returned WaitResult::Exited(code); it now returns WaitResult::TimedOut, discarding the confirmed remote result.
I have considered the author's response: the generic timeout method promises permanent timeout classification, telemetry-active execution already behaved this way, and Node/.NET do not start their managed W365 deadline. The objection is specifically the existing W365 contract: local deadlines must not produce WaitResult::TimedOut without evidence of remote timeout termination. This patch newly applies the conflicting behavior with telemetry inactive as well.
The Rust path is part of the existing supported surface: V1 Dev spawn returns MxcProcess, the V1 reference lists kill_for_timeout(), and the versioning policy includes V1.Dev and process handles in supported V1. #[doc(hidden)] and experimental backend opt-in do not remove that callable path.
Fix: Preserve W365's backend-reported exit after a refused timeout kill while keeping the intended timeout behavior for locally terminable backends. Add a fixture regression for remote EXIT followed by timeout-kill refusal and final wait, explicitly with telemetry inactive.
Verified clean and validation
cargo test -p mxc-sdk --lib --locked exec_streampassed: 34 tests, including the new timeout classification tests.cargo fmt --all -- --checkpassed.- The added real-backend regression compiled, but explicitly skipped locally because IsolationSession is unavailable on this host. The W365 ordering above was verified through source and contract inspection, not a live-W365 reproduction.
- Rechecked the PR merge-base/head diff and confirmed line 375 is newly added. Supporting W365 implementation and contract/API references are byte-identical across that range.
Verified pre-existing — not attributed to this PR
- The telemetry-active wrapper already reclassifies this W365 outcome; that pre-existing behavior is not a second blocker attributed to this patch.
- Generic cached-exit reclassification follows the timeout method's documented contract and is not included as a finding.
Only finding 1 is submitted; the optional Low test-watchdog suggestion is excluded.
W365 cannot end a remote process, and its design forbids reporting a timeout without evidence that the remote command stopped, so a W365 exit received before a refused kill_for_timeout must stay an exit. ExecSandboxProcess::from_unkillable_exec_handle wraps a handle whose terminator cannot end the process: its kill_for_timeout records no timeout request. The engine's W365 exec path uses it, so W365 behaves as it did before the override; other backends keep it. native_execution_failure_and_disposal_fixture now has W365 deliver an exit before a refused kill_for_timeout and expects wait() to return that exit. The case runs only in builds that collect no telemetry: where telemetry is collected, the engine's telemetry wrapper reports the exit as a timeout. Verified: the fixture test failed with TimedOut on 17767b5 and passes with this change, in a debug build, which runs the case, and in a release build, which collects telemetry and skips it; cargo fmt --all -- --check; cargo clippy -p mxc-sdk --all-targets --all-features --locked -- -D warnings; cargo test -p mxc-sdk --lib --locked exec_stream; a mutation check, 9 of 9 mutations detected; no new rustdoc warnings in the changed files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2a155d40-78af-49e8-a116-b24a41698eb7
|
[AgentAssisted] Fixed in 2dd6f48. W365 keeps a plain timeout kill, so an EXIT it received before a refused |


📖 Description
SandboxProcess::kill_for_timeoutpromises that a later exit is reported as a timeout.ExecSandboxProcess, which backs container lifecycle executions, kept the trait's default, a plain kill. So when the Node SDK's own deadline fired first, Node reportedtimedOut: truewith the killed process's exit code instead of-1. With telemetry active, the engine's wrapper already reported a timeout.ExecSandboxProcessnow records the request before it kills, and reports any later exit asErrorKind::TimedOut, even after a refused kill. A timeout the backend reports and a waiter failure are unchanged. Only callers ofkill_for_timeoutsee a difference, and Node is the only SDK that calls it. .NET's deadline callsKill()instead (#1896).W365 cannot end a remote process, and its design forbids reporting a timeout without evidence that the remote command stopped. So W365 keeps a plain timeout kill, and behaves as before.
🔗 References
Fixes #1895
🔍 Validation
state_aware_exec_killed_for_a_caller_timeout_reports_a_timeout(src/mxc-sdk/tests/isolation_session.rs) runs a real IsolationSession exec without the engine's telemetry wrapper, which reports the timeout itself when telemetry is active. In a release build it passed 10 of 10 runs, and failed 4 of 4 with exit code 1 when the override was disabled.native_execution_failure_and_disposal_fixture(src/mxc-sdk/tests/w365_lifecycle/execution.rs) expects a W365 exit received before a refusedkill_for_timeoutto stay an exit, and fails withTimedOutif W365 usesExecSandboxProcess::from_exec_handle. It passes in all seven W365 fixture jobs; builds that collect telemetry skip the case.cargo test -p mxc-sdk --lib exec_streampasses, and fails if any part of the override is removed or reordered, or if waiter failures become timeouts.✅ Checklist
📋 Issue Type
Microsoft Reviewers: Open in CodeFlow