Skip to content

Regression v1.6.0: Windows compatibility broken for Electron apps (Unix-only launcher tools) #745

@deepziyu

Description

@deepziyu

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:

  1. Providing an escape hatch in execution.ts where OPENCLI_CDP_ENDPOINT is evaluated before launching endpoints.
  2. Handling Windows errors explicitly via platform checks (graceful degradation) inside launcher.ts Unix-dependent functions (detectProcess, killProcess, etc).

Related PR: #744

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions