Skip to content

Brainstorming visual companion server exits immediately on Windows (owner PID detection fails) #770

@smshd

Description

@smshd

Description

The brainstorming visual companion server (start-server.sh + server.js) exits almost immediately on Windows with Git Bash. The server starts successfully and outputs server-started JSON, but by the time you try to connect in the browser, it's already shut down with "reason":"owner process exited".

Root Cause

start-server.sh line 94 resolves the owner PID via:

OWNER_PID="$(ps -o ppid= -p "$PPID" 2>/dev/null | tr -d ' ')"

On Linux/macOS, this correctly resolves to the Claude Code harness process, which stays alive for the session. On Windows/Git Bash, the grandparent process is another ephemeral process (mintty or cmd.exe wrapper) that exits shortly after the script returns. The server's lifecycle check in server.js (lines ~311-320) then finds the owner dead and shuts down.

Steps to Reproduce

  1. Windows 11, Claude Code CLI, Git Bash
  2. Run start-server.sh --project-dir /path/to/project
  3. Script returns success with server-started JSON
  4. Try to open the URL in browser -> ERR_CONNECTION_REFUSED
  5. Check .server.log -> shows {"type":"server-stopped","reason":"owner process exited"}

Environment

  • Windows 11
  • Superpowers v5.0.2
  • Git Bash (MINGW64)
  • Node.js 20+

Workaround

Blanking out OWNER_PID before passing to the server works. The server's ownerAlive() function returns true if OWNER_PID is null, and the 30-minute idle timeout still prevents orphaned servers.

Suggested Fix

Either:

  1. Skip owner PID monitoring on Windows (detect via OSTYPE or uname)
  2. Use a different mechanism on Windows (e.g., a heartbeat file the harness touches periodically)
  3. Fall back gracefully when ps -o ppid= returns an unreliable PID

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