From 2e6d24fcd1321b5e29f170bcc596d09ef762c783 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 12 Oct 2026 15:51:17 +0000 Subject: [PATCH] Retry the e2e login while the server is coming up Why: one isolated run reached a listening server and still failed the single login attempt, while the same data accepted the password a moment later. Evidence: replaying the login against that data directory returned HTTP 200. Impact: the seed retries login for a few seconds before it stops. The password and the set-password step are unchanged. Refs: scripts/e2e.sh Co-authored-by: Cursor --- scripts/e2e.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/e2e.sh b/scripts/e2e.sh index 8cdd6303..b5a6923a 100755 --- a/scripts/e2e.sh +++ b/scripts/e2e.sh @@ -124,9 +124,16 @@ stop_serve() { [ -n "${API_PID:-}" ] && { kill "$API_PID" 2>/dev/null || true; wait "$API_PID" 2>/dev/null || true; API_PID=""; } } login() { - curl -sf -c "$JAR" -X POST "$API_BASE/api/auth/login" \ - -H 'Content-Type: application/json' \ - -d "{\"owner\":\"$OWNER\",\"password\":\"$PASSWORD\"}" >/dev/null || die "login failed" + local i + for i in $(seq 1 20); do + if curl -sf -c "$JAR" -X POST "$API_BASE/api/auth/login" \ + -H 'Content-Type: application/json' \ + -d "{\"owner\":\"$OWNER\",\"password\":\"$PASSWORD\"}" >/dev/null; then + return 0 + fi + sleep 0.25 + done + die "login failed" } # CLI 建号留下 must_change_password。会话在改密前不能调用业务命令。 # 强制设密会作废当前会话,所以设密后用新密码再登录。