From c43c61578bd332f3e2a5034da25cb2f09cc55840 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 22 Jul 2026 23:04:55 +0800 Subject: [PATCH] fix(signoz): normalize zero active-operation readback --- agent99-signoz-metadata-executor.ps1 | 10 ++++++---- ...nt99_signoz_metadata_executor_runtime_entrypoint.py | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/agent99-signoz-metadata-executor.ps1 b/agent99-signoz-metadata-executor.ps1 index 37878233f..d0bce0e9c 100644 --- a/agent99-signoz-metadata-executor.ps1 +++ b/agent99-signoz-metadata-executor.ps1 @@ -919,11 +919,13 @@ if /usr/bin/docker exec signoz /bin/sh -c 'test "${SIGNOZ_SQLSTORE_SQLITE_PATH:- $active = Invoke-Agent99SignozFixedRemote ( "sudo -n /bin/bash -c 'set -euo pipefail; set +e; " + - "active_output=`$(/usr/bin/pgrep -fc `"([s]ignoz-metadata-export.py.*--apply|[s]ignoz-metadata-isolated-restore.py.*--apply|[s]ignoz-metadata-restore-drill.py.*--apply)`" ); " + + "active_output=`$(/usr/bin/timeout --kill-after=5s 10s /usr/bin/pgrep -af `"([s]ignoz-metadata-export.py.*--apply|[s]ignoz-metadata-isolated-restore.py.*--apply|[s]ignoz-metadata-restore-drill.py.*--apply)`" ); " + "active_rc=`$?; set -e; " + - "[ `"`$active_rc`" -eq 0 ] || [ `"`$active_rc`" -eq 1 ]; " + - "/usr/bin/printf `"%s`" `"`$active_output`" | /usr/bin/grep -Eq `"^[0-9]+$`"; " + - "/usr/bin/printf `"agent99_active:%s`" `"`$active_output`"'" + "case `"`$active_rc`" in " + + "0) active_count=`$(/usr/bin/printf `"%s\n`" `"`$active_output`" | /usr/bin/awk `"NF { count += 1 } END { print count + 0 }`");; " + + "1) [ -z `"`$active_output`" ]; active_count=0;; " + + "*) exit 1;; esac; " + + "/usr/bin/printf `"agent99_active:%s`" `"`$active_count`"'" ) $activeOperationCount = $null $activeOutcomeAccepted = Test-Agent99SignozTransportOutcome $active diff --git a/scripts/ops/tests/test_agent99_signoz_metadata_executor_runtime_entrypoint.py b/scripts/ops/tests/test_agent99_signoz_metadata_executor_runtime_entrypoint.py index 6f34305de..edbc054cc 100644 --- a/scripts/ops/tests/test_agent99_signoz_metadata_executor_runtime_entrypoint.py +++ b/scripts/ops/tests/test_agent99_signoz_metadata_executor_runtime_entrypoint.py @@ -245,7 +245,11 @@ def test_entrypoint_typed_readbacks_are_exact_and_preserve_unknown_state() -> No ) assert '"^agent99_runtime:([0-9a-f]{64}),(sha256:' in preflight assert '"^agent99_active:([0-9]+)$"' in preflight - assert '[ `"`$active_rc`" -eq 0 ] || [ `"`$active_rc`" -eq 1 ]' in preflight + assert "/usr/bin/timeout --kill-after=5s 10s /usr/bin/pgrep -af" in preflight + assert 'case `"`$active_rc`" in' in preflight + assert '/usr/bin/awk `"NF { count += 1 } END { print count + 0 }`"' in preflight + assert '1) [ -z `"`$active_output`" ]; active_count=0' in preflight + assert 'agent99_active:%s`" `"`$active_count' in preflight assert "outputPresent = if ($outputStateReadbackVerified)" in preflight assert "receiptPresent = if ($receiptStateReadbackVerified)" in preflight assert "credentialReferencePresent = if ($credentialReadbackVerified)" in preflight