-
Notifications
You must be signed in to change notification settings - Fork 132
Fix: Remote SSH Agent Sessions (Windows) #188
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
base: main
Are you sure you want to change the base?
Conversation
ad95897 to
c5c5474
Compare
|
2ab94f5 to
c93d872
Compare
|
|
|
as per discord, i fixed:
|
|
fixed the causes for failing tests through code changes Test Files: 328 passed | 1 skipped |
…wizard, IPC, and agent detection - Added full SSH remote support to the wizard, including propagation of SSH config through all phases - Ensured SSH config flows correctly through IPC bridge (renderer → preload → main) - Improved agent detection with optional sshRemoteId and remote `which` resolution - Fixed SSH config transfer during manual agent creation and auto-selection flows - Added extensive debugging and structured logging for SSH execution, agent availability, and wizard message flow - Improved stdin/JSON streaming for large prompts and remote execution - Added input/output JSON stream handling and enhanced logging for SSH transport - Added sourcing of bash profiles to correctly resolve claude-code binary paths on remote hosts
… and process manager - Added extensive DEBUG-level logging for SSH command execution, spawn details, exit codes, and configuration flow - Improved Wizard SSH remote support: - Debounced remote directory validation to reduce excessive SSH calls - Fixed git.isRepo() to correctly pass remoteCwd for remote checks - Persisted SSH config in SerializableWizardState and validated directories over SSH - Ensured ConversationScreen and ConversationSession consistently pass SSH config for remote agent execution - Fixed "agent not available" errors by forwarding stdin via exec and enabling stream-json mode for large prompts - Enhanced remote agent execution logic in ProcessManager with stdin streaming, exec-based forwarding, and useStdin flag - Improved SSH file browser behavior: - Added resolveSshPath() to locate SSH binaries on Windows (Electron spawn PATH issue) - Corrected getSshContext() handling of enabled/remoteId states - Ensured synopsis background tasks run via SSH instead of local paths - Added Windows development improvements: dev:win script and PowerShell launcher for separate renderer/main terminals - Added additional SSH directory debugging logs for remote-fs and wizard flows Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…utils and resolving TypeScript errors - Added Python 3.11 to Windows CI to restore distutils support required by node-gyp - Ensured native module rebuilds (better-sqlite3, node-pty) succeed on Windows runners - Fixed TypeScript build errors to restore clean compilation across all platforms
- Use full agent path (claude.exe) on Windows to avoid shell:true which breaks stdin piping for stream-json input mode - Fix SSH condition to check enabled flag, not just config existence - Pass sessionSshRemoteConfig through inline wizard to enable remote execution - Add synopsis SSH inheritance from parent session as backend workaround Fixes local wizard crashing with exit code 1 and SSH sessions incorrectly using local paths when SSH was disabled.
3d77404 to
e5ecacc
Compare
pedramamini
left a comment
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.
Thanks for this substantial PR to fix SSH remote execution on Windows! The core functionality looks solid, but there are several issues that need to be addressed before this can be merged.
Critical Issues
1. Duplicated debug logging block
In src/main/ipc/handlers/process.ts around lines 420-465, the SSH command debug logging block is duplicated verbatim twice in a row:
logger.debug(`SSH command details for debugging`, LOG_CONTEXT, { ... });
// ... exact same block repeated immediately after
logger.debug(`SSH command details for debugging`, LOG_CONTEXT, { ... });Please remove the duplicate.
2. Duplicated availability check
In src/renderer/components/Wizard/services/conversationManager.ts around lines 1321-1367, the same if (!isRemoteSession && !agent.available) block appears twice back-to-back. Remove the duplicate.
3. Unused variable
In src/main/ipc/handlers/process.ts:321:
const shouldSendPromptViaStdin = false;This variable is never modified and always false. Either remove it or implement the logic it was intended for.
Code Quality Issues
4. Excessive console.log statements
Several files have raw console.log statements that should be removed or converted to the proper debug logger:
src/renderer/hooks/git/useFileTreeManagement.tshas 5 debug logssrc/renderer/components/Wizard/services/conversationManager.tshas severalsrc/renderer/services/inlineWizardConversation.ts
5. Inconsistent indentation
Multiple files have mixed 2-space and 4-space indentation (e.g., ssh-command-builder.ts, DirectorySelectionScreen.tsx, conversationManager.ts). Please run the linter to normalize.
6. Empty blank line in workflow file
.github/workflows/release.yml adds an empty blank line at line 9 that serves no purpose - please remove.
Architectural Concerns
7. Backend workaround for frontend state issue
In src/main/ipc/handlers/process.ts:352-373, the comment explicitly states this is a workaround:
// Synopsis SSH Fix: If this is a synopsis session and it's missing SSH config,
// try to inherit it from the parent session. This is a backend workaround for
// a suspected frontend state issue where the remote config isn't passed.Please either fix this properly in the frontend, or create an issue to track fixing it and add a // TODO(#issue-number) comment.
8. Shell portability concern
The change from $SHELL -ilc to hardcoded bash -lc with explicit profile sourcing may break for users with zsh or fish as their default shell. The original $SHELL approach was more portable. Please consider:
- Reverting to use
$SHELL - Or documenting this as a known limitation
- Or adding logic to detect the remote shell
Once these are addressed, please ensure all tests pass and linting is clean (PR mentions 2 remaining lint errors). Looking forward to the updated version!
…alled ssh correctly
- Ensure prompts for remote SSH agents are sent via stdin as JSON in stream-json mode, fixing agent crashes with large prompts - Always run background synopsis (history tab) on the correct remote host by propagating SSH config from the main session - Improve wizard error handling: treat nonzero agent exit codes as success if output parses as a valid response, preventing false error states in confidence-building chat - General reliability improvements for remote agent session management and output parsing
… remote git IPC handlers - Ensure remoteCwd is set for all remote git operations (isRepo, status, diff, branch, remote, numstat, tags, branches, info) - Resolves warning about missing remote working directory - Enables correct git repo detection and status for remote directories in wizard and agent flows
|
Thank you for the code review, here's the updated code to address those issues. Critical Issues
Duplications removed.
Duplication removed.
Using StdIn is valued correctly, unused artifacts removed. Code Quality Issues
Correct logger used where necessary, removed excessive console.log and console.debug.
Files normalized, Whitespace errors are fixed
removed Architectural Concerns
Synopsize handles SSH-State correctly without using a Backend-Workaround now.
Reverted back to using Also fixed now: Tests & LintingNo Errors remaining. |
Improving / Fixing Remote SSH Agent Connection from Windows Client .exe (Portable/Setup)
Summary
This PR significantly improves Maestro’s SSH remote execution on Windows by fixing binary detection, stabilizing stdin handling for large prompts, and enhancing the Wizard’s SSH session awareness.
For me, this meant i couldn't use the App at all after the first installation, now i got working agents within Maestro.
Key Changes
SSH Execution & Stdin Handling
Maestro gets to a point where prompts are getting pretty long. In some cases, for example the Onboarding, the messages are longer than the Windows PowerShell allows. This leads to errors in the agent execution.
Wizard SSH Session Awareness
The Wizard wasn't SSH Session aware. From actually discovering an agent to chatting with him, that information was kind of lost and Maestro tried to re-discover the agent.
Discovering GitHub Repo (Wizard Phase 2)
The Wizard couldn't discover the GitHub Repo in my remote directory directly. This got fixed by establishing the correct SSH connection. Also the input field got debounced, because every keyboard hit led to a new ssh-call.
Environment & Shell Improvements
WIP / REVIEW REQUIRED
This PR still needs review. Since i am only developing a solution for "my case" - the changes need to be verified to keep cross-platform compatibility working. This means macOS, linux and windows local agents have to be verified.
Also still not working and in progress:
Issues
This addresses #181, #131,
Related: #56
Test-Coverage / Linting
Currently ~ 20 Test files that have to be sorted, only a small part of that is actually through changes in the ssh code.
Linting has 2 Errors remaining.