fix: pass codex flags through in the stdin-prompt branch
Follow-up to the previous fix: the stdin branch dropped "$@", so options like -s read-only silently never reached codex. Stub now records argv and tests assert flags + stdin prompt arrive together; verified live (-s read-only => codex reports READONLY).
This commit is contained in:
1 parent
32aaaa9b7a
commit
0cfec6880c
3 files changed
+5
-5
No files matched your search
@@ -38,7 +38,7 @@ esac
|
|||||||
rm -f "$JOB_DIR/status" "$LAST"; : > "$EV"; : > "$ERR"
|
rm -f "$JOB_DIR/status" "$LAST"; : > "$EV"; : > "$ERR"
|
||||||
|
|
||||||
if [[ -s $JOB_DIR/prompt.md ]]; then
|
if [[ -s $JOB_DIR/prompt.md ]]; then
|
||||||
"${CMD[@]}" - < "$JOB_DIR/prompt.md" > "$EV" 2> "$ERR" &
|
"${CMD[@]}" "$@" - < "$JOB_DIR/prompt.md" > "$EV" 2> "$ERR" &
|
||||||
else
|
else
|
||||||
"${CMD[@]}" "$@" < /dev/null > "$EV" 2> "$ERR" &
|
"${CMD[@]}" "$@" < /dev/null > "$EV" 2> "$ERR" &
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -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":"thread.started","thread_id":"test-thread-123"}'
|
||||||
echo '{"type":"turn.completed"}'
|
echo '{"type":"turn.completed"}'
|
||||||
stdin_content=$(cat)
|
stdin_content=$(cat)
|
||||||
echo "stub answer|$stdin_content" > "$out"
|
echo "stub answer|args=$*|$stdin_content" > "$out"
|
||||||
exit 0
|
exit 0
|
||||||
+3
-3
@@ -9,7 +9,7 @@ trap 'rm -rf "$TMP"' EXIT
|
|||||||
CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/ok" exec "hello"
|
CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/ok" exec "hello"
|
||||||
[[ $(cat "$TMP/ok/status") == ok ]]
|
[[ $(cat "$TMP/ok/status") == ok ]]
|
||||||
[[ $(cat "$TMP/ok/thread_id") == test-thread-123 ]]
|
[[ $(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
|
# 2. stall -> watchdog kills, status stalled, exit nonzero
|
||||||
if CODEX_BIN=$HERE/stub-hang/codex CODEX_STALL_TIMEOUT=4 CODEX_WATCH_INTERVAL=2 \
|
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"
|
mkdir -p "$TMP/stdin"; echo "prompt from file" > "$TMP/stdin/prompt.md"
|
||||||
CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/stdin" exec
|
CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/stdin" exec
|
||||||
[[ $(cat "$TMP/stdin/status") == ok ]]
|
[[ $(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)
|
# 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"
|
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
|
CODEX_BIN=$HERE/stub-ok/codex "$RUN" "$TMP/flags" exec -s read-only
|
||||||
[[ $(cat "$TMP/flags/status") == ok ]]
|
[[ $(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"
|
echo "ALL PASS"
|
||||||
Reference in new issue
Block a user