fix(agent-hooks): preserve Windows background worker stdin contract

This commit is contained in:
Brennan Benson
2026-09-13 14:12:32 -07:00
parent 135681e8c3
commit acb2f15268
2 changed files with 4 additions and 1 deletions
@@ -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')(
+1 -1
View File
@@ -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.