Skip to content

Windows: bsk daemon start auto-detached process exits immediately, extension cannot connect #218

Open

Description

@habadog1203

Environment

  • OS: Windows 11 x64
  • Browser: Microsoft Edge
  • bsk CLI version: 0.2.1
  • BrowserSkill extension version: 0.2.1
  • Installation method: official PowerShell install script

Steps to reproduce

  1. Install bsk CLI using the official script:
    irm https://raw.githubusercontent.com/Tencent/BrowserSkill/main/install.ps1 | iex

Activity

  1. habadog1203 commented on Sep 10, 2026

    @habadog1203
    Author

    Expected behavior
    Extension should connect to the local daemon automatically, showing "已连接 / READY".

    Actual behavior
    Extension shows "未连接" (disconnected). Browser console shows:
    WebSocket connection to 'ws://127.0.0.1:52800/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

    Additional investigation
    bsk status reports daemon is running with ws_port: 52800.
    However, netstat -ano | findstr 52800 shows no process listening on port 52800.
    bsk daemon start (default auto-detach mode) starts a daemon process, but the process exits shortly after.
    bsk daemon start --foreground keeps the daemon alive, and the extension connects successfully.
    This suggests the Windows auto-detach mechanism is not working properly.

    Workaround
    Run daemon in foreground and keep the terminal window open:
    bsk daemon start --foreground
    Or create a desktop .bat file with the same command.

  2. zczsw123 commented on Sep 24, 2026

    @zczsw123

    Adding another data point in the same family, plus one documentation gap.

    Environment: Windows 11, bsk 0.3.1, Edge 149.0.0.0, extension 0.3.1.

    On this host the default (daemonize) start always fails, with an explicit refusal:

    error: ensure daemon is running: automatic daemon startup failed:
    cannot start an independent Windows daemon; the host may prohibit Job Object breakaway.
    Run `bsk daemon start --foreground` in a persistent host task outside the per-command Job,
    or start the daemon from an independent terminal, using the same BSK_HOME and OS user.
    Then use BSK_AUTO_START=0 in the agent: 拒绝访问。 (os error 5)
    

    Reproduced in a plain user cmd window, outside any agent/sandbox — so it is not specific to an agent runtime.

    bsk daemon start --foreground works fine:

    12:08:21  Windows daemon process started  pid=13832  background:false  in_job:"Ok(true)"
    12:08:21  daemon lock acquired
    12:08:21  ws server listening  addr=127.0.0.1:52800
    12:08:21  daemon ready  pid=13832  ws_port=52800
    

    Documentation gap: bsk daemon start --help does not list --foreground. The listed options are --json, --mode, --listen, --quiet, --public-url, --tls-cert, --tls-key, -v, -h. So the only working mode on such hosts can be learned only from the error text.

    Suggestions:

    1. Add --foreground to bsk daemon start --help and to the docs.
    2. In the error, print the exact copy-pasteable command including the resolved absolute path of bsk.
    3. Consider an automatic fallback: if daemonize fails with a breakaway error, either continue in foreground with a clear notice, or fail with a one-line fix instead of a long paragraph.

    Also related: #320 (auto-start hangs when no daemon is running) — same family, different symptom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions