mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 15:08:38 +01:00
run-codex-task.sh passed --ask-for-approval which only exists on the interactive codex CLI, not codex exec — causing immediate failure on every switch. Also both runner scripts computed ROOT=parent-of-scripts-dir which resolves to ~/.local/share when installed, making the stop-hook call (agent-hook-bridge.sh) silently fail every run. Fixed to use SCRIPT_DIR (same directory as the runners) which works both in the repo and from the installed ~/.local/share/cockpit-beacon/ location. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
38 lines
859 B
Bash
Executable File
38 lines
859 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -lt 3 ]; then
|
|
echo "usage: run-codex-task.sh <tab> <project-dir> <prompt-file> [model]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
TAB_NAME="$1"
|
|
PROJECT_DIR="$2"
|
|
PROMPT_FILE="$3"
|
|
MODEL="${4:-gpt-5.4}" # must match AGENT_DEFAULT_MODELS.codex in src/lib/agent-registry.ts
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
SESSION_DIR="${AGENT_SESSIONS_DIR:-$HOME/.claude/sessions}"
|
|
|
|
mkdir -p "$SESSION_DIR"
|
|
|
|
source "$HOME/.bashrc" >/dev/null 2>&1 || true
|
|
|
|
cd "$PROJECT_DIR"
|
|
|
|
status=0
|
|
codex exec \
|
|
--model "$MODEL" \
|
|
--cd "$PROJECT_DIR" \
|
|
--sandbox workspace-write \
|
|
--add-dir "$SESSION_DIR" \
|
|
- < "$PROMPT_FILE" || status=$?
|
|
|
|
rm -f "$PROMPT_FILE"
|
|
|
|
printf '%s' "$PROJECT_DIR" \
|
|
| jq -Rs '{cwd:.}' \
|
|
| AGENT_TAB_NAME="$TAB_NAME" AGENT_CURRENT_AGENT="codex" "$SCRIPT_DIR/agent-hook-bridge.sh" stop || true
|
|
|
|
exit "$status"
|