summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjesse <jesse@magic-kingdom>2026-03-15 18:24:23 +0000
committerjesse <jesse@magic-kingdom>2026-03-15 18:30:35 +0000
commitc6a2b1b5763325b47c583a2d3d7f384dfab3ba0b (patch)
tree341765a9337f9f940f2d469f030d61189ace258c
parentd19703b0a19608df0261fdc5e24bc6891ec2dac9 (diff)
fix: auto-foreground brainstorm server on Windows/Git Bash
Windows/Git Bash reaps nohup background processes, causing the brainstorm server to die silently after launch. Auto-detect Windows via OSTYPE (msys/cygwin/mingw) and MSYSTEM env vars, switching to foreground mode automatically. Tested on Windows 11 from CMD, PowerShell, and Git Bash — all route through Git Bash and hit the same issue. Based on #740, fixes #737. Also adds CHANGELOG.md documenting the fix and a known OWNER_PID/WINPID mismatch on the main branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
-rw-r--r--CHANGELOG.md11
-rwxr-xr-xskills/brainstorming/scripts/start-server.sh10
-rw-r--r--skills/brainstorming/visual-companion.md8
3 files changed, 29 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..c011c5f
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Changelog
+
+## Unreleased
+
+### Fixed
+
+- **Brainstorm server on Windows**: Auto-detect Windows/Git Bash (`OSTYPE=msys*`, `MSYSTEM`) and switch to foreground mode, fixing silent server failure caused by `nohup`/`disown` process reaping. Applies to all Windows shells (CMD, PowerShell, Git Bash) since they all route through Git Bash. (fixes #737, based on #740)
+
+### Known Issues
+
+- **`BRAINSTORM_OWNER_PID` on Windows (main branch only)**: The main branch's `server.js` uses `process.kill(OWNER_PID, 0)` for lifecycle checks, but receives MSYS2 PIDs which are invisible to Node.js (different PID namespace). This causes the server to self-terminate after 60 seconds. Fix: resolve `OWNER_PID` via `/proc/$PPID/winpid` to get the Windows-native PID. The dev branch's `index.js` does not have this issue since it has no OWNER_PID lifecycle check.
diff --git a/skills/brainstorming/scripts/start-server.sh b/skills/brainstorming/scripts/start-server.sh
index b5f5a75..cb62a6d 100755
--- a/skills/brainstorming/scripts/start-server.sh
+++ b/skills/brainstorming/scripts/start-server.sh
@@ -64,6 +64,16 @@ if [[ -n "${CODEX_CI:-}" && "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "t
FOREGROUND="true"
fi
+# Windows/Git Bash reaps nohup background processes. Auto-foreground when detected.
+if [[ "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "true" ]]; then
+ case "${OSTYPE:-}" in
+ msys*|cygwin*|mingw*) FOREGROUND="true" ;;
+ esac
+ if [[ -n "${MSYSTEM:-}" ]]; then
+ FOREGROUND="true"
+ fi
+fi
+
# Generate unique session directory
SESSION_ID="$$-$(date +%s)"
diff --git a/skills/brainstorming/visual-companion.md b/skills/brainstorming/visual-companion.md
index a25e85a..2c35d5d 100644
--- a/skills/brainstorming/visual-companion.md
+++ b/skills/brainstorming/visual-companion.md
@@ -61,6 +61,14 @@ scripts/start-server.sh --project-dir /path/to/project
scripts/start-server.sh --project-dir /path/to/project
```
+**Windows (Git Bash / CMD / PowerShell):**
+```bash
+# Windows/Git Bash reaps nohup background processes. The script auto-detects
+# this via OSTYPE/MSYSTEM and switches to foreground mode automatically.
+# No extra flags needed — all Windows shells route through Git Bash.
+scripts/start-server.sh --project-dir /path/to/project
+```
+
**Gemini CLI:**
```bash
# Use --foreground and set is_background: true on your shell tool call