From ffdb53c645c9ec13fbe9cebd03df39965406f76e Mon Sep 17 00:00:00 2001 From: Jeffery Date: Wed, 24 Jun 2026 14:13:10 +0000 Subject: [PATCH] =?UTF-8?q?test(entrypoint):=20=E8=A6=86=E8=93=8B=20Codex?= =?UTF-8?q?=20transcript=20=E9=87=8D=E8=A4=87=E8=BC=B8=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/entrypoint_test.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/entrypoint_test.sh b/tests/entrypoint_test.sh index 85983cd..97155ee 100755 --- a/tests/entrypoint_test.sh +++ b/tests/entrypoint_test.sh @@ -56,6 +56,26 @@ SH chmod +x "$dir/codex" } +make_fake_transcript_codex() { + local dir="$1" + + cat > "$dir/codex" <<'SH' +#!/bin/sh +last_message_file="" +while [ "$#" -gt 0 ]; do + if [ "$1" = "--output-last-message" ]; then + shift + last_message_file="$1" + fi + shift +done + +printf '%s\n' 'codex' 'final answer' 'tokens used' '123' 'final answer' +printf '%s\n' 'final answer' > "$last_message_file" +SH + chmod +x "$dir/codex" +} + encoded_json() { printf '%s' "$1" | base64 | tr -d '\n' } @@ -269,6 +289,20 @@ test_codex_output_truncation() { rm -rf "$tmpdir" } +test_last_message_output_without_transcript_duplicate() { + local tmpdir + tmpdir="$(mktemp -d)" + make_fake_transcript_codex "$tmpdir" + + run_entrypoint "$tmpdir" OAUTH="$(encoded_json '{}')" MODEL="gpt-test" PROMPT="hello" + + [[ "$(grep -c "final answer" "$tmpdir/stdout")" -eq 1 ]] || die "stdout printed final answer more than once" + grep -q "status=completed" "$tmpdir/github-output" || die "last message completed status" + [[ "$(grep -c "final answer" "$tmpdir/github-output")" -eq 1 ]] || die "github output included transcript duplicate" + ! grep -q "tokens used" "$tmpdir/github-output" || die "github output included codex transcript" + rm -rf "$tmpdir" +} + test_invalid_execution_config_uses_defaults() { local tmpdir tmpdir="$(mktemp -d)" @@ -299,6 +333,7 @@ test_missing_codex_command_output test_codex_timeout_output test_codex_signal_output test_codex_output_truncation +test_last_message_output_without_transcript_duplicate test_invalid_execution_config_uses_defaults echo "entrypoint tests passed"