Maestro icon indicating copy to clipboard operation
Maestro copied to clipboard

Copilot CLI Agent crashes via Windows SSH session

Open insidia-jonas opened this issue 6 months ago • 4 comments

It seems that AI‑MAESTRO cannot use Copilot CLI when it is running on a Windows remote host, likely due to problems with the remote shell being used. I am attempting to communicate with the configured Copilot CLI agent, but the application crashes immediately when joining a single group chat.

insidia-jonas avatar May 14 '26 06:05 insidia-jonas

Can you provide a log or any errors that appear? I'll try this out.

chr1syy avatar May 14 '26 08:05 chr1syy

Thanks Chris!

I don't have any logs just the agent exiting with error 1 in Maestro.

The interesting behavior is, on a remote Linux system, it works flawless with copilot cli

insidia-jonas avatar May 14 '26 08:05 insidia-jonas

Thanks for the report, and for the follow-up detail. The Linux-works / Windows-fails contrast was the key clue and it pinned this down exactly.

Root cause

This is not specific to Copilot CLI or to group chat. Maestro's SSH remote execution is POSIX-only. Both command builders in src/main/utils/ssh-command-builder.ts hardcode a bash invocation on the remote host:

  • buildSshCommand() wraps everything in /bin/bash --norc --noprofile -c '...'
  • buildSshCommandWithStdin() runs /bin/bash --norc --noprofile -s

On a Windows remote, OpenSSH hands that to the default shell (cmd.exe or PowerShell), which has no /bin/bash. The process dies before your agent ever starts, which is the bare exit 1 you saw with no logs. The surrounding script has the same assumption throughout: export PATH=..., $HOME/... path probing, cd, inline VAR='val' env prefixes, and base64 -d for image temp files.

Group chat just happened to be the first thing you tried; any agent spawn to that host would fail the same way.

What has shipped so far

#1129 landed on rc (v0.18.4-RC). It does not add Windows support, but it converts that silent exit 1 into an explicit message instead of leaving you guessing:

SSH execution to Windows remote hosts is not yet supported (Maestro builds the remote command for a POSIX shell). See issue #995.

It detects the cmd.exe / PowerShell "is not recognized..." signatures. That is on the RC channel only, not stable yet.

Why this is staying open

Real Windows remote support is bigger than the spawn path. These all generate POSIX shell for the remote host and would still fail even with a correct agent spawn:

  • src/main/utils/remote-fs.ts (file tree, reads, stat/du/find)
  • src/main/utils/remote-git.ts (git status/diff)
  • src/main/agents/probeRemoteMaestroP.ts and the which-based agent detection in src/main/ssh-remote-manager.ts
  • src/main/cue/cue-shell-executor.ts

Doing it properly means a remote-OS concept on SshRemoteConfig, a PowerShell command/quoting path, Windows PATH discovery (including the copilot.cmd npm shim rather than a bare binary), and Windows temp paths. Writing that blind and shipping it into the process-spawn path would be a guess, so we would rather not ship speculative shell generation there.

Labeled enhancement and help wanted since the blocker is validation against a live Windows SSH target.

Would you be up for helping?

Two things that would move this along a lot:

  1. Could you confirm what the default SSH shell is on that Windows host? On the host, Get-ItemProperty "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell (it is cmd.exe unless someone changed it). That decides which quoting model the fix has to target.
  2. If you run an RC build, does the new "not yet supported" message appear in place of the bare exit 1? That confirms the diagnosis end to end.

If you are unblocked in the meantime, a Linux remote or running Copilot CLI locally are the working paths today.

pedramamini avatar Jul 25 '26 18:07 pedramamini

Hi @insidia-jonas, thanks again for reporting this and for the follow-up. The detail that Linux worked and Windows did not is what cracked it.

This is now addressed in the codebase (commit b7bc0d5c0, on both main and rc). It will ship in the next release.

What changed

  • Maestro drives a remote agent by piping a POSIX script into /bin/bash. So the Windows host's OpenSSH DefaultShell has to be a POSIX shell. A Windows host works fine once it answers SSH with Git Bash (or WSL bash) instead of cmd.exe or PowerShell.
  • Test Connection in Settings -> SSH Remotes now spots a Windows PowerShell or cmd.exe default shell. It reports Remote SSH shell is Windows PowerShell (or cmd.exe) and hands you the one-line fix with a copy button, instead of a bare failure.
  • A turn that hits this (Copilot CLI, group chat, or any other agent) now fails with the same guidance instead of a silent exit 1.

The fix on your Windows host

Install Git for Windows, then run this in an elevated PowerShell on the remote:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force

The full walkthrough, including the WSL variant, is at https://docs.runmaestro.ai/ssh-remote-execution#windows-remote-hosts

If Copilot CLI still does not start after that, please reopen this issue or comment here, and include the output from Test Connection. We appreciate your time and patience on this one.

pedramamini avatar Sep 24 '26 04:09 pedramamini