Skip to content

[BREAKING] .NET: Isolate LocalCodeAct subprocess environment - #8159

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
eavanvalkenburg:fix-localcodeact-env-isolation
Sep 8, 2026
Merged

[BREAKING] .NET: Isolate LocalCodeAct subprocess environment#8159
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
eavanvalkenburg:fix-localcodeact-env-isolation

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Member

Motivation & Context

LocalCodeAct documents subprocesses as receiving only explicitly provided environment variables. Process startup should consistently honor that contract for both default and configured usage.

Description & Review Guide

  • What are the major changes? Clear the subprocess environment before applying explicitly configured variables, retain the narrow set of Windows variables required for Python startup, align the public option documentation, and add regression coverage for default and explicit environments.
  • What is the impact of these changes? Subprocesses no longer inherit the parent environment by default. Callers that require environment variables must provide them through LocalCodeActProviderOptions.Environment.
  • What do you want reviewers to focus on? The environment setup in ProcessBridge and the Windows bootstrap-variable compatibility behavior.

Related Issue

N/A

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

The implementation, documentation, and regression coverage consistently enforce the intended environment-isolation contract.

Pull request overview

Isolates LocalCodeAct Python subprocess environments to match the documented contract.

Changes:

  • Clears inherited environment variables and applies explicit configuration.
  • Retains required Windows bootstrap variables.
  • Updates documentation and adds regression tests.
File summaries
File Description
LocalExecuteCodeFunctionIntegrationTests.cs Tests default and explicit environment isolation.
README.md Documents Windows bootstrap-variable retention.
LocalCodeActProviderOptions.cs Updates the public environment contract.
Internal/ProcessBridge.cs Implements subprocess environment isolation.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): 6f099737a6eb
Model: gpt-5.6-sol-fast

Overview

The change unconditionally clears the generated-code runner environment, reapplies only explicitly configured values, and narrowly backfills six Windows bootstrap variables. Both public entry points pass the same option into a fresh ProcessBridge, while real-process regression tests cover null/default and explicit environments. No Critical, High, or Medium residual risk was established.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants