fix: Recognize 301/401/403 as reachable in embedding health check
All checks were successful
Botlib CI / build (push) Successful in 4s
BotServer CI / build (push) Successful in 3m57s
Bottest CI / build (push) Successful in 24s
BotUI CI / build (push) Successful in 12s

Remote APIs like Cloudflare Workers AI return 401 on /health and
301 on HEAD requests. These indicate the server IS reachable,
not down. Previously only 404/405 were treated as reachable,
causing all KB indexing to fail with 'Embedding server not available'.
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-22 16:40:53 +00:00
parent a923ab2db1
commit 248165c3cb

View file

@ -341,6 +341,12 @@ impl KbEmbeddingGenerator {
false false
} }
} }
} else if status.is_redirection() || status.as_u16() == 401 || status.as_u16() == 403 {
// Redirect (301/302) or auth-required (401/403) means the server IS reachable
// This is typical for remote APIs like Cloudflare Workers AI
info!("Embedding server reachable at {} (status {} indicates external API), marking as ready", base_url, status);
set_embedding_server_ready(true);
true
} else { } else {
warn!("Embedding server health check returned status {}", status); warn!("Embedding server health check returned status {}", status);
set_embedding_server_ready(false); set_embedding_server_ready(false);