-
-
Notifications
You must be signed in to change notification settings - Fork 534
fix: restore PATH/PATHEXT after spreading the provider environment #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -82,12 +82,24 @@ export function localAgentProviderEnvironment( | |||||||||||||||||||||
| ): NodeJS.ProcessEnv { | ||||||||||||||||||||||
| const providerConfig = subagentProviderConfig(config, provider); | ||||||||||||||||||||||
| const env = { ...inherited, ...providerConfig?.env }; | ||||||||||||||||||||||
| // process.env lookups are case-insensitive on Windows, but spreading copies | ||||||||||||||||||||||
| // only the original key casing (commonly "Path"); consumers reading the | ||||||||||||||||||||||
| // plain object's env.PATH then miss. Restore the canonical keys. | ||||||||||||||||||||||
| const pathValue = environmentValueCaseInsensitive(inherited, "PATH"); | ||||||||||||||||||||||
| if (env.PATH === undefined && pathValue !== undefined) env.PATH = pathValue; | ||||||||||||||||||||||
| const pathExtValue = environmentValueCaseInsensitive(inherited, "PATHEXT"); | ||||||||||||||||||||||
| if (env.PATHEXT === undefined && pathExtValue !== undefined) env.PATHEXT = pathExtValue; | ||||||||||||||||||||||
|
Comment on lines
+88
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Preserve case-insensitive provider overrides. When - const pathValue = environmentValueCaseInsensitive(inherited, "PATH");
+ const pathValue = environmentValueCaseInsensitive(providerConfig?.env ?? {}, "PATH")
+ ?? environmentValueCaseInsensitive(inherited, "PATH");
if (env.PATH === undefined && pathValue !== undefined) env.PATH = pathValue;
- const pathExtValue = environmentValueCaseInsensitive(inherited, "PATHEXT");
+ const pathExtValue = environmentValueCaseInsensitive(providerConfig?.env ?? {}, "PATHEXT")
+ ?? environmentValueCaseInsensitive(inherited, "PATHEXT");📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Comment on lines
+88
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a provider sets Windows-cased ArtifactsMixed-case path precedence reproduction
Path precedence output before change
Path precedence output after change
|
||||||||||||||||||||||
| const commandVariable = providerCommandVariable(provider); | ||||||||||||||||||||||
| const command = providerConfig && "command" in providerConfig ? providerConfig.command : undefined; | ||||||||||||||||||||||
| if (commandVariable && command) env[commandVariable] = command; | ||||||||||||||||||||||
| return env; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| function environmentValueCaseInsensitive(env: NodeJS.ProcessEnv, key: string): string | undefined { | ||||||||||||||||||||||
| const found = Object.keys(env).find((entry) => entry.toUpperCase() === key); | ||||||||||||||||||||||
| return found === undefined ? undefined : env[found]; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export function localAgentProviderEnvironmentOverrides( | ||||||||||||||||||||||
| config: SubagentsConfig, | ||||||||||||||||||||||
| provider: LocalAgentProvider, | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Windows-casing regression test verifies
Pathbecoming canonicalPATH, but it neither suppliesPathExtnor asserts canonicalPATHEXT. Removing the productionPATHEXTnormalization still leaves this test passing, so a regression in executable-extension resolution would go undetected. Add a mixed-casePathExtfixture and assert the resultingPATHEXT; this is non-blocking, but otherwise the behavior can regress silently.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Artifacts
PATHEXT normalization coverage check
PATHEXT test output before mutation
PATHEXT test output after mutation