Skip to content

Commit e03e64e

Browse files
committed
fix(release): strip ANSI before the subscription-log grep
matter-server colourises its logs, so a `\x1b[0m` reset sits between '<Node:N>' and the message. The anchored '<Node:N> (Re-)?Subscription succeeded' pattern never matched, hard-failing check_subscription_log on otherwise-healthy flashes (node 35 v1.1.4: version confirmed, node available + subscribed, gate still errored). Strip ANSI first in both scripts; also bring esp32-release.sh up to the ota-release.sh behaviour (match Re-Subscription, tail -1 the newest, poll for the late resubscribe). Assisted-by: AI
1 parent 10807a8 commit e03e64e

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

firmware/scripts/esp32-release.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,27 @@ check_subscription_log() {
256256
say " PI_HOST/PI_SSH_KEY unset -- cannot read the matter-server log; node availability stands as the subscription assertion (#64)"
257257
return 0
258258
fi
259-
local line
260-
if ! line="$(ssh -o BatchMode=yes -o ConnectTimeout=10 -i "$PI_SSH_KEY" "$PI_HOST" \
261-
"docker logs --since 15m matter-server 2>&1 | grep -m1 '<Node:$node> Subscription succeeded' || true" 2>/dev/null)"; then
262-
say " could not read the matter-server log on $PI_HOST -- node availability stands as the subscription assertion (#64)"
263-
return 0
264-
fi
259+
# After an OTA the device REBOOTS, so the healthy post-flash signal is usually a
260+
# '<Node:N> Re-Subscription succeeded' logged a few seconds after the re-interview, NOT the
261+
# plain 'Subscription succeeded' (that one is the PRE-reboot subscription, often already >15m
262+
# old). matter-server also colourises its logs, so an ESC[..m reset sits between '<Node:N>'
263+
# and the message -- strip ANSI first or the anchored pattern never matches. Both gaps
264+
# false-alarmed an otherwise-healthy node 35 flash on 2026-07-22 (version confirmed, node
265+
# available + subscribed, yet the old single-shot grep found nothing). So: strip ANSI, match
266+
# BOTH forms, take the most RECENT (tail -1), and poll, since the resubscribe can land a few
267+
# seconds after we start looking.
268+
local line=""
269+
for _ in 1 2 3 4 5 6; do
270+
if ! line="$(ssh -o BatchMode=yes -o ConnectTimeout=10 -i "$PI_SSH_KEY" "$PI_HOST" \
271+
"docker logs --since 15m matter-server 2>&1 | sed -E 's/\x1b\[[0-9;]*m//g' | grep -E '<Node:$node> (Re-)?Subscription succeeded' | tail -1 || true" 2>/dev/null)"; then
272+
say " could not read the matter-server log on $PI_HOST -- node availability stands as the subscription assertion (#64)"
273+
return 0
274+
fi
275+
[ -n "$line" ] && break
276+
sleep 10
277+
done
265278
[ -n "$line" ] \
266-
|| die "no 'Subscription succeeded' for node $node in the last 15m of the matter-server log -- subscription is broken (#64, docs/10 §16)"
279+
|| die "no '(Re-)Subscription succeeded' for node $node in the last 15m of the matter-server log -- subscription is broken (#64, docs/10 §16)"
267280
say " matter-server log confirms: ${line:0:120}"
268281
}
269282
flash() {

firmware/scripts/ota-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ check_subscription_log() {
574574
local line=""
575575
for _ in 1 2 3 4 5 6; do
576576
if ! line="$(ssh -o BatchMode=yes -o ConnectTimeout=10 -i "$PI_SSH_KEY" "$PI_HOST" \
577-
"docker logs --since 15m matter-server 2>&1 | grep -E '<Node:$node> (Re-)?Subscription succeeded' | tail -1 || true" 2>/dev/null)"; then
577+
"docker logs --since 15m matter-server 2>&1 | sed -E 's/\x1b\[[0-9;]*m//g' | grep -E '<Node:$node> (Re-)?Subscription succeeded' | tail -1 || true" 2>/dev/null)"; then
578578
say " could not read the matter-server log on $PI_HOST -- node availability stands as the subscription assertion (#64)"
579579
return 0
580580
fi

0 commit comments

Comments
 (0)