From 1f60fc57608fd6fa1dcb40f6b59d4eea67d15d12 Mon Sep 17 00:00:00 2001 From: Megha Bansal Date: Wed, 3 Dec 2025 15:19:59 +0530 Subject: [PATCH] fix: detect silent failures in gemini-cli by checking for invalid JSON output --- action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9447689ec..c5da030ca 100644 --- a/action.yml +++ b/action.yml @@ -326,8 +326,13 @@ runs: if jq -e . "${TEMP_STDERR}" >/dev/null 2>&1; then ERROR_JSON=$(jq -c '.error // empty' "${TEMP_STDERR}") fi - if ! { jq -e . "${TEMP_STDERR}" >/dev/null 2>&1 && jq -e . "${TEMP_STDOUT}" >/dev/null 2>&1; }; then + if ! jq -e . "${TEMP_STDOUT}" >/dev/null 2>&1; then echo "::warning::Gemini CLI output was not valid JSON" + # If we failed to parse JSON and the command didn't fail, this is likely a silent failure (e.g. resource limit) + if [[ "${FAILED}" == "false" ]]; then + echo "::error title=Gemini CLI execution failed::Gemini CLI produced invalid or empty JSON output, which usually indicates a silent failure." + FAILED=true + fi fi