[dotnet-code] Consolidate shell argv helper#536
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the internal shell argv composition in tool/shelltool by consolidating “extra argv + shell-specific suffix” assembly into small unexported helpers, so stateless and persistent shell launch paths share the same composition logic (mirroring the .NET ResolvedShell shape more closely).
Changes:
- Replaced the standalone
combineArgvhelper withresolvedShell.argvWithExtraandresolvedShell.launchArgvto centralize argv assembly. - Updated stateless and persistent argv construction to use the new helpers (no intended behavior change).
- Added a unit test to lock in expected argv shapes when
extraArgvis present for both stateless and persistent bash paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tool/shelltool/localshell.go | Consolidates argv assembly via argvWithExtra/launchArgv and updates stateless/persistent argv builders to use them. |
| tool/shelltool/localshell_internal_test.go | Adds coverage ensuring extraArgv is included in both stateless and persistent argv outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
|
@copilot respond to PR comments and fix codeQL failure |
Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
…intent Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
Fixed in commit |
API Consistency Review — No Parity IssuesThis PR consolidates shell argv assembly into two unexported helpers ( Scope determination: Out of scope for cross-repo parity review. The change is a Go-internal refactor with no user-visible contract changes, matching the PR's own statement: "No public Go API changed. No intentional behavior change was made." No cross-repo consistency issues found.
|
Summary
Consolidated shell argv assembly through small unexported helpers so stateless and persistent shell launch paths share the same extra-argv composition logic. This keeps the Go shell internals closer to the .NET
ResolvedShellshape, where shell-specific suffixes are selected separately from combining constructor-provided extra argv..NET Reference
dotnet/src/Microsoft.Agents.AI.Tools.Shell/ShellResolver.cs- resolves shell kind and combines optional extra argv with stateless/persistent shell suffixes.Public API and Behavior
No public Go API changed. No intentional behavior change was made.
Tests
TestResolvedShellArgvIncludesExtraArgvto preserve existing stateless and persistent argv shapes withShellArgvextras.gofmt -w tool/shelltool/localshell.go tool/shelltool/localshell_internal_test.gogo test ./tool/shelltoolNotes
Rejected sampled candidates:
dotnet/src/Microsoft.Agents.AI.Workflows/HandoffWorkflowBuilder.cs- Go handoff-related workflow builder changes would touch public/broader workflow behavior, and existing open[dotnet-code]workflow PRs already cover nearby workflow internals.dotnet/src/Microsoft.Agents.AI.Workflows/IExternalRequestContext.cs- the Go external request area already has direct behavior coverage, and the sampled .NET interface did not suggest a narrow production cleanup without churn.dotnet/src/Microsoft.Agents.AI.Mcp/Skills/McpJsonContext.cs- the .NET file is source-generated JSON context plumbing, with no useful direct Go equivalent beyond existing MCP JSON helpers.Checked for open shelltool/ShellResolver
[dotnet-code]PR overlap and found none before editing.Closes #486