Skip to content

fix(review): RAG embedding calls rejected with HTTP 400 (485 Sentry events, ongoing) #4996

Description

@JSONbored

Summary

RAG context-fetch embedding calls are rejected with HTTP 400 — 485 events, ongoing for 2 weeks, still firing this hour as of filing.

Evidence (Sentry)

GITTENSORY-Dreview_context_fetch_failed: Error: ai_embed_http_400, first seen 2026-06-28, last seen 2026-07-11 (today, ongoing). Tags: contextType: rag, ev: rag_embed_error. No stack trace attached to the captured event (structured-log-forwarded, not a raw exception — see the companion observability-hygiene issue for the general pattern).

Root cause (needs independent investigation — do not trust Seer blind)

Seer's summary for this issue says: "Add a circuit-breaker flag in enrichment-wire.ts: disable all /v1/enrich calls for the process lifetime when the startup probe confirms a 401/403 auth rejection." This does not match the actual error — the tagged error is ai_embed_http_400 (Bad Request), not 401/403 (auth). A 400 usually means a malformed request (wrong payload shape, oversized input, bad model/param), not an auth problem. Seer's summary appears to have pulled context from a different, adjacent issue. Start from the actual embedding-request code (search for rag_embed_error / the RAG context-fetch path), not from this summary.

Requirements

  1. Find the actual embedding-call code path (rag_embed_error / review_context_fetch_failed) and reproduce or trace what request is actually being rejected with 400.
  2. Determine whether this is a malformed-payload bug (fixable), an input-size limit being exceeded (needs truncation/chunking), or a genuinely bad config (model name, endpoint) — each has a different fix.
  3. Since this has been failing continuously for 2 weeks, check whether RAG-backed review context has been silently degraded (missing context) for every review in that window, and whether that's visible anywhere it should have been caught sooner.

Deliverables

  • Root cause identified from the actual code/request, not assumed from Seer's mismatched summary.
  • Code fix with a regression test.
  • A note on how long review quality was degraded and whether any additional signal (test, log) should have caught this sooner.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions