From 58e66f703eb51a763f7a4e475abf1f3ea48b27c9 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sun, 5 Jul 2026 21:20:55 +0900 Subject: [PATCH] fix(review): cycle to next model when a model's output fails publish validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The model pool ran opencode_review_normalize_output.py on the raw candidate output, but the publish step ANSI-strips the output before running the same normalizer. A model (e.g. deepseek-v3) whose raw output passed but whose ANSI-stripped form failed was recorded as the pool's "success", so the pool stopped instead of trying the next model — and the publish step then failed the whole review with "Selected successful OpenCode output did not include a valid control conclusion" (observed after models were reordered by quota). Strip terminal escapes in normalize_opencode_output before validating, matching the publish step exactly, so the pool only records success for output the publish step will accept and otherwise falls through to the next model. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01RTAMs4bpSZS77Xe3RQjv9P --- scripts/ci/run_opencode_review_model_pool.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/ci/run_opencode_review_model_pool.sh b/scripts/ci/run_opencode_review_model_pool.sh index 87d9da1..120c955 100644 --- a/scripts/ci/run_opencode_review_model_pool.sh +++ b/scripts/ci/run_opencode_review_model_pool.sh @@ -14,6 +14,20 @@ record_review_model() { normalize_opencode_output() { local output_file="$1" + # Strip terminal escape sequences in place first, so the pool validates the + # exact bytes the publish step re-validates (it ANSI-strips with the same + # regex before running the normalizer). Without this the pool could accept a + # model whose raw output passes but whose ANSI-stripped form the publish step + # rejects, ending the run in failure instead of falling through to the next + # model in the pool. + local stripped + stripped="$(mktemp)" + if perl -pe 's/\x1b\[[0-9;?]*[A-Za-z]//g' "$output_file" >"$stripped" 2>/dev/null; then + mv "$stripped" "$output_file" + else + rm -f "$stripped" + fi + if python3 "$GITHUB_WORKSPACE/scripts/ci/opencode_review_normalize_output.py" \ "$HEAD_SHA" "$RUN_ID" "$RUN_ATTEMPT" "$output_file"; then bash "$GITHUB_WORKSPACE/scripts/ci/opencode_review_approve_gate.sh" \