Skip to content
Open
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: 6 additions & 1 deletion hooks/lib/template-loader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ render_template() {
# Scans for {{VAR}} patterns and replaces them with values from environment
# Replaced content goes directly to output without re-scanning
local awk_exit=0
content=$(env "${env_vars[@]}" awk '
# ${arr[@]+"${arr[@]}"} expands to the quoted elements when the array is
# non-empty and to nothing when it is empty -- required because bash 3.2
# (the macOS default) treats "${empty_array[@]}" as an unbound-variable
# error under `set -u`, which aborts the sourcing hook with a non-zero,
# non-blocking exit and no stderr.
content=$(env ${env_vars[@]+"${env_vars[@]}"} awk '
BEGIN {
# Build lookup table from environment variables with TMPL_VAR_ prefix
for (name in ENVIRON) {
Expand Down
4 changes: 2 additions & 2 deletions hooks/loop-codex-stop-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ Provider: codex
echo "Running codex review with timeout ${CODEX_TIMEOUT}s in $PROJECT_ROOT (base: $review_base)..." >&2

CODEX_REVIEW_EXIT_CODE=0
(cd "$PROJECT_ROOT" && run_with_timeout "$CODEX_TIMEOUT" codex review "${CODEX_DISABLE_HOOKS_ARGS[@]}" --base "$review_base" "${CODEX_REVIEW_ARGS[@]}") \
(cd "$PROJECT_ROOT" && run_with_timeout "$CODEX_TIMEOUT" codex review ${CODEX_DISABLE_HOOKS_ARGS[@]+"${CODEX_DISABLE_HOOKS_ARGS[@]}"} --base "$review_base" "${CODEX_REVIEW_ARGS[@]}") \
> "$CODEX_REVIEW_LOG_FILE" 2>&1 || CODEX_REVIEW_EXIT_CODE=$?

echo "Code review exit code: $CODEX_REVIEW_EXIT_CODE" >&2
Expand Down Expand Up @@ -1692,7 +1692,7 @@ echo "Codex command saved to: $CODEX_CMD_FILE" >&2
echo "Running summary review with timeout ${CODEX_TIMEOUT}s..." >&2

CODEX_EXIT_CODE=0
printf '%s' "$CODEX_PROMPT_CONTENT" | run_with_timeout "$CODEX_TIMEOUT" codex exec "${CODEX_DISABLE_HOOKS_ARGS[@]}" "${CODEX_EXEC_ARGS[@]}" - \
printf '%s' "$CODEX_PROMPT_CONTENT" | run_with_timeout "$CODEX_TIMEOUT" codex exec ${CODEX_DISABLE_HOOKS_ARGS[@]+"${CODEX_DISABLE_HOOKS_ARGS[@]}"} "${CODEX_EXEC_ARGS[@]}" - \
> "$CODEX_STDOUT_FILE" 2> "$CODEX_STDERR_FILE" || CODEX_EXIT_CODE=$?

echo "Codex exit code: $CODEX_EXIT_CODE" >&2
Expand Down