Skip to content

[Bug]: Windows agent hooks are wrapped in conhost.exe --headless, which breaks stdin and makes every Claude Code hook time out #15599

Closed

Description

@BushLands

Operating system

Windows

Orca version

1.4.185 (Windows 10 Pro 19045)

Details

Short summary:
The hook entries Orca writes into ~/.claude/settings.json on Windows wrap the hook script in conhost.exe --headless. Under ConPTY the child's stdin is a console handle, not the pipe the agent CLI writes its JSON payload to, so the hook's curl blocks forever reading stdin and every hook invocation dies on the CLI's timeout.

What happened

A warning appeared under every prompt:

UserPromptSubmit hook timed out after 10s — output discarded.
Raise the hook's "timeout" to allow more time.

Orca installs this into ~/.claude/settings.json for all 11 hook events (SessionStart, UserPromptSubmit, Stop, StopFailure, SubagentStart, SubagentStop, TeammateIdle, PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest):

"command": "C:\\WINDOWS\\System32\\conhost.exe",
"args": ["--headless", "C:\\WINDOWS\\System32\\cmd.exe", "/d", "/c",
         "%USERPROFILE%\\.orca\\agent-hooks\\claude-hook.cmd"],
"timeout": 10

claude-hook.cmd posts the event with:

curl.exe -sS -X POST "http://127.0.0.1:%ORCA_AGENT_HOOK_PORT%/hook/claude" ...
  --connect-timeout 0.5 --max-time 1.5 ... --data-urlencode "payload@-"

payload@- makes curl read stdin to EOF to build the request body. Launched under conhost --headless the child gets a pseudoconsole, so the agent's JSON never arrives and EOF never comes. --max-time 1.5 does not help: it bounds the transfer, and the transfer has not started yet while curl is still reading the body from stdin.

Measured on Windows 10 Pro 19045, Orca 1.4.185:

invocation result
conhost --headless + claude-hook.cmd hung, killed at 2 min
conhost --headless + any stdin read hung, killed at 8 s
conhost --headless + exit /b 0 0.06 s
cmd.exe directly + claude-hook.cmd 0.06 s

How can we reproduce it

Minimal repro, no Orca or agent CLI needed:

echo hi | conhost.exe --headless cmd.exe /d /c "set /p X="     # hangs forever
echo hi | cmd.exe /d /c "set /p X="                            # returns instantly

Or end to end: install Orca on Windows, launch Claude Code in an Orca pane, send any prompt, and the timeout warning appears under every message.

Impact

It is not only the visible UserPromptSubmit warning. PreToolUse, PostToolUse and PermissionRequest are registered with the same wrapper, so every single tool call stalls for the full hook timeout before proceeding. An agent doing dozens of tool calls runs many minutes slower than it should, and every Orca-side hook event is silently lost.

Working around it client-side does not stick: replacing command with cmd.exe and dropping the --headless wrapper fixes it immediately (0.06 s, hook delivered), but Orca rewrites ~/.claude/settings.json on the next app start and the breakage returns.

Expected

Either drop the conhost --headless wrapper on Windows for hooks whose stdin must be an inherited pipe, or stop feeding the payload through stdin.

Note that claude-hook.cmd already has a stdin-drain branch (more.com >nul when DEVIN_PROJECT_DIR is set), so the stdin-handling problem is partly anticipated — it just does not cover the ConPTY case.

Anything else that might help

%USERPROFILE%\.orca\agent-hooks\ also ships codex-hook.cmd and gemini-hook.cmd with the same curl-reads-stdin shape. I did not verify how those are invoked, so I do not know whether they hit the same wrapper.

Activity

  1. OrcaWin commented on Aug 20, 2026

    @OrcaWin
    Collaborator

    Already fixed on main by #14825 (regression coverage in #15403). Same failure as #15416.

    Windows managed Claude hooks no longer wrap claude-hook.cmd in conhost.exe --headless. That wrapper replaces the child's stdin with a pseudoconsole, so curl ... payload@- never sees Claude's JSON and every hook times out. On main the installer writes a hidden PowerShell command (-WindowStyle Hidden) that relays stdin, and the managed-hook cleanup sweeps stale conhost exec-form entries.

    You reported this on 1.4.185. That GitHub release does not include this change yet; it is on main and should ship in the next release (we usually release within 48 hours). Please update when that lands. If a newer build still writes the conhost --headless form into ~/.claude/settings.json after one restart, say so here.

  2. amomurawskiio425-cloud commented on Aug 23, 2026

    @amomurawskiio425-cloud

    Your stdin analysis is spot-on — payload@- makes curl read stdin to EOF, but under conhost --headless the child gets a pseudoconsole whose stdin isn't the pipe the CLI writes to, so EOF never arrives and the 10s harness timeout fires. The --max-time 1.5 is a red herring because the transfer hasn't started while curl is still blocked reading stdin.

    Root cause is Orca's Windows hook wrapper, which is why it hits all 11 events and won't repair by hand — Orca rewrites the entries on every start.

    The fix that stuck for me was removing the polluted entries automatically: Coffee CLI cleans the Orca residue on launch (only Orca's entries, your hooks untouched, and it skips while Orca's running). After that every hook returned to normal, no more "timed out after 10s".

    Caveat: nothing Orca already deleted comes back, and if Orca is currently running cleanup won't engage. But the stdin/timeout half is genuinely solved. https://github.com/edison7009/Coffee-CLI/releases/tag/v3.3.8

  3. BushLands commented on Aug 24, 2026

    @BushLands
    Author

    Confirmed fixed. Reporter here, verifying on the same machine.

    Which release carries it: the merge commit of #14825 (02ba70a) is not an ancestor of the v1.4.186 tag, but is reachable from v1.4.187. So 1.4.186 still had the old behaviour and 1.4.187 is the first release with the fix.

    I am now on 1.4.188. ~/.claude/settings.json contains zero occurrences of conhost — the managed-hook cleanup swept the stale exec-form entries on update, without me touching the file. The new entry decodes to exactly what you described:

    $scriptPath = Join-Path $env:USERPROFILE '.orca\agent-hooks\claude-hook.cmd'
    if (Test-Path -LiteralPath $scriptPath -PathType Leaf) { & $scriptPath; exit $LASTEXITCODE }
    [Console]::In.ReadToEnd() | Out-Null; Write-Output '{}'; exit 0

    Ran the actual hook command three times with a real UserPromptSubmit JSON payload on stdin:

    run 1: 0.17s  exit=0  stdout='{}'
    run 2: 0.15s  exit=0  stdout='{}'
    run 3: 0.15s  exit=0  stdout='{}'
    

    Previously this hung until the harness killed it at the 10s timeout. Nothing further needed from my side — thanks for the quick turnaround.

    For anyone landing here from the timeout message: updating to 1.4.187 or newer is sufficient. No manual edit of settings.json and no third-party cleanup tool is required — a hand patch would not survive anyway, since Orca rewrites these entries on every start.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions