Repository navigation
Description
On Windows, every agent hook event leaves behind a visible console window that never closes. With
a few agent lanes running, dozens accumulate; the hook payload is written into each stranded shell,
which tries to execute the JSON and fails.
There are two independent causes, one per installer — and each installer holds half of the working
solution.
Cause 1 — the Claude installer emits command + args, and args is ignored
~/.claude/settings.json, identical for all 11 registered events (UserPromptSubmit, Stop,
StopFailure, SubagentStart, SubagentStop, TeammateIdle, PreToolUse, PostToolUse,
PostToolUseFailure, PermissionRequest, SessionStart):
{
"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 Code's hook schema treats command as the complete command line; there is no args. So
what runs is conhost.exe bare, which opens a console hosting the default shell in the current
directory and stays there. The --headless flag — which is exactly what would suppress the window —
never reaches conhost.
Observed, with a Cursor payload landing in one of those stranded shells:
C:\Users\Enrico\.claude>{ "conversation_id":"686540b0-…","model":"grok-4.6","tool_name":"Grep",
…,"hook_event_name":"postToolUse","cursor_version":"2026.08.11-e8db854",… }
A sintaxe do nome do arquivo, do nome do diretório ou do rótulo do volume está incorreta.
Cause 2 — the Cursor installer omits the headless wrapper
~/.cursor/hooks.json registers 8 events (beforeSubmitPrompt, stop, preToolUse, postToolUse,
postToolUseFailure, beforeShellExecution, beforeMCPExecution, afterAgentResponse), each as a
single well-formed command string:
C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -ExecutionPolicy Bypass -EncodedCommand <base64>
The shape is right — one string, forward slashes, payload inside the base64 — but there is no
conhost.exe --headless wrapper and no -WindowStyle Hidden, so Windows creates a visible console
per invocation.
So: the Claude installer knows the headless trick but delivers it through a field the consumer
ignores; the Cursor installer delivers correctly but omits the trick.
The constraint that rules out the obvious fix
The hook command is executed through bash (Git Bash) in this setup — failures surface as
/usr/bin/bash: line 1: …. That imposes three constraints, and the naive "fold the args into the
command string" violates all three:
- Backslash paths collapse.
C:\WINDOWS\System32\conhost.exebecomes
C:WINDOWSSystem32conhost.exe→command not found. Measured on every event after folding. - MSYS path-conversion rewrites
/-prefixed switches into paths.cmd.exe /d /c <script>can
therefore never be written directly in a hook command —/dand/care mangled beforecmd
sees them. - Forward-slash paths handed to
cmdare read as switches.cmd /c "C:/Users/…/claude-hook.cmd"
fails with'laude-hook.cmd' is not recognized…—/Usersis consumed as a switch and the
filename is truncated.
The shape that satisfies all of them
Exactly the one the Cursor installer already uses for its payload — no /-switches, path inside the
base64 — wrapped for headlessness:
C:/WINDOWS/System32/conhost.exe --headless C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -ExecutionPolicy Bypass -EncodedCommand <base64>
where the decoded PowerShell is & '<abs path to hook .cmd>'; exit $LASTEXITCODE.
Applied locally to both files and verified by effect — a healthy hook exits fast and writes
nothing; exit code alone proves nothing here, because conhost returns 0 even when the child fails:
CLAUDE PostToolUse: exit 0 in 99 ms | output empty
CURSOR postToolUse: exit 0 in 261 ms | output empty
CURSOR preToolUse : exit 0 in 53 ms | output empty
Not the same as #11549
src/main/agent-hooks/hook-stdin-contract.ts documents that a Windows hook must exit without reading
stdin when the Orca env is missing, because "a read-to-EOF then blocks forever and strands a visible
window per hook event." That guard behaves as designed — verified that panes created with
orca terminal create --command … do receive ORCA_PANE_KEY, ORCA_AGENT_HOOK_PORT,
ORCA_AGENT_HOOK_TOKEN and ORCA_AGENT_HOOK_ENDPOINT, so the early-exit path is never taken here.
Same visible outcome, different cause.
Suggested fixes
- One shared Windows launcher prefix used by every agent installer (claude, cursor, copilot, kimi,
antigravity…), so the headless wrapper cannot be present in one and missing in another. - Regression tests on the emitted entry, not on the argv the installer intends — the current tests
validate the latter, which is why cause 1 is invisible to them:- no
argskey on the Windows entry; commandstarts with the shared headless prefix;commandcontains no/-prefixed switch and no backslash path (both die under bash/MSYS).
- no
Environment
Orca 1.4.182 · Windows 11 build 10.0.26200.9168 · Claude Code and cursor-agent 2026.08.11-e8db854,
running in Orca panes.
Activity
guanwenpeng2001-bot commentedon Aug 16, 2026
Additional reproduction after updating Orca
I can reproduce the visible-console variant on Windows after updating Orca. This appears to be the same Windows agent-hook installation problem described in this issue, and is still present in Orca 1.4.183.
Environment
--permission-mode bypassPermissionsAOS_AGENT_EXTERNAL_AGENT_ADAPTER-集成分支Observed behavior
Whenever the agent invokes a tool, including
grep, a visible elevatedconhost.exewindow appears repeatedly. The window displays the raw hook payload at the shell prompt instead of remaining hidden. The payload contains fields such as:{"hookEventName":"pre_tool_use","toolName":"grep","toolInput":{...}}This repeats for tool events and can steal focus from the Orca terminal. The behavior started after the Orca update.
Local evidence
The generated global Claude-compatible settings contain hook entries shaped like this for
PreToolUse,PostToolUse, and other lifecycle events:{ "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 }The hook script then passes the payload to curl with
--data-urlencode "payload@-". The visible shell and the raw JSON strongly suggest that the Windows launcher is not being consumed as a hidden, non-interactive process, and/or that the hook stdin is not receiving a proper EOF. The Grok session also reports repeatedglobal/settingshook failures withParserError.Expected behavior
Agent hooks should execute without opening a visible console, should consume or close stdin correctly, should exit promptly, and should not expose internal session/tool metadata or steal keyboard focus.
Related issues
Please test the emitted Windows hook configuration against the actual consumer. A complete hidden launcher command (or a direct HTTP hook) plus an explicit EOF for the curl payload appears necessary; validating only the intended argv is not sufficient.
fix(agent-hooks): make the Windows managed hook survive Claude-hooks-…
fix(agent-hooks): make the Windows managed hook survive Claude-hooks-…
fix(agent-hooks): make the Windows managed hook survive Claude-hooks-…
amomurawskiio425-cloud commentedon Aug 23, 2026
Great write-up — this matches what I found, and the two-cause split is the key insight. Claude installer writes
command+args(args ignored → bare conhost + window), Cursor installer omits the headless wrapper. Either way the host runs a console that never closes, writes the JSON payload into an interactive shell, and tries to execute it as a command — exactly the "invalid filename/directory/volume label syntax" garbage you show.The thing that made it a war, though: fixing by hand doesn't stick. Orca re-registers these on every start, one per installer, so the windows come back and accumulate again.
I got out of it by clearing Orca's residue programmatically — Coffee CLI removes only the Orca-injected hook entries on launch (leaves mine alone, skips while Orca runs, so no conflict). That broke both causes at the source instead of chasing windows one at a time.
Caveat: it can't restore anything Orca already removed, and it won't run while Orca is active. Worth a shot for the residue itself. https://github.com/edison7009/Coffee-CLI/releases/tag/v3.3.8
fix(agent-hooks): ship the launcher shape #16003 actually measured as…
fix(agent-hooks): keep the hook console hidden while dropping the AV-…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): make the Windows managed hook survive Claude-hooks-…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…
fix(agent-hooks): stop the Windows hook launcher spelling the AV-deni…