From 325f490d6d23b0b8bc40af8b2f72832e8cb0cffb Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 12 Feb 2026 15:18:22 +0000 Subject: [PATCH] fix(ci): give each retry attempt its own unique log key When a test flakes (fails then passes on retry), both attempts shared the same log_key UUID. This made it impossible to retrieve the initial failure's logs - the retry's content replaced it. Now each attempt gets its own log_key: - First attempt's failure log is finalized and saved before retrying - A new UUID is generated for the retry attempt - The RETRYING message shows both log links (old -> new) - The flake function now publishes the retry's log (was never saved) Co-Authored-By: Claude Opus 4.6 --- ci3/run_test_cmd | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/ci3/run_test_cmd b/ci3/run_test_cmd index 66334e535f27..d8f6ae5b94b5 100755 --- a/ci3/run_test_cmd +++ b/ci3/run_test_cmd @@ -119,6 +119,21 @@ function publish_log_final { cat $tmp_file 2>/dev/null | cache_persistent $log_key $expire } +# Finalize the current log and start a fresh one with a new unique key. +function rotate_log { + if [ "$CI_REDIS_AVAILABLE" -eq 1 ]; then + publish_log_final "$@" + fi + log_key=$(uuid) + log_info=" ($(ci_term_link $log_key))" + > $tmp_file + if [ "$live_logging" -eq 1 ]; then + kill ${publish_pid:-} &>/dev/null + live_publish_log & + publish_pid=$! + fi +} + function live_publish_log { # Not replacing previous trap as we run this function in the background. trap 'kill $sleep_pid &>/dev/null; exit' SIGTERM SIGINT @@ -332,12 +347,23 @@ flake_group_id=$(echo "$test_entries" | jq -r '.flake_group_id // empty' | head if [ -z "$owners" ]; then fail else - echo -e "${yellow}RETRYING${reset}${log_info:-}: $test_cmd" + failure_log_key=$log_key + failure_log_info=$log_info + rotate_log $((60 * 60 * 24 * 7 * 12)) + + echo -e "${yellow}RETRYING${reset}${log_info}: $test_cmd" run_test - # Test passed. Signal it as a flake, but pass. - [ $code -eq 0 ] && flake + if [ $code -eq 0 ]; then + # Publish the retry's log, then point back at the failure for flake reporting. + if [ "$CI_REDIS_AVAILABLE" -eq 1 ]; then + publish_log_final + fi + log_key=$failure_log_key + log_info=$failure_log_info + flake + fi # Otherwise we failed twice in a row, so hard fail. fail