Windows port foundations: MCP IPC, CLI resolution, portable tooling#182
Closed
arul28 wants to merge 13 commits into
Closed
Windows port foundations: MCP IPC, CLI resolution, portable tooling#182arul28 wants to merge 13 commits into
arul28 wants to merge 13 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Foundational Windows port for the ADE desktop app and ADE CLI. No feature work; this lane enables the app to build, ship, and run on Windows with parity for the core agent surfaces (chat, files, MCP, orchestrator, PTY-like workflows).
Scope
adeMcpIpc.ts, preload, registerIpc)..cmd/.exeprobing, wrapper scripts (ade-cli-windows-wrapper.cmd,ade-cli-install-path.cmd), install-path validator.pathUtils.ts, shell detection inshell.ts.after-pack-runtime-fixes.cjsruntime fixes,validate-win-artifacts.mjsartifact validator,cr-sqlitewin32-x64 vendor binary,release-core.ymlworkflow tweaks,.icoicon.universalTools.ts,providerTaskRunner+providerOrchestratorAdapter+orchestratorServiceworker-launch plumbing,taskkill /T /Fprocess-tree termination inprocessExecution.ts.AgentChatMessageList,FilesPage,dirtyWorkspaceBuffersportability fixes.Tests added
providerTaskRunner.test.ts,windowsPackaging.test.ts, new tests inprocessExecution.test.ts(killWindowsProcessTree,terminateProcessTree),pathUtils.test.tsWindows predicates,shell.test.ts,dirtyWorkspaceBuffers.test.ts.Tangentially included (unblocked
ade prs createfor this lane)node_modulesgitignore (worktree symlinks were showing up as untracked).gh auth tokenin ADE CLI whenADE_GITHUB_TOKEN/GITHUB_TOKENenv vars are missing./finalizeplaybook addition (Phase 3j — stale worker-process cleanup).Test plan
Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Improvements
Greptile Summary
This is a large Windows port laying the groundwork for building and running ADE on Windows: named-pipe MCP IPC, Windows-aware CLI resolution and PATH augmentation, stdin-based prompt delivery to avoid shell quoting issues, a node-script launcher for orchestrator workers replacing PTY shell startup, PowerShell/cmd.exe sandbox enforcement, and a full release validation pipeline.
WORKER_CLI_LAUNCHER_SCRIPTreadsprocess.argv[1]for the launch-file path, but Node.js (and Electron withELECTRON_RUN_AS_NODE) setsprocess.argv[1]to""when using the-eflag; the first positional argument is atprocess.argv[2].fs.readFileSync("", "utf8")throws ENOENT and every orchestrator worker exits with code 1.''escape:tokenizePowerShellCommandtreats the first'in a''pair as the closing delimiter for a single-quoted string, silently splitting a path like'C:\work\user''s dir\file'into two tokens. An agent-submitted path traversal sequence (e.g.,'C:\workspace\allowed''/../outside.txt') can pass the workspace-root check while PowerShell resolves the full, out-of-sandbox path.Confidence Score: 3/5
Two P1 defects — a worker launcher that crashes on every invocation and a sandbox tokenizer path-traversal — need resolution before merging.
The
process.argv[1]bug would make all orchestrator workers fail silently with exit code 1. The PowerShell tokenizer''handling is a security boundary bypass in the sandbox enforcement introduced in this PR. Both are present in new code and would affect real users.providerOrchestratorAdapter.ts(argv index bug) anduniversalTools.ts(PowerShell tokenizer''escape) require fixes before merge.Security Review
universalTools.ts): ThetokenizePowerShellCommandfunction does not implement PowerShell's''-escape rule for single-quoted strings. A crafted path argument containing''can cause the sandbox path extractor to check only the prefix of the path (which may be inside the workspace), while PowerShell operates on the full path (which may be outside). This allows an agent-supplied PowerShell command to bypass workspace-boundary enforcement.Important Files Changed
node -e SCRIPT launchFileinvocation vianodeWorkerLaunch. Contains a likely bug whereWORKER_CLI_LAUNCHER_SCRIPTreadsprocess.argv[1]for the launch file path, but Node's-emode places the first positional argument atprocess.argv[2].MUTATING_CMD_REfor cmd.exe. The PowerShell tokenizer does not handle''as an escaped single-quote within single-quoted strings, which can cause path-argument extraction to fail for paths containing apostrophes, potentially weakening sandbox path checks.quoteWindowsCmdArg,resolveCliSpawnInvocation,killWindowsProcessTree, andterminateProcessTree. Well-structured with good error handling.getPathEnvKey/getPathEnvValue/setPathEnvValuefor case-insensitive Windows PATH lookup, plusgetWindowsKnownBinDirscovering Scoop, Winget, Volta, pnpm, npm, and common install paths.resolveRendererSuppliedPathhelper centralizesade-artifact://andfile://URI-to-path resolution across IPC handlers; adds "default" editor target usingshell.openPath; adds Windowsstart ""cmd.exe editor launch.resolveCliSpawnInvocationfor cross-platform spawn andterminateProcessTreeon timeout.quoteWindowsArg) andparseWindowsCommandLineimplementing CommandLineToArgvW rules. Uses deprecatednavigator.platform.\\.\pipe\ade-<sha256[:24]>) or POSIX Unix socket. Correct canonical path normalization before hashing.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[buildStartupCommand] --> B[writeWorkerPromptFile\n.ade/worker-prompts/worker-ID.txt] A --> C[writeWorkerLaunchFile\n.ade/worker-prompts/worker-ID.launch.json] C --> D[resolveCliSpawnInvocation\nwraps .cmd/.bat in cmd.exe on Windows] A --> E[nodeWorkerLaunch] E --> F["spawn(process.execPath,\n ['-e', WORKER_CLI_LAUNCHER_SCRIPT, launchFilePath],\n {ELECTRON_RUN_AS_NODE: '1'})"] F -->|"reads process.argv[1]\n⚠ should be argv[2]"| G[fs.readFileSync launch.json] G --> H[spawn worker CLI\ne.g. claude/codex with args+env] H --> I[stdin piped from promptFilePath] H --> J[child.on exit → finish code] K[terminateProcessTree] --> L{win32?} L -->|yes| M[taskkill /T /F /PID] L -->|no| N[child.kill SIGTERM] M -->|fails| N style F fill:#ffd,stroke:#f90 style G fill:#fdd,stroke:#f00Comments Outside Diff (1)
apps/desktop/src/main/services/orchestrator/providerOrchestratorAdapter.ts, line 348-413 (link)process.argv[1]is empty when Node runs with-eThe
WORKER_CLI_LAUNCHER_SCRIPTis launched as:When Node.js (or Electron in
ELECTRON_RUN_AS_NODEmode) runs with-e,process.argv[1]is set to the empty string""— the first positional argument lands atprocess.argv[2]. The script does:fs.readFileSync("", "utf8")will throwENOENT, thefinish(1)handler fires, and every orchestrator worker launch fails with exit code 1 rather than the real exit code. This makes the worker silently fail without a meaningful error message.Change the script to read
process.argv[2]:The same fix applies to the failure-path inline script on the last
returnbranch ofbuildStartupCommand:Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (9): Last reviewed commit: "Merge main into Windows port lane" | Re-trigger Greptile