1. Summary
A regression was introduced in v1.6.0 that prevents opencli from working on Windows with Electron-based applications. The newly added "auto-launcher" logic assumes macOS paths and tools, and forces an error before considering the OPENCLI_CDP_ENDPOINT environment variable, which was the previous "escape hatch" for Windows users.
- Current Version: 1.6.1
- Platform: Windows (All non-Darwin platforms)
- Status: Blocks all Electron-related commands (status, connect, etc.) on Windows.
2. Root Cause Analysis
In version 1.6.0, the execution.ts module was updated to automatically resolve the Chromium DevTools Protocol (CDP) endpoint for Electron apps. However, it does so unconditionally before checking for manual overrides.
Affected Code: src/execution.ts
The executeCommand function triggers the launcher logic:
const electron = isElectronApp(cmd.site);
let cdpEndpoint;
if (electron) {
// BUG: This call is unconditional and fails on Windows
cdpEndpoint = await resolveElectronEndpoint(cmd.site);
}
The failure in src/launcher.ts:
The resolveElectronEndpoint function uses Unix-only tools (pgrep, pkill, osascript).
For example, discoverAppPath has a hardcoded platform check:
function discoverAppPath(app: string): string | null {
if (process.platform !== 'darwin') return null;
// ...
}
When this fails or returns null, the execution engine throws a CommandExecutionError, terminating the process immediately.
3. Comparison with v1.5.0
In version 1.5.0, the system relied on CDPBridge to connect to a running instance. If the user provided OPENCLI_CDP_ENDPOINT, the system would connect directly to that port. This allowed Windows users to run the app in debug mode (--remote-debugging-port) and interact with the CLI seamlessly.
4. Fix Submitted
I have submitted a Pull Request that addresses this by:
- Providing an escape hatch in
execution.ts where OPENCLI_CDP_ENDPOINT is evaluated before launching endpoints.
- Handling Windows errors explicitly via platform checks (graceful degradation) inside
launcher.ts Unix-dependent functions (detectProcess, killProcess, etc).
Related PR: #744
1. Summary
A regression was introduced in
v1.6.0that preventsopenclifrom working on Windows with Electron-based applications. The newly added "auto-launcher" logic assumes macOS paths and tools, and forces an error before considering theOPENCLI_CDP_ENDPOINTenvironment variable, which was the previous "escape hatch" for Windows users.2. Root Cause Analysis
In version 1.6.0, the
execution.tsmodule was updated to automatically resolve the Chromium DevTools Protocol (CDP) endpoint for Electron apps. However, it does so unconditionally before checking for manual overrides.Affected Code:
src/execution.tsThe
executeCommandfunction triggers the launcher logic:The failure in
src/launcher.ts:The
resolveElectronEndpointfunction uses Unix-only tools (pgrep,pkill,osascript).For example,
discoverAppPathhas a hardcoded platform check:When this fails or returns
null, the execution engine throws aCommandExecutionError, terminating the process immediately.3. Comparison with v1.5.0
In version 1.5.0, the system relied on
CDPBridgeto connect to a running instance. If the user providedOPENCLI_CDP_ENDPOINT, the system would connect directly to that port. This allowed Windows users to run the app in debug mode (--remote-debugging-port) and interact with the CLI seamlessly.4. Fix Submitted
I have submitted a Pull Request that addresses this by:
execution.tswhereOPENCLI_CDP_ENDPOINTis evaluated before launching endpoints.launcher.tsUnix-dependent functions (detectProcess,killProcess, etc).Related PR: #744