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
Adds ignored Windows tests that call the process security environment (PSEC) API directly and record what one environment handle supports: sequential launches, concurrent launches, closing with a running or terminated child, and creation or launch failures. The tests print PSEC-OBSERVATION key=value lines, assert the observed behavior, and run in every scheduled ProcessContainer process job.
This is a probe only. It does not change how MXC creates, reuses, or closes environments, and it never deletes a container profile.
Observed behavior
Scheduled run 43555353623 ran all four tests on 10 hosts (Windows 24H2, 25H2, 26H2, prerelease 26H1 and the prerelease process-container image, each on x64 and arm64). PSEC was supported on every host, no test was skipped, and every host gave the same result. Run 43530387147 on an earlier probe revision gave the same results, except that it did not record whether the profile stays while a child runs after close.
All environments were created with flags 0 and a minimal policy, and every launch was short-lived.
One handle serves many launches. Sequential and concurrent launches on one handle succeed. A failed launch (missing program) does not stop later launches on the same handle.
Launches on one handle share state. Creating the environment makes one AppContainer profile before the first launch. Every launch sees the same TEMP, TMP and GetTempPath() inside that profile, and files written by one launch are visible to later and concurrent launches. A second handle gets a different profile.
TEMP is set by the launch. The child's LOCALAPPDATA is set inside the profile and TEMP/TMP under it. A TEMP or TMP value in the supplied environment block does not reach the child.
Close does not end running children. With flags 0, closing the handle while a child runs returns at once, and the child is still running 10 seconds later. The profile stays while that child runs and is removed within about 50 ms after the child ends. When all children have exited before close, the profile is already gone when close returns.
Failures leave nothing behind. Invalid, truncated, or unsupported-version specifications fail creation (0x8007000D, 0x80070032) without creating a profile. The brokered read/write directory keeps no package-SID entries.
MXC binds only the create, query-support, version-support and close exports, so the policy is fixed for the life of a handle. Per launch, only the command line, environment block, working directory, standard handles and creation flags can change.
Not measured: creation latency, several children or grandchildren alive at close, a child that never exits, a handle held for hours, job objects, the terminate-on-close flag, and use across different users or tokens.
Recommendation
Reuse of one PSEC handle is a reasonable subject for a separate production proposal. A launch trampoline is not needed for reuse, because the handle itself already supports repeated and concurrent launches. This PR does not implement either.
A production proposal would need to:
use one handle per session and per policy, create a new handle when the policy changes, and never share a handle across users or trust boundaries;
end every process launched in the environment, including grandchildren, and confirm that they exited before closing, or validate the terminate-on-close flag instead;
accept that commands on one handle share files and TEMP; a command that needs a fresh sandbox needs a new handle;
measure the cases listed above as not measured.
🔗 References
Refs github/copilot-agent-runtime#19663
🔍 Validation
The probe runs in the scheduled ProcessContainer process jobs. The bundle build checks that all four tests are discoverable, and the runner fails the job if any of them fails.
gh workflow run "Scheduled Validation Tests" --ref test-windows-psec-lifetime-19663 -f plan=nightly: started run 43555353623 on 9995425e. All four probe tests passed on all ten process hosts. The run as a whole failed because of other jobs not related to this change: WSLC host preparation, MicroVM, bubblewrap and seatbelt.
Local build, test, format and lint: not run. All validation for this change comes from CI.
Add ignored Windows tests that drive the process security environment API
directly and record what one handle supports: sequential and concurrent
launches, close with a running or terminated child, and failure cases.
Run them in the scheduled ProcessContainer validation lane.
Refs github/copilot-agent-runtime#19663
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e5e20fa-0d33-4b62-9fed-4f8b1bf849f0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The validation runner can misclassify passing probes as failures and abort subsequent suites, while the cleanup probe can mistake inaccessible directories for successful removal.
Adds Windows-only probes for process security environment (PSEC) handle lifetime, providing evidence for future handle-reuse decisions without changing MXC’s production behavior or deleting container profiles.
Changes:
Adds ignored tests for sequential and concurrent launches, closing handles with children, and failure recovery.
Packages and runs the probes in scheduled ProcessContainer validation.
Documents the probes and their observation logs.
Windows runtime behavior was not verified during this review.
The generated ProcessSecurityEnvironmentT is non-exhaustive outside
mxc-sdk, so the probe cannot construct it with a struct expression.
Refs github/copilot-agent-runtime#19663
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e5e20fa-0d33-4b62-9fed-4f8b1bf849f0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The --nocapture invocation breaks required-test result parsing, causing passing probes to be reported as failures and aborting the scheduled validation lane before remaining probes and suites.
[P2] The profile-removal timer starts only after waiting for the child, possibly terminating it, and joining the closing thread, so cleanup that takes two seconds after close can be reported as running_child_profile_removed_after_ms=0. Cleanup following a host-issued termination can also be mistaken for cleanup caused by close. Poll profile existence alongside child liveness from the close event, and distinguish observations before and after forced termination.
#1733 moved requested_sandbox_kind from TelemetryConfig to
ExecutionRequest, which left this contract test unable to compile on main.
Refs github/copilot-agent-runtime#19663
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e5e20fa-0d33-4b62-9fed-4f8b1bf849f0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The --nocapture option disrupts libtest result lines required by the validator, causing passing probes to be rejected and preventing the remaining probes and network/policy suites from running.
Scheduled run 43517524231 showed on all ten Windows process hosts that an
AppContainer launch derives LOCALAPPDATA, TEMP and TMP from the
LOCALAPPDATA in its environment block. An explicit TEMP/TMP does not
reach the child. Pass the host LOCALAPPDATA, as production does, and
assert the derived container TEMP/TMP instead of the disproved
hypothesis.
Run every probe case before failing, so one failed assertion does not
hide the other observations.
Refs github/copilot-agent-runtime#19663
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e5e20fa-0d33-4b62-9fed-4f8b1bf849f0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Using --nocapture disrupts the result lines required by the test parser, causing passing probes to fail validation and blocking subsequent network and policy suites.
Scheduled run 43530387147 showed on all ten Windows process hosts that
CloseProcessSecurityEnvironment returns at once while a child runs and
does not end that child. Assert that observed behavior, and record
whether the profile directory exists while the child still runs.
The --nocapture output splits the libtest "test <name> ... ok" line, so
the required-test check rejected passing cases. --exact with the
pass/fail summary already proves that the named case passed.
Refs github/copilot-agent-runtime#19663
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e5e20fa-0d33-4b62-9fed-4f8b1bf849f0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The cleanup probe can falsely report successful removal when Path::exists() encounters a metadata error; it should use try_exists() and explicitly fail on lookup errors.
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 ignored Windows tests that call the process security environment (PSEC) API directly and record what one environment handle supports: sequential launches, concurrent launches, closing with a running or terminated child, and creation or launch failures. The tests print
PSEC-OBSERVATION key=valuelines, assert the observed behavior, and run in every scheduled ProcessContainerprocessjob.This is a probe only. It does not change how MXC creates, reuses, or closes environments, and it never deletes a container profile.
Observed behavior
Scheduled run 43555353623 ran all four tests on 10 hosts (Windows 24H2, 25H2, 26H2, prerelease 26H1 and the prerelease process-container image, each on x64 and arm64). PSEC was supported on every host, no test was skipped, and every host gave the same result. Run 43530387147 on an earlier probe revision gave the same results, except that it did not record whether the profile stays while a child runs after close.
All environments were created with flags
0and a minimal policy, and every launch was short-lived.One handle serves many launches. Sequential and concurrent launches on one handle succeed. A failed launch (missing program) does not stop later launches on the same handle.
Launches on one handle share state. Creating the environment makes one AppContainer profile before the first launch. Every launch sees the same
TEMP,TMPandGetTempPath()inside that profile, and files written by one launch are visible to later and concurrent launches. A second handle gets a different profile.TEMP is set by the launch. The child's
LOCALAPPDATAis set inside the profile andTEMP/TMPunder it. ATEMPorTMPvalue in the supplied environment block does not reach the child.Close does not end running children. With flags
0, closing the handle while a child runs returns at once, and the child is still running 10 seconds later. The profile stays while that child runs and is removed within about 50 ms after the child ends. When all children have exited before close, the profile is already gone when close returns.Failures leave nothing behind. Invalid, truncated, or unsupported-version specifications fail creation (
0x8007000D,0x80070032) without creating a profile. The brokered read/write directory keeps no package-SID entries.MXC binds only the create, query-support, version-support and close exports, so the policy is fixed for the life of a handle. Per launch, only the command line, environment block, working directory, standard handles and creation flags can change.
Not measured: creation latency, several children or grandchildren alive at close, a child that never exits, a handle held for hours, job objects, the terminate-on-close flag, and use across different users or tokens.
Recommendation
Reuse of one PSEC handle is a reasonable subject for a separate production proposal. A launch trampoline is not needed for reuse, because the handle itself already supports repeated and concurrent launches. This PR does not implement either.
A production proposal would need to:
TEMP; a command that needs a fresh sandbox needs a new handle;🔗 References
Refs github/copilot-agent-runtime#19663
🔍 Validation
The probe runs in the scheduled ProcessContainer
processjobs. The bundle build checks that all four tests are discoverable, and the runner fails the job if any of them fails.gh workflow run "Scheduled Validation Tests" --ref test-windows-psec-lifetime-19663 -f plan=nightly: started run 43555353623 on9995425e. All four probe tests passed on all tenprocesshosts. The run as a whole failed because of other jobs not related to this change: WSLC host preparation, MicroVM, bubblewrap and seatbelt.✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type