Skip to content

Use login shell to start aish in sidecar pane to inherit proper environment PATH #403

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

Merged
merged 1 commit into from
Aug 1, 2025

Conversation

daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Jul 31, 2025

PR Summary

On macOS, when using the sidecar experience, aish cannot start local MCP servers and the Azure agent cannot get the access token from Az CLI.

This is due to the PATH environment variable not properly setup when iTerm2 starts "aish --Channel ..." in the new pane. iTerm2 uses exec to run the aish command, which directly execute the program without setting up the environment variables properly.

Because of that, the az and pwsh commands cannot be found when retrieving access token, and the MCP server commands cannot be found too, which caused local MCP servers to always fail to start.

The fix is to wrap it with zsh by /bin/zsh -l -c "<aish-path> --channel <channel-string>". In this way, zsh will set up the environment properly, which will then be inherited by aish.


This also fixes #380. After using the shell wrapper, I can no longer reproduce this issue. It's possibly because the shell wrapper makes it slower to get to the selection rendering code, which magically avoid the race condition.

@daxian-dbw daxian-dbw merged commit efef68f into PowerShell:main Aug 1, 2025
4 checks passed
@daxian-dbw daxian-dbw deleted the mac_fix branch August 1, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MacOS: The initial agent selection page renders badly sometimes when starting AIShell by calling Start-AIShell from PowerShell
2 participants