Skip to content

[Bug]: Windows: conhost-wrapped Claude hooks never exit on Claude Code 2.1.233 — every hook event blocks the full 10s timeout and leaks conhost/cmd/curl chains #14837

Closed

Description

@Miscf

What happened?

On Windows, every Claude Code session launched from Orca shows this error on every prompt submit (100% reproducible):

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

It is not specific to UserPromptSubmit: every hook event Orca registers (PreToolUse, PostToolUse, Stop, SubagentStart/Stop, …) blocks for the full 10 s timeout before the harness gives up. Each timed-out invocation also leaves an orphaned conhost.exe → cmd.exe → curl.exe process chain behind that never exits, so they accumulate over time.

Environment

  • OS: Windows 11 Pro (10.0.22621)
  • Orca: 1.4.182 (desktop app)
  • Agent: Claude Code CLI 2.1.233

Root cause analysis

Orca writes hooks into ~/.claude/settings.json like this:

"UserPromptSubmit": [
  {
    "hooks": [
      {
        "type": "command",
        "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 ends with:

"%SystemRoot%\System32\curl.exe" -sS -X POST "http://127.0.0.1:%ORCA_AGENT_HOOK_PORT%/hook/claude" ... --data-urlencode "payload@-" >nul 2>&1

payload@- makes curl read the hook JSON payload from stdin.

Claude Code 2.1.233 does honor the args array (exec form): the full chain runs, claude-hook.cmd executes, and the curl POST completes — I can see its response bytes arrive on stdout. The problem is that the conhost.exe process never exits afterward, so the hook runner waits for process exit until the 10 s timeout fires — every time.

Minimal Node reproduction:

const { spawn } = require('child_process');
const p = spawn('C:\WINDOWS\System32\conhost.exe',
  ['--headless', 'C:\WINDOWS\System32\cmd.exe', '/d', '/c',
   '%USERPROFILE%\.orca\agent-hooks\claude-hook.cmd'],
  { stdio: ['pipe', 'pipe', 'pipe'] });
p.stdin.write(JSON.stringify({ hook_event_name: 'UserPromptSubmit', prompt: 'x' }));
p.stdin.end();
p.on('close', () => console.log('exited'));
setTimeout(() => { console.log('still running after 10s'); p.kill(); }, 10000);

Measured results (same batch file, stdin written then closed, exactly like the hook runner does):

spawn target result
conhost.exe --headless cmd.exe /d /c claude-hook.cmd never exits (killed after 8 s in the test; curl had already completed)
cmd.exe /d /c claude-hook.cmd directly exits in ~50 ms, exit code 0

Running the same conhost-wrapped chain from a bash/MSYS shell exits in ~70 ms, which is why the bug only manifests when Claude Code (Node) spawns it.

Relation to existing issues

Impact

  • Every prompt submit and every tool call in every Claude Code terminal started by Orca on Windows pays a 10 s stall plus the timeout error, and that one status report to the Orca app is lost.
  • Orphaned conhost/cmd/curl chains accumulate until manually killed.

Workaround I'm currently using

Rewrite the hook entries in ~/.claude/settings.json to spawn cmd.exe directly (no conhost wrapper):

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

With this, hooks complete in <100 ms and the timeouts disappear (until Orca rewrites the file on a future update).

Suggested fix

Either spawn cmd.exe directly instead of wrapping it in conhost.exe --headless (verified working; no visible window — no conhost wrapper is needed), or register the hooks as type: "http" entries posting to the same loopback endpoint, eliminating the per-event process spawn entirely.

Activity

  1. p0rygon commented on Aug 16, 2026

    @p0rygon

    Hit this today independently (Orca 1.4.183, Windows 10.0.22631, Claude Code) and isolated it with a controlled repro — I think the root cause here is the same one already diagnosed in #13285, and that report explains this issue's symptom more precisely than "conhost never exits."

    conhost.exe does exit fine once its child actually finishes. The reason it looks like conhost is the one hanging is that claude-hook.cmd's curl ... --data-urlencode "payload@-" is blocked reading stdin, and since curl's stdin here is backed by conhost's ConPTY (not a plain pipe), it never sees EOF on its own — a ConPTY doesn't signal EOF just because nothing is being written, it behaves like a real terminal that could always get more input later. --connect-timeout/--max-time only bound the network transfer; they don't cover curl reading/assembling the request body from stdin before it opens the connection. So curl blocks indefinitely, and conhost (and the whole chain) just never terminates because its child is still alive, not because conhost itself is broken.

    Isolated with System.Diagnostics.Process, mirroring the exact invocation:

    Invocation stdin Result
    conhost.exe --headless → cmd.exe /d /c claude-hook.cmd (as shipped) ConPTY (nothing written, never closed) never exits (killed after 6-15s across several runs)
    same curl command, no conhost wrapper, stdin = a real pipe closed immediately closed pipe → real EOF ~150-200ms, 204 from the local hook server
    same curl command, <nul appended, conhost wrapper still in place NUL device → immediate EOF ~100-300ms, 204 confirmed from the local hook server

    That third row is the useful one: you don't need to drop the conhost.exe wrapper to fix this (which would reintroduce the visible-console-flash problem from #14815) — just give curl's stdin something that actually EOFs. Adding <nul to the curl line in claude-hook.cmd (right before >nul 2>&1) fixed it here without touching the command/args shape in settings.json at all:

    --data-urlencode "payload@-" <nul >nul 2>&1
    

    This also confirms something #13285 flagged but I hadn't seen directly verified: before this fix, the POST to Orca's local server wasn't just slow, it was never arriving at all — the pane-status report was being silently dropped every single time, on top of the 10s stall.

    #13285's fix list (esp. options 1 and 2 — lower the timeout and/or bound the stdin read) still seems like the right long-term fix since <nul is a one-line patch to a file Orca regenerates on update. Given this issue reproduces the same failure mode on a newer Claude Code build after #13285 was closed, it might be worth treating this as a reopen/regression of that one rather than tracking them separately — happy to attach the raw repro script if useful.

  2. OrcaWin commented on Aug 16, 2026

    @OrcaWin
    Collaborator

    Related: #14815 covers the same Windows conhost + args hook install from the "visible/stranded console" side. This report is the Claude Code 2.1.233 path where args is honored and conhost never exits (10s timeout + leaked process chain). Leaving both open.

  3. AmethystLiang commented on Aug 16, 2026

    @AmethystLiang
    Contributor

    thanks for reporting. looking into it

  4. freddycadima513-svg commented on Aug 17, 2026

    @freddycadima513-svg

    Confirming on Orca 1.4.183 (Windows 11 10.0.22631, Claude Code CLI current): still 100% reproducible, UserPromptSubmit hook timed out after 10s — output discarded on every prompt submit, matching @p0rygon's ConPTY-stdin-never-EOFs diagnosis (direct cmd.exe /d /c claude-hook.cmd with a real pipe completes in ~30–50 ms here).

    One aspect worth calling out explicitly, because it makes the user-side workaround in the OP unstable by design — from the 1.4.183 bundle:

    1. getStatus() decides "installed" by exact command + args equality with the conhost template (qu(e,t){return e.command===t.command&&JSON.stringify(e.args??[])===JSON.stringify(t.args??[])}). The working direct-cmd.exe form is therefore classified as not installed.
    2. install() then strips every hook entry whose command/args reference agent-hooks/claude-hook (any variant, backslash-normalized, -EncodedCommand decoded too) and re-appends the conhost template with timeout: 10.

    So on every Orca start, a user-repaired settings.json is reverted to the hanging conhost form. And because Claude Code snapshots hook config at session start (file edits mid-session don't take effect), any CC session launched between an Orca restart and the next manual re-fix stalls 10 s on every prompt and tool call for its entire lifetime — which is how this presents to end users: "the fix keeps coming back undone."

    Suggested minimal change while the proper fix (drop the conhost wrapper, or type: "http" hooks) is decided: make getStatus()/install() accept the direct cmd.exe /d /c …claude-hook.cmd form as a valid managed install instead of reverting it, so users who've applied the known-good workaround stop getting re-broken on every app start.

  5. p0rygon commented on Aug 20, 2026

    @p0rygon

    Quick follow-up on the local <nul workaround from my comment above: it's confirmed to break on every point release since. On this machine, claude-hook.cmd was regenerated (patch lost, back to the unbounded --data-urlencode "payload@-") on:

    • 1.4.183 → 1.4.184
    • 1.4.184 → 1.4.185

    both same-day, each restoring the original 10s stall until I reapplied <nul and re-verified with the same repro (conhost wrapper intact, ~100-200ms, 204 from the local hook server both times).

    So this isn't an occasional regeneration — it looks like installing any new build rewrites this file unconditionally, which means any file-level patch (mine, or anyone else's) is a maintenance treadmill rather than a fix, and most users hitting this won't notice/reapply it, so the 10s-per-hook-event stall is presumably still live for them right now on current builds. Given how cheap the actual fix is (one flag on one line, or dropping the conhost wrapper as suggested above), it'd be good to get this landed in the installer/generated script rather than left as a local workaround.

  6. brennanb2025 commented on Aug 20, 2026

    @brennanb2025
    Contributor

    Thanks for the unusually good diagnostic work here — @Miscf's minimal repro, @p0rygon's ConPTY-stdin analysis, and @freddycadima513-svg's read of the installer's exact-match getStatus() between them pinned this down faster than we would have.

    This is fixed on main by #14825, which drops the conhost.exe + args shape entirely and installs a single self-contained command instead:

    C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -EncodedCommand <base64>
    

    No args field for a consumer to honor-or-ignore, no ConPTY re-host, and -WindowStyle Hidden keeps the console suppressed — so it fixes this without reintroducing the visible-console problem from #14815. #15403 added a regression test that asserts the payload actually arrives, rather than asserting installer intent, which is what let all three defects through previously.

    That fix landed after the current release was cut, which is why it is not in 1.4.185. It is now queued as a cherry-pick and should ship within 48 hours. Until then the settings.json workarounds in this thread remain the right stopgap — and yes, they will keep getting reverted on each update until the build carrying #14825 lands.

    One extra data point from reproducing this on Windows 11 build 26200, worth recording because it changes what to look for: there the conhost form does not stall at all. It exits 0 in ~41 ms having never executed claude-hook.cmd. Measured over 10 spawns against an instrumented copy of the hook script:

    hook shape payload delivered hangs median
    powershell -WindowStyle Hidden -EncodedCommand (the fix) 10/10 0 512 ms
    conhost --headless cmd /d /c (1.4.185) 0/10 0 41 ms
    cmd.exe /d /c (the workaround here) 10/10 0 319 ms

    So the 10 s timeout you see on 22621/22631 and the silent nothing on 26200 are the same defect with different surface behavior — and @p0rygon's point that the status POST was never arriving at all, not merely arriving late, holds on both. On newer Windows there is no error message at all, which is why some users will have been losing agent status without ever seeing a hook warning.

  7. amomurawskiio425-cloud commented on Aug 23, 2026

    @amomurawskiio425-cloud

    Your 100% reproducible 10s timeout per event + the leaked conhost/cmd/curl chain is exactly the failure mode I had. Each timed-out hook leaves an orphaned process chain because the curl under conhost --headless is blocked reading stdin that never gets EOF, so the harness gives up at 10s while the chain never exits.

    The giveaway: Orca writes command: conhost.exe + args:[…], but the hook schema only executes command, so --headless never applies and the wrapper misbehaves. It's an Orca-side bug, which is why it follows you across every event.

    Manual removal doesn't stick because Orca reinscribes all 11 events on next launch. The only thing that made my machine stable was cleaning the residue automatically — Coffee CLI strips exactly the Orca entries on startup, keeps my own hooks, and sits out while Orca's alive. No more 10s timeouts or process pile-up after that.

    Honest note: it can't recover hooks/configs Orca already destroyed, and it's a no-op if Orca's currently running. But the config-pollution half is actually fixed, not patched over. https://github.com/edison7009/Coffee-CLI/releases/tag/v3.3.8

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions