From 6a27193b56ae06fac1c19463c5cb6a006a7e8650 Mon Sep 17 00:00:00 2001 From: Hasan Basbunar Date: Thu, 19 Nov 2026 10:17:41 +0100 Subject: [PATCH] new lanes on v1.52: the Transcribe proof asks the address its unit listens on, not 127.0.0.1 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe Co-Authored-By: Claude Opus 5.5 --- install-transcribe.sh | 9 +++++++-- tests/test_transcribe_lane.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/install-transcribe.sh b/install-transcribe.sh index 7a0084a7..4278ac8d 100755 --- a/install-transcribe.sh +++ b/install-transcribe.sh @@ -113,6 +113,11 @@ PORT="${TRANSCRIBE_PORT:-$(installed_flag --port)}"; PORT="${PORT:-30036}" case "$PORT" in ''|*[!0-9]*) die "TRANSCRIBE_PORT takes a number, got: $PORT" ;; esac ENGINE_BIND="${TRANSCRIBE_BIND:-$(installed_flag --host)}"; ENGINE_BIND="${ENGINE_BIND:-127.0.0.1}" case "$ENGINE_BIND" in *[!0-9.]*|""|*..*) [ "$ENGINE_BIND" = localhost ] || die "TRANSCRIBE_BIND takes an IPv4 address, got: $ENGINE_BIND" ;; esac +# The address the proof asks: the one the unit listens on, which 0.0.0.0 is every interface of, +# reached on the box itself by 127.0.0.1. A proof hardcoded on 127.0.0.1 asked a port nothing +# answered on a box bound to a LAN address, and a lane that came up was said failed (found in +# review, 2026-11-19). +PROOF_BIND="$ENGINE_BIND"; [ "$PROOF_BIND" = 0.0.0.0 ] && PROOF_BIND=127.0.0.1 # The Hugging Face cache the unit mounts, read the way the other lanes beside it read theirs # (vllm-lane.sh's vlane_text_cache): this lane's own unit first, then the text lanes', so a box # whose cache lives on another disk (docs/external-disk.md, HF_CACHE=...) keeps its 36.5 GB there @@ -272,7 +277,7 @@ SINCE="$(date '+%Y-%m-%d %H:%M:%S')" r0="$(systemctl show -p NRestarts --value "$UNIT" 2>/dev/null | tr -dc '0-9')" ready=0 for i in $(seq 1 30); do - curl -fsS -m 3 "http://127.0.0.1:$PORT/health" >/dev/null 2>&1 && { ready=1; break; } + curl -fsS -m 3 "http://$PROOF_BIND:$PORT/health" >/dev/null 2>&1 && { ready=1; break; } if [ "$(systemctl is-active "$UNIT" || true)" = failed ] \ || [ "$(systemctl show -p NRestarts --value "$UNIT" 2>/dev/null | tr -dc '0-9')" -gt "${r0:-0}" ]; then { sudo journalctl -u "$UNIT" --since "$SINCE" --no-pager || true; } | tail -40 @@ -284,7 +289,7 @@ done [ "$ready" -eq 1 ] || { { sudo journalctl -u "$UNIT" --since "$SINCE" --no-pager || true; } | tail -40; die "the lane did not answer /health within 4 min. The journal above says why."; } echo "up after ~$(( (i - 1) * 8 )) s" KEY="$(head -1 "$CONFIG_DIR/api-key")" -code="$(curl -sS -o "$SMOKE_DIR/heard.json" -w '%{http_code}' -m 300 "http://127.0.0.1:$PORT/v1/audio/transcriptions" \ +code="$(curl -sS -o "$SMOKE_DIR/heard.json" -w '%{http_code}' -m 300 "http://$PROOF_BIND:$PORT/v1/audio/transcriptions" \ -H @<(printf 'Authorization: Bearer %s\n' "$KEY") \ -F "file=@$HERE/tests/fixtures/transcribe-smoke.wav" -F language=fr || true)" [ "$code" = 200 ] || { head -c 300 "$SMOKE_DIR/heard.json" 2>/dev/null; echo; { sudo journalctl -u "$UNIT" --since "$SINCE" --no-pager || true; } | tail -20; die "the recognizer did not answer /v1/audio/transcriptions (HTTP ${code:-000})."; } diff --git a/tests/test_transcribe_lane.py b/tests/test_transcribe_lane.py index b2c29d67..75452084 100644 --- a/tests/test_transcribe_lane.py +++ b/tests/test_transcribe_lane.py @@ -125,5 +125,34 @@ class TheProofRestartsALaneThatServesOlderFiles(unittest.TestCase): self.assertNotIn("restart", r.stdout) +class TheProofAsksTheAddressTheUnitListensOn(unittest.TestCase): + """TRANSCRIBE_BIND moves the engine to any IPv4 address (docs/transcribe-lane.md), and a proof + hardcoded on 127.0.0.1 asked a port nothing answered on such a box: the health loop ran out, + an install that came up was said failed and its trap took the lane back down (found in review, + 2026-11-19). 0.0.0.0 is every interface, which the box itself reaches on 127.0.0.1.""" + + def proof_bind(self, bind): + t = INSTALLER.read_text() + block = t[t.index('PROOF_BIND="$ENGINE_BIND"'):t.index("\n", t.index('PROOF_BIND="')) + 1] + r = subprocess.run(["bash", "-c", f'set -euo pipefail\nENGINE_BIND={bind!r}\n' + block + + 'echo "PROOF=$PROOF_BIND"'], + capture_output=True, text=True, timeout=30, env={"PATH": "/usr/bin:/bin"}) + self.assertEqual(r.returncode, 0, r.stderr) + return r.stdout.strip() + + def test_the_proof_asks_the_bind_the_unit_listens_on(self): + t = INSTALLER.read_text() + self.assertIn('curl -fsS -m 3 "http://$PROOF_BIND:$PORT/health"', t) + self.assertIn('"http://$PROOF_BIND:$PORT/v1/audio/transcriptions"', t) + self.assertNotIn("http://127.0.0.1:$PORT", t) + + def test_every_interface_is_asked_on_the_box_itself(self): + self.assertEqual(self.proof_bind("0.0.0.0"), "PROOF=127.0.0.1") + + def test_a_named_address_is_asked_as_it_is(self): + for bind in ("127.0.0.1", "192.168.1.20", "localhost"): + self.assertEqual(self.proof_bind(bind), f"PROOF={bind}", bind) + + if __name__ == "__main__": unittest.main()