diff --git a/scripts/codex-run.sh b/scripts/codex-run.sh index 10278b2..00db3ac 100755 --- a/scripts/codex-run.sh +++ b/scripts/codex-run.sh @@ -38,7 +38,7 @@ esac rm -f "$JOB_DIR/status" "$LAST"; : > "$EV"; : > "$ERR" if [[ -s $JOB_DIR/prompt.md ]]; then - "${CMD[@]}" - < "$JOB_DIR/prompt.md" > "$EV" 2> "$ERR" & + "${CMD[@]}" "$@" - < "$JOB_DIR/prompt.md" > "$EV" 2> "$ERR" & else "${CMD[@]}" "$@" < /dev/null > "$EV" 2> "$ERR" & fi diff --git a/tests/stub-ok/codex b/tests/stub-ok/codex index f81e035..8d82160 100755 --- a/tests/stub-ok/codex +++ b/tests/stub-ok/codex @@ -6,5 +6,5 @@ for a in "$@"; do [[ $prev == "-o" ]] && out=$a; prev=$a; done echo '{"type":"thread.started","thread_id":"test-thread-123"}' echo '{"type":"turn.completed"}' stdin_content=$(cat) -echo "stub answer|$stdin_content" > "$out" +echo "stub answer|args=$*|$stdin_content" > "$out" exit 0 diff --git a/tests/test-run.sh b/tests/test-run.sh index 47fdc84..5d86dbc 100755 --- a/tests/test-run.sh +++ b/tests/test-run.sh @@ -9,7 +9,7 @@ trap 'rm -rf "$TMP"' EXIT CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/ok" exec "hello" [[ $(cat "$TMP/ok/status") == ok ]] [[ $(cat "$TMP/ok/thread_id") == test-thread-123 ]] -[[ $(cat "$TMP/ok/last.md") == "stub answer|" ]] +[[ $(cat "$TMP/ok/last.md") == "stub answer|args="*"hello|" ]] # 2. stall -> watchdog kills, status stalled, exit nonzero if CODEX_BIN=$HERE/stub-hang/codex CODEX_STALL_TIMEOUT=4 CODEX_WATCH_INTERVAL=2 \ @@ -23,12 +23,12 @@ fi mkdir -p "$TMP/stdin"; echo "prompt from file" > "$TMP/stdin/prompt.md" CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/stdin" exec [[ $(cat "$TMP/stdin/status") == ok ]] -[[ $(cat "$TMP/stdin/last.md") == "stub answer|prompt from file" ]] +[[ $(cat "$TMP/stdin/last.md") == "stub answer|args="*" -|prompt from file" ]] # 4. prompt.md + codex flags -> stdin still delivered (regression: options ate the prompt) mkdir -p "$TMP/flags"; echo "prompt with flags" > "$TMP/flags/prompt.md" CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/flags" exec -s read-only [[ $(cat "$TMP/flags/status") == ok ]] -[[ $(cat "$TMP/flags/last.md") == "stub answer|prompt with flags" ]] +[[ $(cat "$TMP/flags/last.md") == "stub answer|args="*"-s read-only -|prompt with flags" ]] echo "ALL PASS"