From 8f4a8650b0b8bf01a40d2a10880cd64e52de25dd Mon Sep 17 00:00:00 2001 From: Vasyl Vdovychenko Date: Thu, 7 May 2026 19:53:27 -0400 Subject: [PATCH] fix: admin healthcheck IPv6 + single-word distractor prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two narrow fixes surfaced after the gemma4:e4b deploy. 1. admin healthcheck used localhost which Alpine resolves to ::1 (IPv6) first; vite binds only to 0.0.0.0 (IPv4) so wget got "Connection refused" forever. textstack_admin_prod has been (unhealthy) with FailingStreak=241 since deploy. Switched to 127.0.0.1. 2. DistractorGenerator's parser drops multi-word entries (`!w.Contains(' ')`). Gemma4 likes phrasal distractors ("strong consistency", "data loss") so most of its output gets stripped and the 5-distractor minimum fails — falls back to random vocab words. Added explicit single-word instruction with concrete examples. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/Vocabulary/TextStack.Vocabulary/DistractorGenerator.cs | 1 + docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/Vocabulary/TextStack.Vocabulary/DistractorGenerator.cs b/backend/src/Vocabulary/TextStack.Vocabulary/DistractorGenerator.cs index 739b62d7..c67eb8f0 100644 --- a/backend/src/Vocabulary/TextStack.Vocabulary/DistractorGenerator.cs +++ b/backend/src/Vocabulary/TextStack.Vocabulary/DistractorGenerator.cs @@ -49,6 +49,7 @@ private static (string System, string User) BuildPrompt( parts.Add("- Similar difficulty level"); parts.Add("- NOT synonyms"); parts.Add("- Could plausibly confuse a learner"); + parts.Add("- SINGLE WORD ONLY — no spaces, no multi-word phrases (use \"linearizability\" not \"strong consistency\"; \"sharding\" not \"data partitioning\"). Hyphens are fine."); parts.Add(""); parts.Add("Task 2 - Hint: Write ONE short sentence (under 15 words) describing what this word means."); parts.Add($"Do NOT use the word \"{word}\" or direct synonyms in the hint."); diff --git a/docker-compose.yml b/docker-compose.yml index 7abbaf79..51d54bb1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -145,7 +145,7 @@ services: - "127.0.0.1:81:81" # Only localhost - not exposed to internet restart: always healthcheck: - test: ["CMD-SHELL", "wget -qO- http://localhost:81/ > /dev/null || exit 1"] + test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:81/ > /dev/null || exit 1"] interval: 30s timeout: 5s retries: 3