fix(agent-hooks): skip Orca's hook scripts outside Orca panes (#43081)

* fix(agent-hooks): skip managed hook scripts outside Orca panes

Co-authored-by: Pr1p <zwq19980411@gmail.com>

* test(gemini): drop type assertion in hook command test

---------

Co-authored-by: Pr1p <zwq19980411@gmail.com>
This commit is contained in:
Brennan Benson
2026-11-16 14:52:38 -08:00
committed by GitHub
co-authored by Pr1p
parent 0f0fc6e19b
commit ebb5c64e35
13 changed files with 119 additions and 34 deletions
+7 -2
View File
@@ -54,7 +54,12 @@ function getManagedScriptPath(): string {
function getManagedCommand(scriptPath: string): string {
return process.platform === 'win32'
? wrapWindowsBatchHookCommand(scriptPath)
: wrapPosixHookCommand(scriptPath)
: getPosixManagedCommand(scriptPath)
}
// Command Code scrubs hook env; its script recovers the pane from ancestor processes.
function getPosixManagedCommand(scriptPath: string): string {
return wrapPosixHookCommand(scriptPath, {}, { skipPaneGuard: true })
}
function buildInstalledConfig(
@@ -180,7 +185,7 @@ export class CommandCodeHookService {
}
}
buildInstalledConfig(config, wrapPosixHookCommand(remoteScriptPath), 'command-code-hook.sh')
buildInstalledConfig(config, getPosixManagedCommand(remoteScriptPath), 'command-code-hook.sh')
await writeManagedScriptRemote(sftp, remoteScriptPath, buildCommandCodeManagedScript('posix'))
await writeHooksJsonRemote(sftp, remoteConfigPath, config)