Repository navigation
Python: [BREAKING] .NET: Replace confine workdir option with disable workdir reset on each call - #10487
Merged
Conversation
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 12:35 — with
GitHub Actions
Inactive
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 12:35 — with
GitHub Actions
Inactive
Contributor
Code coverage overviewLanguages: Python, C# Python / code-coverage/python
C# / code-coverage/dotnet
View coverage of the 3 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The shell test can falsely fail on paths containing spaces, and the documentation omits that resetting requires an explicitly supplied workdir.
2 open issues
What changed in this PR
Renames the Python and .NET local-shell working-directory reset options to avoid implying filesystem isolation. This is a breaking API rename; runtime behavior and defaults remain unchanged.
Changes:
- Renames public options and their internal fields, helpers, and callers.
- Clarifies that working-directory resets and command filters do not restrict file access.
- Updates tests to use the new names and demonstrate access outside the working directory.
| File | Description |
|---|---|
python/samples/02-agents/tools/local_shell_with_environment_provider.py |
Uses the renamed option. |
python/samples/02-agents/providers/openai/client_with_local_shell.py |
Removes misleading confinement wording. |
python/samples/02-agents/harness/build_your_own_claw/README.md |
Clarifies shell reset and isolation limits. |
python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/agent.py |
Updates option, documentation, and logging. |
python/samples/02-agents/harness/build_your_own_claw/claw_step03_scaling_capabilities.py |
Updates option and shell-safety explanations. |
python/packages/tools/tests/test_shell_truncate_and_quote.py |
Updates test-module terminology. |
python/packages/tools/tests/test_local_shell_tool.py |
Renames tests and adds access and removed-argument checks. |
python/packages/tools/README.md |
Explains that directory settings are not defenses. |
python/packages/tools/agent_framework_tools/shell/_tool.py |
Renames the public option and private helper; revises documentation. |
dotnet/tests/Microsoft.Agents.AI.Tools.Shell.UnitTests/LocalShellExecutorTests.cs |
Renames tests and adds outside-directory access coverage. |
dotnet/src/Microsoft.Agents.AI.Tools.Shell/ShellSession.cs |
Renames internal reset fields and helper. |
dotnet/src/Microsoft.Agents.AI.Tools.Shell/LocalShellExecutorOptions.cs |
Renames the public property and clarifies its scope. |
dotnet/src/Microsoft.Agents.AI.Tools.Shell/LocalShellExecutor.cs |
Passes the renamed option into sessions. |
dotnet/src/Microsoft.Agents.AI.Tools.Shell/DockerShellExecutor.cs |
Updates the session constructor argument name. |
dotnet/samples/02-agents/Harness/README.md |
Describes the shell as approval-gated rather than confined. |
dotnet/samples/02-agents/Harness/BuildYourOwnClaw/Claw_Step04_ProductionReady/ClawAgent/README.md |
Corrects shell capability wording. |
dotnet/samples/02-agents/Harness/BuildYourOwnClaw/Claw_Step04_ProductionReady/ClawAgent/ClawAgentFactory.cs |
Updates option, safety comments, and logging. |
dotnet/samples/02-agents/Harness/BuildYourOwnClaw/Claw_Step03_ScalingCapabilities/README.md |
Explains reset behavior and isolation limits. |
dotnet/samples/02-agents/Harness/BuildYourOwnClaw/Claw_Step03_ScalingCapabilities/Program.cs |
Uses the renamed property and corrects shell comments. |
Review effort: Balanced
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 13:56 — with
GitHub Actions
Inactive
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 13:56 — with
GitHub Actions
Inactive
Vincent Biret (baywet)
requested changes
Dec 1, 2026
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 14:07 — with
GitHub Actions
Inactive
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 14:07 — with
GitHub Actions
Inactive
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 14:20 — with
GitHub Actions
Inactive
westey (westey-m)
temporarily deployed
to
integration
December 1, 2026 14:20 — with
GitHub Actions
Inactive
Vincent Biret (baywet)
approved these changes
Dec 1, 2026
Vincent Biret (baywet)
left a comment
Member
There was a problem hiding this comment.
Thank you for making the changes!
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Dec 1, 2026
Eduard van Valkenburg (eavanvalkenburg)
left a comment
Member
There was a problem hiding this comment.
Python side looks good
Darren Cohen (dargilco)
approved these changes
Dec 1, 2026
This branch was previously deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Motivation & Context
LocalShellTool(Python) andLocalShellExecutor(.NET) have an option, on by default, that moves each persistent-mode command back to the configured working directory before it runs. That way acdin one call does not carry over to the next call.The option was named
confine_workdir/ConfineWorkingDirectory, and several samples described the shell as "confined to" or "sandboxed in" its working directory. That wording suggests the option limits which files a command can reach, which it does not. A single command can stillcdelsewhere or use an absolute path. This PR renames the option to describe what it does and updates the docs and samples to match.Description & Review Guide
What are the major changes?
false. The old name is removed, since both packages are pre-release.confine=Truebecomesdisable...=False(the default), andconfine=Falsebecomesdisable...=True.LocalShellTool(confine_workdir=...)→LocalShellTool(disable_workdir_reset_on_each_call=...)LocalShellExecutorOptions.ConfineWorkingDirectory→LocalShellExecutorOptions.DisableWorkingDirectoryResetOnEachCallDockerShellTool/DockerShellExecutorwhen commands need to be kept inside a container._maybe_reanchor→_maybe_reset_workdir,MaybeReanchor→MaybeResetWorkingDirectory).client_with_local_shell.pysample, the .NET Harness README, and the Python tools README.Before:
After:
What is the impact of these changes?
TypeError; .NET callers get a compile error. The fix is to dropconfine...=True, or replaceconfine...=Falsewithdisable...=True.What do you want reviewers to focus on?
falsedefault) and the rewritten docs clearly describe the behaviour.Related Issue
N/A - trivial change: renames an option and updates docs so its name and description match its existing behaviour. Runtime behaviour does not change.
AI Assistance
AI assistance details: implementation of the rename, documentation and sample wording, tests, and this PR description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.