From c6a2b1b5763325b47c583a2d3d7f384dfab3ba0b Mon Sep 17 00:00:00 2001 From: jesse Date: Sun, 15 Mar 2026 18:24:23 +0000 Subject: fix: auto-foreground brainstorm server on Windows/Git Bash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- skills/brainstorming/scripts/start-server.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'skills/brainstorming/scripts') 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)" -- cgit From addfe8511a0543d04b30ff50b7e5f6c88e998368 Mon Sep 17 00:00:00 2001 From: jesse Date: Sun, 15 Mar 2026 18:38:00 +0000 Subject: fix: use portable shebang #!/usr/bin/env bash in all shell scripts Replace #!/bin/bash with #!/usr/bin/env bash in 13 scripts. The hardcoded path fails on NixOS, FreeBSD, and macOS with Homebrew bash. #!/usr/bin/env bash is the portable POSIX-friendly alternative. Tested on Linux and Windows (Git Bash + CMD). macOS is the primary beneficiary since Homebrew installs bash to /opt/homebrew/bin/bash. Based on #700, closes #700. Co-Authored-By: Claude Opus 4.6 --- skills/brainstorming/scripts/start-server.sh | 2 +- skills/brainstorming/scripts/stop-server.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'skills/brainstorming/scripts') diff --git a/skills/brainstorming/scripts/start-server.sh b/skills/brainstorming/scripts/start-server.sh index cb62a6d..a60025c 100755 --- a/skills/brainstorming/scripts/start-server.sh +++ b/skills/brainstorming/scripts/start-server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Start the brainstorm server and output connection info # Usage: start-server.sh [--project-dir ] [--host ] [--url-host ] [--foreground] [--background] # diff --git a/skills/brainstorming/scripts/stop-server.sh b/skills/brainstorming/scripts/stop-server.sh index c3724de..71c40c1 100755 --- a/skills/brainstorming/scripts/stop-server.sh +++ b/skills/brainstorming/scripts/stop-server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop the brainstorm server and clean up # Usage: stop-server.sh # -- cgit From a4c48714bc33e0c86eb8efc4fa08e7abf3b0c54f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 16 Mar 2026 15:57:27 -0700 Subject: Use generic "the agent" instead of "Claude" in brainstorm server --- skills/brainstorming/scripts/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'skills/brainstorming/scripts') diff --git a/skills/brainstorming/scripts/server.js b/skills/brainstorming/scripts/server.js index dec2f7a..86c3080 100644 --- a/skills/brainstorming/scripts/server.js +++ b/skills/brainstorming/scripts/server.js @@ -94,7 +94,7 @@ const WAITING_PAGE = ` h1 { color: #333; } p { color: #666; }

Brainstorm Companion

-

Waiting for Claude to push a screen...

`; +

Waiting for the agent to push a screen...

`; const frameTemplate = fs.readFileSync(path.join(__dirname, 'frame-template.html'), 'utf-8'); const helperScript = fs.readFileSync(path.join(__dirname, 'helper.js'), 'utf-8'); -- cgit From 61a64d7098365951492cb0276393343117d2c848 Mon Sep 17 00:00:00 2001 From: savvyinsight Date: Mon, 16 Mar 2026 01:23:32 +0800 Subject: fix: verify server actually stopped in stop-server.sh --- skills/brainstorming/scripts/stop-server.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'skills/brainstorming/scripts') diff --git a/skills/brainstorming/scripts/stop-server.sh b/skills/brainstorming/scripts/stop-server.sh index 71c40c1..2e5973d 100755 --- a/skills/brainstorming/scripts/stop-server.sh +++ b/skills/brainstorming/scripts/stop-server.sh @@ -17,7 +17,31 @@ PID_FILE="${SCREEN_DIR}/.server.pid" if [[ -f "$PID_FILE" ]]; then pid=$(cat "$PID_FILE") - kill "$pid" 2>/dev/null + + # Try to stop gracefully, fallback to force if still alive + kill "$pid" 2>/dev/null || true + + # Wait for graceful shutdown (up to ~2s) + for i in {1..20}; do + if ! kill -0 "$pid" 2>/dev/null; then + break + fi + sleep 0.1 + done + + # If still running, escalate to SIGKILL + if kill -0 "$pid" 2>/dev/null; then + kill -9 "$pid" 2>/dev/null || true + + # Give SIGKILL a moment to take effect + sleep 0.1 + fi + + if kill -0 "$pid" 2>/dev/null; then + echo '{"status": "failed", "error": "process still running"}' + exit 1 + fi + rm -f "$PID_FILE" "${SCREEN_DIR}/.server.log" # Only delete ephemeral /tmp directories -- cgit