fix(agent-hooks): hydrate PATH for paired clients

This commit is contained in:
Brennan Benson
2026-07-29 19:03:45 -07:00
parent a64cf4ca96
commit 9254946b3e
2 changed files with 9 additions and 3 deletions
+7 -2
View File
@@ -180,7 +180,7 @@ const electronMocks = vi.hoisted(() => {
BrowserWindow: { fromId: vi.fn((_id: number): unknown => null) },
webContents: { fromId: vi.fn((_id: number): unknown => null) },
ipcMain,
app: { getPath: vi.fn(() => '/tmp') }
app: { getPath: vi.fn(() => '/tmp'), isPackaged: false }
}
})
@@ -621,6 +621,7 @@ vi.mock('../git/git-username', async () => {
function resetRuntimeTestMocks(): void {
resetPlatform()
electronMocks.app.isPackaged = false
clearConfiguredWorktreeSharedDirectoriesCacheForTests()
_resetTerminalViewAttributesForTest()
advertisedUrlWatcher.clear()
@@ -1719,6 +1720,7 @@ describe('OrcaRuntimeService', () => {
})
it('reconciles hooks only when paired-client hook settings change', async () => {
electronMocks.app.isPackaged = true
let settings = {
...store.getSettings(),
agentStatusHooksEnabled: true,
@@ -1742,7 +1744,10 @@ describe('OrcaRuntimeService', () => {
expect(applyAgentStatusHooksEnabledMock).toHaveBeenCalledWith(
true,
expect.objectContaining({ disabledTuiAgents: ['claude'] }),
expect.objectContaining({ shouldContinue: expect.any(Function) })
expect.objectContaining({
shouldContinue: expect.any(Function),
shouldHydrateShellPath: process.platform !== 'win32'
})
)
})
+2 -1
View File
@@ -534,7 +534,7 @@ import {
} from '../../shared/claude-agent-teams-tmux-compat'
import { joinWorktreeRelativePath } from './runtime-relative-paths'
import { collectMemorySnapshot } from '../memory/collector'
import { BrowserWindow, ipcMain, Notification } from 'electron'
import { app, BrowserWindow, ipcMain, Notification } from 'electron'
import type { AgentBrowserBridge } from '../browser/agent-browser-bridge'
import type { BrowserBackend } from '../browser/browser-backend'
import { BrowserError } from '../browser/cdp-bridge'
@@ -3335,6 +3335,7 @@ export class OrcaRuntimeService {
return
}
await applyAgentStatusHooksEnabled(settings.agentStatusHooksEnabled !== false, settings, {
shouldHydrateShellPath: app.isPackaged && process.platform !== 'win32',
onInstallError: recordManagedHookInstallFailure,
shouldContinue: (agent) => {
const current = this.store?.getSettings()