[Windows] Remote Claude sessions spawned by daemon hang (no output)
What version of HAPI is running?
0.8.2
What platform is your computer?
x64
What issue are you seeing?
[Windows] Remote Claude sessions spawned by daemon hang (no output) due to cmd.exe argument truncation from
multi-line --append-system-prompt when using spawn(..., shell: true)
Summary
I’m not sure if this is only happening to me.
On Windows (win32), daemon-spawned remote Claude sessions created from the Web UI never produce any assistant output.
A cmd.exe window may appear but stays blank. The session log stops after “Starting to iterate over
response”.
It looks like HAPI spawns claude with shell: true on Windows (to resolve the npm shim claude.cmd). When the
--append-system-prompt argument contains literal newlines (default behavior in HAPI because it appends a multi-line
Co-Authored-By block), the shell command passed to cmd.exe gets truncated at the newline. As a result, the
underlying node .../claude-code/cli.js process is launched without critical flags like --input-format stream-json
and --permission-prompt-tool stdio, so HAPI waits for stream-json output that never arrives.
Environment
- hapi CLI: 0.8.2 (Windows, bun-compiled
hapi.exe) - OS: Windows 11 x64 (
process.platform=win32) hapi doctorreports Node.js: v24.3.0- Claude Code: 2.1.7 (npm global shim
claude.cmd/claude.ps1) - Setup: local server + local daemon (default
http://localhost:3006)
Logs
In the session log can see:
[claudeRemoteLauncher] TTY available: false[claudeRemote] Starting to iterate over response- then nothing further (no SDK messages / no result)
What steps can reproduce the bug?
Steps to reproduce
- Start server:
hapi server - Start daemon:
hapi daemon start - Open
http://localhost:3006/app, login. - Create a new Claude session on the machine (daemon spawns it in remote mode).
- Send a message like:
hi
Expected behavior
Assistant responds normally (stream-json).
Actual behavior
No assistant output; session appears stuck/hung.
Sometimes an empty cmd.exe window is visible.
What is the expected behavior?
No response
Additional information
No response
Confirmed in code: remote mode forces pathToClaudeCodeExecutable: 'claude', appends systemPrompt via --append-system-prompt, and query() spawns with shell: process.platform === 'win32' on Windows. systemPrompt can include a multi-line Co-Authored-By block. No newline escaping before spawn. So argv can include literal newlines on Windows; truncation not provable from repo alone.
Relevant code:
cli/src/claude/claudeRemote.ts:118-appendSystemPromptcomposed with sharedsystemPromptcli/src/claude/claudeRemote.ts:124-pathToClaudeCodeExecutable: 'claude'cli/src/claude/sdk/query.ts:291---append-system-promptadded to argscli/src/claude/sdk/query.ts:342-spawn(..., { shell: process.platform === 'win32' })cli/src/claude/utils/systemPrompt.ts:14- multi-line Co-Authored-By block text
Need more info:
- Share daemon log line
Spawning Claude Code process: ...(setDEBUG=1) to confirm full argv on Windows - Is Co-Authored-By enabled in Claude settings? That toggles the multi-line block
HAPI Bot
@tiann make a PR to fix this issue.
Branch ready. Commit 53fa12a.
- Windows claude spawn resolves cmd shim to JS entrypoint; avoids cmd.exe truncation on multiline prompts ().
- Apply spawn plan in remote query + local spawn (, ).
PR create blocked: GitHub Actions lacks permission (createPullRequest). Please open PR from to .
Tests: failed; bun missing.
HAPI Bot
Branch hapi-bot/70-2679090 ready. Commit 53fa12a.
- Windows claude spawn resolves cmd shim to JS entrypoint; avoids cmd.exe truncation on multiline prompts (
cli/src/claude/utils/resolveClaudeSpawn.ts). - Apply spawn plan in remote query + local spawn (
cli/src/claude/sdk/query.ts,cli/src/claude/claudeLocal.ts).
PR create blocked: GitHub Actions lacks permission (createPullRequest). Please open PR from hapi-bot/70-2679090 to dev.
Tests: bun typecheck failed; bun missing.
HAPI Bot