]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEV: patchbot: produce a verdict for too long commit messages
authorWilly Tarreau <w@1wt.eu>
Tue, 9 Jan 2024 13:44:08 +0000 (14:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Jan 2024 13:46:04 +0000 (14:46 +0100)
Some rare commit messages area really too large because they contain
code excerpts in the message body or are release commits with their
changelog. In this case, instead of leaving an empty file that will
be silently ignored, let's produce an output message indicating that
the verdict is uncertain, with an explanation stating that there was
an error.

dev/patchbot/scripts/process-patch-v15.sh

index 9b2eaa493fbea910e3bd6a0f5d122c2a36fa4a33..e9f718ab1d3298984400efde316344d344065e2a 100755 (executable)
@@ -51,6 +51,13 @@ fi
 
 if [ -z "$INTERACTIVE" ]; then
         LANG=C "$MAINPROG" --log-disable --model "$MODEL" --threads "$CPU" --ctx_size 4096 --temp 0.36 --top_k 12 --top_p 1 --repeat_last_n 256 --batch_size 16384 --repeat_penalty 1.1 --n_predict 200 --multiline-input --prompt "$PROMPT" --prompt-cache "$CACHE" $CACHE_RO "$@" 2>&1 | grep -v ^llama_model_loader | grep -v ^llm_load_ > "${OUTPUT}"
+       if [ "$?" != 0 ]; then
+               # failed: this is likely because the text is too long
+               (echo "$PROMPT"; echo
+                echo "Explanation: the commit message was way too long, couldn't analyse it."
+                echo "Conclusion: uncertain"
+                echo) > "${OUTPUT}"
+       fi
 else
         LANG=C "$MAINPROG" --log-disable --model "$MODEL" --threads "$CPU" --ctx_size 4096 --temp 0.36 --repeat_penalty 1.1 --n_predict 200 --multiline-input --prompt "$PROMPT" --prompt-cache "$CACHE" $CACHE_RO -n -1 -i --color --in-prefix ' ' --reverse-prompt "$INTERACTIVE:" "$@"
 fi