diff --git a/src/main/agent-hooks/grok-replay-guard.test.ts b/src/main/agent-hooks/grok-replay-guard.test.ts index 9c917934dca..1da54f287d2 100644 --- a/src/main/agent-hooks/grok-replay-guard.test.ts +++ b/src/main/agent-hooks/grok-replay-guard.test.ts @@ -104,6 +104,9 @@ describe('Grok vendor hook replay guard', () => { expectGuardBeforeTransport(claude, WINDOWS_GROK_GUARD, 'echo {}') expectGuardBeforeTransport(cursor, WINDOWS_GROK_GUARD, '(echo {})') + const backgroundWorkerGuardIndex = claude.indexOf('CLAUDE_JOB_DIR') + expect(backgroundWorkerGuardIndex).toBeGreaterThan(-1) + expect(backgroundWorkerGuardIndex).toBeLessThan(claude.indexOf(WINDOWS_GROK_GUARD)) }) it.skipIf(process.platform === 'win32')( diff --git a/src/main/claude/hook-script.ts b/src/main/claude/hook-script.ts index 08eef88c51a..efbe71fc9e3 100644 --- a/src/main/claude/hook-script.ts +++ b/src/main/claude/hook-script.ts @@ -33,12 +33,12 @@ export function getManagedScript( // Why (#11549): the env guards must outrank the Devin skip — the Devin skip parks in more.com, // and outside an Orca pane the caller can abandon stdin, so more.com never returns. ...buildWindowsHookEnvironmentGuardLines(), - ...(options.skipWhenGrokImportsClaude ? buildWindowsGrokReplayGuardLines() : []), // Why: a backgrounded session runs in a daemon worker that inherited the dispatching // pane's env, so ORCA_PANE_KEY names a pane this session does not run in (#9236). // Why exit, not the drain label: the drain parks in more.com and a worker is outside // an Orca pane — the abandoned-stdin hang #11549 guards against. 'if not "%CLAUDE_JOB_DIR%"=="" exit /b 0', + ...(options.skipWhenGrokImportsClaude ? buildWindowsGrokReplayGuardLines() : []), ...(options.skipWhenDevinImportsClaude ? [ // Why: Devin imports .claude hooks by default; skip Orca's managed hook there so status posts stay attributed to Devin.