Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/claude/hooks/claude-hook-decision-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export function buildPosixClaudeDecisionModeLines(): string[] {
/** Captures the post's reply; a failed curl's partial body is dropped, spooled and answered `{}`. */
export function wrapPosixClaudeDecisionPost(postLines: readonly string[]): string[] {
return [
// An event that asked for no decision discards the reply, so it skips the capture subshell.
'if [ -z "$orca_hook_decides" ]; then',
...postLines.map((line, index) =>
index === postLines.length - 1 ? `${line} >/dev/null 2>&1 || spool_hook_event` : line
),
' exit 0',
'fi',
...postLines.map((line, index) =>
index === 0
? `orca_hook_reply=$(${line}`
Expand Down
6 changes: 4 additions & 2 deletions src/main/codex/hooks/definitions/codex-hook-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { buildHookTmuxPaneCapture } from '../../../agent-hooks/installation/scri
import {
buildPosixHookPayloadCapture,
buildPosixHookSpoolLines,
buildWindowsHookEnvironmentGuardLines
buildWindowsHookEnvironmentGuardLines,
POSIX_HOOK_STDIN_EXEC
} from '../../../agent-hooks/installation/scripts/hook-stdin-contract'
import { buildWindowsAgentHookCurlPostCommand } from '../../../agent-hooks/installation/commands/windows-agent-hook-post-command'

Expand All @@ -28,7 +29,8 @@ export function getManagedScript(target: 'local' | 'posix' = 'local'): string {

return [
'#!/bin/sh',
...buildPosixHookPayloadCapture(),
// Same bytes as the default reader; the capture subshell execs cat instead of forking it.
...buildPosixHookPayloadCapture('exit', POSIX_HOOK_STDIN_EXEC),
...buildHookTmuxPaneCapture(),
...buildPosixHookSpoolLines('codex'),
...buildPosixClaudeBackgroundJobGuardLines(),
Expand Down
Loading