Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(e2e): kill the SIGPIPE/pipefail false-green in HCC pass-marker probes [R3-H3]

Alfredo Lopez680029ecd628
diff --git a/scripts/e2e/e2e-host-storm-gate.sh b/scripts/e2e/e2e-host-storm-gate.sh
index f001f8ae1..b1899559a 100755
--- a/scripts/e2e/e2e-host-storm-gate.sh
+++ b/scripts/e2e/e2e-host-storm-gate.sh
@@ -1062,11 +1062,11 @@ _replacement_fleet_completed_probe() {
[[ -n "$current_pod" && "$current_pod" == "$HCC_POD_C" ]] || return 1
logs="$(kctl -n "$CONTROL_NS" logs "pod/${HCC_POD_C}" \
-c host-context-controller 2>/dev/null)" || return 1
- if printf '%s\n' "$logs" | grep -Fq "$HCC_PASS_FAILED_MARKER"; then
+ if grep -Fq -- "$HCC_PASS_FAILED_MARKER" <<<"$logs"; then
replacement_fleet_state='failed'
return 0
fi
- if printf '%s\n' "$logs" | grep -Fq "$HCC_PASS_COMPLETED_MARKER"; then
+ if grep -Fq -- "$HCC_PASS_COMPLETED_MARKER" <<<"$logs"; then
replacement_fleet_state='completed'
return 0
fi
diff --git a/scripts/e2e/measure-host-bundle-reconcile.sh b/scripts/e2e/measure-host-bundle-reconcile.sh
index 175a15af8..c1f7ee5a7 100755
--- a/scripts/e2e/measure-host-bundle-reconcile.sh
+++ b/scripts/e2e/measure-host-bundle-reconcile.sh
@@ -965,9 +965,9 @@ phase_delete_during_pass() {
_delpass_pass_active_probe() {
local logs
logs="$(kctl -n "$CONTROL_NS" logs "pod/${new_pod}" 2>/dev/null || true)"
- if printf '%s' "$logs" | grep -Fq "$HCC_PASS_FAILED_MARKER"; then pass_state='failed'; return 0; fi
- if printf '%s' "$logs" | grep -Fq "$HCC_PASS_COMPLETED_MARKER"; then pass_state='completed'; return 0; fi
- if printf '%s' "$logs" | grep -Fq "$HCC_PASS_STARTED_MARKER"; then pass_state='active'; return 0; fi
+ if grep -Fq -- "$HCC_PASS_FAILED_MARKER" <<<"$logs"; then pass_state='failed'; return 0; fi
+ if grep -Fq -- "$HCC_PASS_COMPLETED_MARKER" <<<"$logs"; then pass_state='completed'; return 0; fi
+ if grep -Fq -- "$HCC_PASS_STARTED_MARKER" <<<"$logs"; then pass_state='active'; return 0; fi
return 1
}
# shellcheck disable=SC2329 # invoked by name via wait_until
@@ -1016,7 +1016,7 @@ phase_delete_during_pass() {
fail "delete-during-pass: could not re-read HCC logs immediately after the delete — overlap cannot be verified (fail-closed)"
return 1
fi
- if printf '%s' "$post_delete_logs" | grep -Fq "$HCC_PASS_COMPLETED_MARKER"; then
+ if grep -Fq -- "$HCC_PASS_COMPLETED_MARKER" <<<"$post_delete_logs"; then
fail "delete-during-pass: pass logged COMPLETED within the probe->delete window — overlap NOT established; re-run"
return 1
fi
@@ -1028,8 +1028,8 @@ phase_delete_during_pass() {
_delpass_pass_completed_probe() {
local logs
logs="$(kctl -n "$CONTROL_NS" logs "pod/${new_pod}" 2>/dev/null || true)"
- if printf '%s' "$logs" | grep -Fq "$HCC_PASS_FAILED_MARKER"; then pass_state='failed'; return 0; fi
- printf '%s' "$logs" | grep -Fq "$HCC_PASS_COMPLETED_MARKER" && pass_state='completed'
+ if grep -Fq -- "$HCC_PASS_FAILED_MARKER" <<<"$logs"; then pass_state='failed'; return 0; fi
+ grep -Fq -- "$HCC_PASS_COMPLETED_MARKER" <<<"$logs" && pass_state='completed'
}
if ! wait_until "$DELPASS_PASS_COMPLETE_DEADLINE_S" 2 "initial full pass completion after the delete" \
_delpass_pass_completed_probe _delpass_logs_diag; then
diff --git a/scripts/tests/test-hcc-watch-recovery-gate.sh b/scripts/tests/test-hcc-watch-recovery-gate.sh
index 8bc7d7a63..b0e668f8a 100755
--- a/scripts/tests/test-hcc-watch-recovery-gate.sh
+++ b/scripts/tests/test-hcc-watch-recovery-gate.sh
@@ -1649,4 +1649,54 @@ else
fail "cleanup can still print a false all-passed summary"
fi
+# --- H3: SIGPIPE/pipefail sweep on HCC pass-marker log probes -------------
+# A `printf '%s[\n]' "$logs" | grep -Fq "$..._MARKER"` probe is a false-green
+# trap: on a large log with the marker near the top, `grep -Fq` exits early,
+# `printf` takes SIGPIPE, and under `set -o pipefail` the whole pipeline reports
+# failure — so a PRESENT marker reads as MISSING (deterministic 3/3 repro in the
+# round-2 storm gate). The safe idiom is a here-string: no producer to signal.
+# grep -Fq -- "$MARKER" <<<"$logs"
+#
+# Scope: HCC pass-marker gates only (storm + measure). Explicitly OUT OF SCOPE
+# (tracked separately — a different failure class, or a non-HCC gate outside
+# this PR's blast radius):
+# - e2e-gke-secrets.sh:291-294 grep -oE|wc leak COUNT: reads the whole log,
+# no early-exit, so it is NOT the SIGPIPE class.
+# - e2e-plugin-workload-sdk.sh SDK markers (non-HCC).
+# - e2e-lib.sh / e2e-prod-lib.sh / e2e-channel-reader-per-host.sh (non-HCC).
+HCC_STORM_GATE="${SCRIPT_DIR}/e2e-host-storm-gate.sh"
+# shellcheck disable=SC2016
+sigpipe_offenders="$(
+ grep -nE 'printf[^|]*\| *grep -Fq[^<]*_MARKER' \
+ "$HCC_STORM_GATE" "$HOST_BUNDLE_MEASURE" 2>/dev/null || true
+)"
+if [ -z "$sigpipe_offenders" ]; then
+ pass "HCC pass-marker probes use here-strings, not pipefail/SIGPIPE pipes"
+else
+ fail "HCC pass-marker probe reintroduced a printf|grep -Fq SIGPIPE path:
+${sigpipe_offenders}"
+fi
+
+# Corroborating repro of the mechanism the sweep guards against. The here-string
+# form MUST find a marker on line 1 of a 1.6 MB log (hard invariant). The pipe
+# form is expected to miss it under pipefail (SIGPIPE) — that miss is the bug,
+# demonstrated, not a standing assertion, so a platform that does not reproduce
+# it is not a suite failure: the static sweep above is the real enforcement.
+h3_marker='HCC_PASS_COMPLETED: h3 repro sentinel'
+h3_bulk="$(yes 'xxxxxxxxxxxxxxxx' | head -c 1600000)"
+h3_log="${h3_marker}
+${h3_bulk}"
+if grep -Fq -- "$h3_marker" <<<"$h3_log"; then
+ pass "here-string probe finds a marker on line 1 of a 1.6 MB log"
+else
+ fail "here-string probe MISSED a present marker on a large log (regression)"
+fi
+h3_pipe_found=0
+( set -o pipefail; printf '%s\n' "$h3_log" | grep -Fq -- "$h3_marker" ) && h3_pipe_found=1
+if [ "$h3_pipe_found" -eq 0 ]; then
+ pass "pipe+pipefail probe misses the same marker (SIGPIPE repro confirmed)"
+else
+ pass "pipe probe did not SIGPIPE on this platform; static sweep still enforces the idiom"
+fi
+
exit "$FAIL"