no-mistakes(review): fix duplicate-000 probe capture at assignment boundary
This commit is contained in:
@@ -41,7 +41,9 @@ notify() {
|
|||||||
# ── Global: Zulip Server ──
|
# ── Global: Zulip Server ──
|
||||||
SERVER_CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 \
|
SERVER_CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 \
|
||||||
https://chat.sysloggh.net/api/v1/server_settings \
|
https://chat.sysloggh.net/api/v1/server_settings \
|
||||||
-u 'abiba-bot@chat.sysloggh.net:cKTDMZAPW08dk3zl05sStzO7HRztzyn8' 2>/dev/null || echo "000")
|
-u 'abiba-bot@chat.sysloggh.net:cKTDMZAPW08dk3zl05sStzO7HRztzyn8' 2>/dev/null) || SERVER_CODE="000"
|
||||||
|
SERVER_CODE=$(printf '%s' "$SERVER_CODE" | tr -d '[:space:]')
|
||||||
|
[ -n "$SERVER_CODE" ] || SERVER_CODE="000"
|
||||||
if [ "$SERVER_CODE" != "200" ]; then
|
if [ "$SERVER_CODE" != "200" ]; then
|
||||||
notify "🔴" "Zulip server returned HTTP $SERVER_CODE"
|
notify "🔴" "Zulip server returned HTTP $SERVER_CODE"
|
||||||
ISSUES=$((ISSUES + 1))
|
ISSUES=$((ISSUES + 1))
|
||||||
@@ -59,7 +61,9 @@ fi
|
|||||||
# zulip.connected is a PROBE FAILURE: it alerts and NEVER calls pm2 restart.
|
# zulip.connected is a PROBE FAILURE: it alerts and NEVER calls pm2 restart.
|
||||||
# pm2 restart runs ONLY on affirmative zulip.connected=false.
|
# pm2 restart runs ONLY on affirmative zulip.connected=false.
|
||||||
# -- abiba-leg-start (verbatim-extracted by tests/zulip-monitor-abiba.sh)
|
# -- abiba-leg-start (verbatim-extracted by tests/zulip-monitor-abiba.sh)
|
||||||
PI_HTTP=$(curl -s -o /dev/null --connect-timeout 5 --max-time 10 -w '%{http_code}' http://localhost:9200/health 2>/dev/null || echo "000")
|
PI_HTTP=$(curl -s -o /dev/null --connect-timeout 5 --max-time 10 -w '%{http_code}' http://localhost:9200/health 2>/dev/null) || PI_HTTP="000"
|
||||||
|
PI_HTTP=$(printf '%s' "$PI_HTTP" | tr -d '[:space:]')
|
||||||
|
[ -n "$PI_HTTP" ] || PI_HTTP="000"
|
||||||
PI_BODY=$(curl -s --connect-timeout 5 --max-time 10 http://localhost:9200/health 2>/dev/null || true)
|
PI_BODY=$(curl -s --connect-timeout 5 --max-time 10 http://localhost:9200/health 2>/dev/null || true)
|
||||||
PI_STATE=$(printf '%s' "$PI_BODY" | python3 -c '
|
PI_STATE=$(printf '%s' "$PI_BODY" | python3 -c '
|
||||||
import sys, json
|
import sys, json
|
||||||
@@ -156,7 +160,9 @@ fi
|
|||||||
|
|
||||||
# ── Platform C: Agent Zero (kagentz) ──
|
# ── Platform C: Agent Zero (kagentz) ──
|
||||||
AZ_A2A_CODE=$(ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@192.168.68.14 \
|
AZ_A2A_CODE=$(ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@192.168.68.14 \
|
||||||
"docker exec agent-zero curl -s --connect-timeout 5 -o /dev/null -w '%{http_code}' http://127.0.0.1:80/a2a/ 2>/dev/null" 2>/dev/null || echo "000")
|
"docker exec agent-zero curl -s --connect-timeout 5 -o /dev/null -w '%{http_code}' http://127.0.0.1:80/a2a/ 2>/dev/null" 2>/dev/null) || AZ_A2A_CODE="000"
|
||||||
|
AZ_A2A_CODE=$(printf '%s' "$AZ_A2A_CODE" | tr -d '[:space:]')
|
||||||
|
[ -n "$AZ_A2A_CODE" ] || AZ_A2A_CODE="000"
|
||||||
|
|
||||||
if [ "$AZ_A2A_CODE" = "000" ]; then
|
if [ "$AZ_A2A_CODE" = "000" ]; then
|
||||||
notify "🔴" "kagentz A2A server DOWN (connection failed)"
|
notify "🔴" "kagentz A2A server DOWN (connection failed)"
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ case "$host" in
|
|||||||
esac ;;
|
esac ;;
|
||||||
192.168.68.14)
|
192.168.68.14)
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
*"/a2a/"*) printf '%s' "$AZ_A2A_CODE" ;;
|
*"/a2a/"*) printf '%s' "$AZ_A2A_CODE"; exit "$AZ_A2A_EXIT" ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
*)
|
*)
|
||||||
printf 'UNEXPECTED-SSH-HOST %s\n' "$host" >> "$RECORD_DIR/unexpected-ssh" ;;
|
printf 'UNEXPECTED-SSH-HOST %s\n' "$host" >> "$RECORD_DIR/unexpected-ssh" ;;
|
||||||
@@ -121,7 +121,7 @@ def _write_exec(path: pathlib.Path, body: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def _run_monitor(tmp_path, *, tanko_svc="active", tanko_http="200",
|
def _run_monitor(tmp_path, *, tanko_svc="active", tanko_http="200",
|
||||||
az_a2a_code="401"):
|
az_a2a_code="401", az_a2a_exit=0):
|
||||||
"""Run the shipped monitor in a sandbox; return (proc, record_dir, log_path).
|
"""Run the shipped monitor in a sandbox; return (proc, record_dir, log_path).
|
||||||
|
|
||||||
Only the LOG constant is rewritten (to keep the run inside the worktree).
|
Only the LOG constant is rewritten (to keep the run inside the worktree).
|
||||||
@@ -150,6 +150,7 @@ def _run_monitor(tmp_path, *, tanko_svc="active", tanko_http="200",
|
|||||||
"TANKO_SVC": tanko_svc,
|
"TANKO_SVC": tanko_svc,
|
||||||
"TANKO_HTTP": tanko_http,
|
"TANKO_HTTP": tanko_http,
|
||||||
"AZ_A2A_CODE": az_a2a_code,
|
"AZ_A2A_CODE": az_a2a_code,
|
||||||
|
"AZ_A2A_EXIT": str(az_a2a_exit),
|
||||||
"PI_HTTP": "200",
|
"PI_HTTP": "200",
|
||||||
"PI_BODY": CONNECTED_FIXTURE.read_text(),
|
"PI_BODY": CONNECTED_FIXTURE.read_text(),
|
||||||
"SERVER_HTTP": "200",
|
"SERVER_HTTP": "200",
|
||||||
@@ -221,6 +222,21 @@ def test_unexpected_a2a_status_is_an_issue_not_healthy(tmp_path):
|
|||||||
assert "kagentz A2A server answered HTTP 500" in proc.stdout
|
assert "kagentz A2A server answered HTTP 500" in proc.stdout
|
||||||
|
|
||||||
|
|
||||||
|
def test_a2a_connection_failure_is_down_not_unexpected(tmp_path):
|
||||||
|
# curl prints the http_code before failing, so the ssh stub exits non-zero
|
||||||
|
# with "000" on stdout — exercising the real outage path.
|
||||||
|
proc, record, log_path = _run_monitor(tmp_path, az_a2a_code="000",
|
||||||
|
az_a2a_exit=7)
|
||||||
|
assert proc.returncode == 0, proc.stderr
|
||||||
|
log = log_path.read_text()
|
||||||
|
|
||||||
|
assert "kagentz: ❌ A2A down (HTTP 000)" in log
|
||||||
|
assert "kagentz: ✅ A2A alive" not in log
|
||||||
|
assert "unexpected" not in log
|
||||||
|
assert "Result: 🔴 1 issue(s) found" in log
|
||||||
|
assert "kagentz A2A server DOWN (connection failed)" in proc.stdout
|
||||||
|
|
||||||
|
|
||||||
# ── scripts/daily-infra-report.py: behavioral digest checks ──────────
|
# ── scripts/daily-infra-report.py: behavioral digest checks ──────────
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
|
|||||||
Reference in New Issue
Block a user