Add live AI checks to system health (#3155)

* Add live AI checks to system health

Give super admins a dedicated AI status view with bounded liveness probes for LLMs, vector stores, pgvector, and embedding endpoints. Record sanitized failures in both the system debug log and Rails logger, and document the recommended local configuration.\n\nCloses #3145

* Fix AI health CI checks

* Address AI health review feedback

* Correct Ollama model preload guidance

* Distinguish OpenAI-compatible providers

* Make Ollama startup readiness explicit

* Recognize Cloudflare AI endpoints
This commit is contained in:
Juan José Mata
2026-08-24 22:41:08 +02:00
committed by GitHub
parent c26b16d36f
commit fd6f4ff078
24 changed files with 1773 additions and 120 deletions
+34
View File
@@ -0,0 +1,34 @@
require "test_helper"
class VectorStoreTest < ActiveSupport::TestCase
EMBEDDING_ENVIRONMENT = %w[
EMBEDDING_MODEL EMBEDDING_DIMENSIONS EMBEDDING_URI_BASE
EMBEDDING_ACCESS_TOKEN OPENAI_URI_BASE OPENAI_ACCESS_TOKEN
].index_with(nil).freeze
test "embedding defaults use a matching model and vector width" do
ClimateControl.modify(EMBEDDING_ENVIRONMENT) do
assert_equal "mxbai-embed-large", VectorStore.embedding_model
assert_equal 1024, VectorStore.embedding_dimensions
end
end
test "embedding credentials match runtime environment precedence" do
ClimateControl.modify(EMBEDDING_ENVIRONMENT.merge(
"EMBEDDING_ACCESS_TOKEN" => "embedding-token",
"OPENAI_ACCESS_TOKEN" => "openai-token"
)) do
assert_equal "embedding-token", VectorStore.embedding_access_token
end
ClimateControl.modify(EMBEDDING_ENVIRONMENT.merge(
"OPENAI_ACCESS_TOKEN" => "openai-token"
)) do
assert_equal "openai-token", VectorStore.embedding_access_token
end
ClimateControl.modify(EMBEDDING_ENVIRONMENT) do
assert_nil VectorStore.embedding_access_token
end
end
end