Skip to content

Commit 1baec4a

Browse files
authored
Merge pull request #313 from chr1syy/fix-ssh-local-override
Fix ssh remote Agents & dev:win script
2 parents 995c711 + 2a1cadd commit 1baec4a

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

scripts/start-dev.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ $repoRootEscaped = $repoRoot -replace "'","''"
1010
$cmdRenderer = "Set-Location -LiteralPath '$repoRootEscaped'; npm run dev:renderer"
1111
Start-Process powershell -ArgumentList '-NoExit', '-Command', $cmdRenderer
1212

13-
$cmdBuild = "Set-Location -LiteralPath '$repoRootEscaped'; npm run build:prompts; npx tsc -p tsconfig.main.json; `$env:NODE_ENV='development'; npx electron ."
13+
# Wait for renderer dev server to start before launching main process
14+
# This ensures the Vite dev server is ready on http://localhost:5173
15+
Write-Host "Waiting for renderer dev server to start..." -ForegroundColor Yellow
16+
Start-Sleep -Seconds 5
17+
18+
$cmdBuild = "Set-Location -LiteralPath '$repoRootEscaped'; npm run build:prompts; npx tsc -p tsconfig.main.json; npm run build:preload; `$env:NODE_ENV='development'; npx electron ."
1419
Start-Process powershell -ArgumentList '-NoExit', '-Command', $cmdBuild
1520

1621
Write-Host "Launched renderer and main developer windows." -ForegroundColor Green
22+

src/main/ipc/handlers/process.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ export function registerProcessHandlers(deps: ProcessHandlerDependencies): void
393393
// For SSH, env vars are passed in the stdin script, not locally
394394
customEnvVarsToPass = undefined;
395395

396+
// CRITICAL: When using SSH, do NOT use shell execution
397+
// SSH needs direct stdin/stdout/stderr access for the script passthrough to work
398+
// Running SSH through a shell breaks stdin passthrough and the agent never gets the script
399+
useShell = false;
400+
shellToUse = undefined;
401+
396402
logger.info(`SSH command built with stdin passthrough`, LOG_CONTEXT, {
397403
sessionId: config.sessionId,
398404
toolType: config.toolType,

src/renderer/components/NewInstanceModal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,9 @@ export function NewInstanceModal({
785785
)}
786786
<span className="font-medium">{agent.name}</span>
787787
{/* "Beta" badge for Codex, OpenCode, and Factory Droid */}
788-
{(agent.id === 'codex' || agent.id === 'opencode' || agent.id === 'factory-droid') && (
788+
{(agent.id === 'codex' ||
789+
agent.id === 'opencode' ||
790+
agent.id === 'factory-droid') && (
789791
<span
790792
className="text-[9px] px-1.5 py-0.5 rounded font-bold uppercase"
791793
style={{
@@ -1748,6 +1750,7 @@ export function EditAgentModal({
17481750
onRefreshAgent={handleRefreshAgent}
17491751
refreshingAgent={refreshingAgent}
17501752
showBuiltInEnvVars
1753+
isSshEnabled={isSshEnabled}
17511754
/>
17521755
</div>
17531756
)}

src/renderer/components/shared/AgentConfigPanel.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ export interface AgentConfigPanelProps {
258258
compact?: boolean;
259259
// Show built-in environment variables section
260260
showBuiltInEnvVars?: boolean;
261+
// SSH remote execution enabled for this session
262+
isSshEnabled?: boolean;
261263
}
262264

263265
export function AgentConfigPanel({
@@ -287,6 +289,7 @@ export function AgentConfigPanel({
287289
refreshingAgent = false,
288290
compact = false,
289291
showBuiltInEnvVars = false,
292+
isSshEnabled = false,
290293
}: AgentConfigPanelProps): JSX.Element {
291294
const padding = compact ? 'p-2' : 'p-3';
292295
const spacing = compact ? 'space-y-2' : 'space-y-3';
@@ -350,6 +353,7 @@ export function AgentConfigPanel({
350353
return (
351354
<div className={spacing}>
352355
{/* Path input - pre-filled with detected path, editable to override */}
356+
{/* When SSH is enabled and no custom path is set, show the remote binary name instead of local path */}
353357
<div
354358
className={`${padding} rounded border`}
355359
style={{ borderColor: theme.colors.border, backgroundColor: theme.colors.bgMain }}
@@ -358,8 +362,8 @@ export function AgentConfigPanel({
358362
className="block text-xs font-medium mb-2 flex items-center justify-between"
359363
style={{ color: theme.colors.textDim }}
360364
>
361-
<span>Path</span>
362-
{onRefreshAgent && (
365+
<span>{isSshEnabled ? 'Remote Command' : 'Path'}</span>
366+
{onRefreshAgent && !isSshEnabled && (
363367
<button
364368
onClick={onRefreshAgent}
365369
className="p-1 rounded hover:bg-white/10 transition-colors flex items-center gap-1"
@@ -374,30 +378,39 @@ export function AgentConfigPanel({
374378
<div className="flex gap-2">
375379
<input
376380
type="text"
377-
value={customPath || agent.path || ''}
381+
value={customPath || (isSshEnabled ? agent.binaryName : agent.path) || ''}
378382
onChange={(e) => onCustomPathChange(e.target.value)}
379383
onBlur={onCustomPathBlur}
380384
onClick={(e) => e.stopPropagation()}
381385
placeholder={`/path/to/${agent.binaryName}`}
386+
// When showing default SSH binary name, make field read-only to prevent accidental modification
387+
readOnly={isSshEnabled && !customPath}
382388
className="flex-1 p-2 rounded border bg-transparent outline-none text-xs font-mono"
383-
style={{ borderColor: theme.colors.border, color: theme.colors.textMain }}
389+
style={{
390+
borderColor: theme.colors.border,
391+
color: theme.colors.textMain,
392+
// Slightly dim read-only fields to show they're not editable
393+
opacity: isSshEnabled && !customPath ? 0.7 : 1,
394+
}}
384395
/>
385-
{customPath && customPath !== agent.path && (
396+
{customPath && (
386397
<button
387398
onClick={(e) => {
388399
e.stopPropagation();
389400
onCustomPathClear();
390401
}}
391402
className="px-2 py-1.5 rounded text-xs"
392403
style={{ backgroundColor: theme.colors.bgActivity, color: theme.colors.textDim }}
393-
title="Reset to detected path"
404+
title={isSshEnabled ? 'Reset to remote binary name' : 'Reset to detected path'}
394405
>
395406
Reset
396407
</button>
397408
)}
398409
</div>
399410
<p className="text-xs opacity-50 mt-2">
400-
Path to the {agent.binaryName} binary. Edit to override the auto-detected path.
411+
{isSshEnabled
412+
? `Remote command/binary for ${agent.binaryName}. Leave empty to use default.`
413+
: `Path to the ${agent.binaryName} binary. Edit to override the auto-detected path.`}
401414
</p>
402415
</div>
403416

0 commit comments

Comments
 (0)