Files
homelab/cluster/applications/hindsight/values.yaml
Hermes Agent service account 2cc9370f3d deploy-vllm: add embedding-mode support, cut over Hindsight to vLLM (t_e6facb19)
- vllm.service.j2: branch on role==embedding for --runner pooling
  --convert embed, --no-enable-prefix-caching, per-model
  trust_remote_code toggle (needed for nomic-embed-text-v1.5's custom
  NomicBertModel code), and enforce_eager toggle (needed to avoid CUDA
  graph capture OOM when co-resident with another vLLM process on this
  24GB card).
- tasks/verify.yml: split completions vs embedding smoke tests --
  embedding-mode instances don't serve /v1/completions. Assert a
  non-empty embedding vector, not just HTTP 200.
- host_vars/astro-orbiter: enable nomic-embed-text-v1.5 (port 8020),
  lower primary model's gpu_memory_utilization 0.95->0.90 + add
  enforce_eager after finding 0.95 crash-looped 6-7x before stabilizing
  with co-resident nomic-embed (real fix, confirmed via NRestarts=0
  after clean stop/start, not luck).
- Hindsight (values.yaml + externalsecret.yaml): cut LLM + embeddings
  over to vLLM (:8000, :8020), wire the previously-unset
  HINDSIGHT_API_EMBEDDINGS_* env vars for the first time, and swap the
  API key secret source from the Nous fallback item to vllm/api-key
  (vLLM enforces real auth, llama-swap did not).
- README: document the embedding-mode branch, VRAM findings, and a
  genuine architecture gap -- vLLM's one-model-per-process design
  cannot replace llama-swap's 5-model LRU roster on this 24GB card, so
  21 Hermes profiles' aux-model consumers (Qwen3-8B-no_think,
  Phi-3.5-mini, Meta-Llama-3.1-8B, Qwen2.5-Coder-14B) and OpenViking's
  VLM stay on llama-swap. Full teardown (t_6dff1ecc) needs a human
  decision on the aux-model strategy before it can proceed.
2026-08-31 18:15:22 -05:00

153 lines
8.4 KiB
YAML

# ============================================================================
# Hindsight — helm values (Phase C). Consumed by the ArgoCD Application source 1
# via `helm.valueFiles: ["$values/values.yaml"]` (openviking multi-source pattern).
#
# Design decisions (all verified against chart v0.9.1 + rendered output):
# - Chart is the single source for the app (api, control-plane, services,
# probes, ingress). We do NOT hand-roll Deployments/Services.
# - Postgres is EXTERNAL (separate Deployment in this dir, firecrawl pattern)
# => postgresql.enabled: false, external.* points at hindsight-postgres:5432.
# - Secrets come from 1Password via ExternalSecret => existingSecret:
# hindsight-credentials. The chart does envFrom(secretRef) so
# HINDSIGHT_API_LLM_API_KEY / HINDSIGHT_API_MCP_AUTH_TOKEN are injected
# automatically; POSTGRES_PASSWORD is a secretKeyRef that K8s expands into
# HINDSIGHT_API_DATABASE_URL (verified with a live envFrom test pod).
# - LLM is the Nous free-tier inference endpoint
# (https://inference-api.nousresearch.com/v1), model
# `upstage/solar-pro4:free` (tool-calling, verified reflect). Fallback
# (documented, NOT deployed): `stepfun/step-3.7-flash:free`. API key via existingSecret
# envFrom (hindsight-credentials / HINDSIGHT_API_LLM_API_KEY), sourced from
# 1Password `nous` item per decision 4.
# - Ingress is driven through the chart's NATIVE ingress template (approved
# plan: "Ingress driven through values.yaml"). api.service.port=8888,
# controlPlane.service.port=3000.
# - Image tag defaults to .Values.version (root) when api.image.tag is unset,
# so version: "0.9.1" pins the API image to 0.9.1.
# ============================================================================
version: "0.9.1"
# ----------------------------------------------------------------------------
# External PostgreSQL (chart's bundled postgresql is disabled).
# password is the K8s env expansion `$(POSTGRES_PASSWORD)` — the chart defines
# POSTGRES_PASSWORD as a secretKeyRef (hindsight-credentials / postgres-password)
# earlier in the same container, so K8s substitutes it at container start.
# ----------------------------------------------------------------------------
postgresql:
enabled: false
external:
host: hindsight-postgres
port: 5432
username: hindsight
database: hindsight
password: $(POSTGRES_PASSWORD)
# ExternalSecret (from 1Password) that the chart injects via envFrom(secretRef).
# Keys it must expose: postgres-password, HINDSIGHT_API_LLM_API_KEY,
# HINDSIGHT_API_MCP_AUTH_TOKEN. See externalsecret.yaml in this dir.
existingSecret: hindsight-credentials
# ----------------------------------------------------------------------------
# API container environment (explicit env entries; the chart renders this map
# to individual env vars). LLM points at the Nous free-tier inference endpoint
# (https://inference-api.nousresearch.com/v1), model upstage/solar-pro4:free
# (tool-calling, verified retain/recall). stepfun/step-3.7-flash was swapped out
# because it rejects Hindsight's tagged fact-extraction (BadRequestError 400
# 'missing tags'); solar-pro4 is the previously-verified-good Nous model for the
# extract/retain path (tasks t_e3375410 / t_d0dffc3d).
# HINDSIGHT_API_LLM_API_KEY is NOT set here — it comes from the existingSecret
# via envFrom (1Password `nous` item).
# ----------------------------------------------------------------------------
api:
env:
# Cutover to vLLM (t_e6facb19, 2026-08-31): astro-orbiter's llama-swap is
# being retired for the completions+embeddings roles Hindsight needs.
# vLLM serves Qwen2.5-32B-Instruct-AWQ (:8000, completions) and
# nomic-embed-text-v1.5 (:8020, --runner pooling --convert embed) as two
# independent systemd-managed processes — validated end-to-end (health,
# /v1/chat/completions, /v1/embeddings returning a 768-dim vector) in a
# shadow window with llama-swap stopped. Model swap from Qwen3.8-27B to
# Qwen2.5-32B-Instruct-AWQ: both are capable instruction-tuned models:
# confirm structured-extraction/tagging behavior (the prior stepfun/solar
# 400 "missing tags" failure mode) holds up after this swap — see
# references/hindsight-backend-fallback-to-local-qwen-workflow.md if it
# regresses and llama-swap needs to come back temporarily.
HINDSIGHT_API_LLM_BASE_URL: "http://astro-orbiter:8000/v1"
HINDSIGHT_API_LLM_PROVIDER: "openai"
HINDSIGHT_API_LLM_MODEL: "Qwen2.5-32B-Instruct-AWQ"
# Embeddings: llama.cpp nomic-embed-text-v1.5 (llama-swap, :8001) ->
# vLLM nomic-embed-text-v1.5 (:8020). Same model weights, different
# serving stack. Hindsight's embeddings provider defaults to "local"
# (bundled sentence-transformers) unless overridden — explicit TEI/openai
# provider config was never wired for astro-orbiter previously (verified:
# `kubectl exec ... env | grep -i embed` showed NO HINDSIGHT_API_EMBEDDINGS_*
# vars set, confirming Hindsight was using its bundled local embedder, NOT
# astro-orbiter, before this change — despite the OpenViking-style stack
# documentation implying otherwise). Wiring the openai-compatible provider
# here for the first time to point Hindsight's actual embedding generation
# at the vLLM-served nomic-embed-text-v1.5, matching the model OpenViking
# already uses (consistency across mk-labs services).
HINDSIGHT_API_EMBEDDINGS_PROVIDER: "openai"
HINDSIGHT_API_EMBEDDINGS_OPENAI_BASE_URL: "http://astro-orbiter:8020/v1"
HINDSIGHT_API_EMBEDDINGS_OPENAI_MODEL: "nomic-embed-text-v1.5"
# --- t_d7f8cd65: fix 502s on the serial astro-orbiter node ---
# astro-orbiter is a single llama-swap process (serial: 1 generate at a
# time, ctx 64K). Hindsight's default LLM concurrency is 32, so a retain
# burst hits the node with N parallel calls -> the node rejects/times out
# the extras -> hindsight-api surfaces APITimeoutError as 502. astro-orbiter
# is the ONLY LLM endpoint (all ops route there), so cap the whole pool to
# 1 and pin retain to 1 as well. The upstream chart exposes these as native
# semaphore config (HINDSIGHT_API_*_MAX_CONCURRENT); no code change needed.
# Kept at 1 post-cutover: vLLM's single-process-per-model design is also
# effectively serial for a single Qwen2.5-32B instance under this GPU's
# VRAM budget (KV cache sized for low concurrency at max_model_len=8192).
HINDSIGHT_API_LLM_MAX_CONCURRENT: "1"
HINDSIGHT_API_RETAIN_LLM_MAX_CONCURRENT: "1"
# Client + per-request timeout. Default is 120s; a 29K-token retain runs
# ~29s and under load a single long retain can reach ~90s. Raise to 600s to
# cover the longest round-trip so the serial call never times out the client
# (keep >= ingress proxy-read-timeout below). Per-op retain timeout pins the
# retain path explicitly; the global timeout covers reflect/consolidation.
HINDSIGHT_API_LLM_TIMEOUT: "600"
HINDSIGHT_API_RETAIN_LLM_TIMEOUT: "600"
# ----------------------------------------------------------------------------
# Ingress via the chart's native template.
# /health,/v1,/mcp,/ext -> api:8888 (longest-prefix wins in nginx)
# / -> controlPlane:3000
# TLS secret hindsight-tls provisioned by the letsencrypt-prod issuer.
# ----------------------------------------------------------------------------
ingress:
enabled: true
className: "nginx"
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
# Raised read/send timeout so a slow agentic reflect / long single retain
# (up to ~90s under load on the serial astro-orbiter node; client timeout
# is 600s per t_d7f8cd65) can complete before nginx cuts the connection.
# Raised 300 -> 600 (t_d7f8cd65) to cover the longest retain round-trip.
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
hosts:
- host: cosmic-rewind.local.mk-labs.cloud
paths:
- path: /health
pathType: Prefix
service: api
- path: /v1
pathType: Prefix
service: api
- path: /mcp
pathType: Prefix
service: api
- path: /ext
pathType: Prefix
service: api
- path: /
pathType: Prefix
service: controlPlane
tls:
- hosts:
- cosmic-rewind.local.mk-labs.cloud
secretName: hindsight-tls