Windows: grok-hook.cmd syntax error when GROK_HOME is empty (SessionStart fails)
Summary
I'd like to take this.
Root cause (code-level): grok-hook.cmd always runs:
set "ORCA_GROK_HOME=%GROK_HOME%"
if not "%GROK_HOME:~4096,1%"=="" set "ORCA_GROK_HOME="
if "%ORCA_GROK_HOME:~-1%"=="\" set "ORCA_GROK_HOME=%ORCA_GROK_HOME%."
When GROK_HOME is undefined/empty (common default), cmd still expands %GROK_HOME:~4096,1% / %ORCA_GROK_HOME:~-1% substring forms, which can produce a parse/syntax failure during SessionStart.
Fix: only apply length/trailing-backslash checks inside if defined GROK_HOME / if defined ORCA_GROK_HOME (mirror the POSIX script’s -n "$GROK_HOME" guard). Will open a focused PR with a unit assertion on the generated script.
Reproduction status: env_blocked (Windows grok-hook.cmd / empty GROK_HOME)
Windows .cmd syntax when GROK_HOME is empty is OS-specific. macOS host cannot execute that batch path.
Not labeling cannot_repro.
Duplicate of #9358.
Same root cause: managed grok-hook.cmd uses parse-time %GROK_HOME:~…% / %ORCA_GROK_HOME:~-1% substring expansion, which breaks when GROK_HOME is unset/empty and aborts SessionStart (and other hook events) with a cmd syntax error.
Unique context (reporter, @innocarpe claim, env_blocked note) transferred onto #9358. Tracking continues there.