fix(observability): route RAG pipeline errors through console.error - #3917
Conversation
embed/upsert/delete/chunk-read failures in rag.ts, and index/reindex failures in rag-index.ts, logged at console.log with no level field -- invisible to the Sentry forwarder, unlike the already-fixed sibling catch in the same file. rag.ts stays import-free (a deliberate self-contained-port invariant); rag-index.ts additionally gains a gittensory_rag_pipeline_errors_total counter since it already imports other dependencies. Closes #3894
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-07 06:57:34 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3917 +/- ##
==========================================
+ Coverage 93.58% 93.59% +0.01%
==========================================
Files 358 358
Lines 34342 34344 +2
Branches 12570 12570
==========================================
+ Hits 32138 32144 +6
+ Misses 1580 1576 -4
Partials 624 624
🚀 New features to boost your workflow:
|
Summary
src/review/rag.ts(embedTexts,upsertChunks,deleteChunksForPaths,readChunkTexts) and two insrc/review/rag-index.ts(indexRepo,reindexChangedPaths) logged failures atconsole.logwith nolevelfield — invisible to the central Sentry forwarder. The sibling catch in the same file (retrieveContextWithMetrics) was already fixed toconsole.errorwithlevel:"error"; this extends the same fix to the rest of the module.rag.ts's four fixes reuse that sibling's exactevent: "review_context_fetch_failed"/contextType: "rag"umbrella (searchable together in Sentry) plus each function's own specificevtag for log continuity. No new import was added torag.ts— it declares itself a "SELF-CONTAINED NATIVE PORT... no imports" in its own header comment, so I kept that invariant intact rather than importing the metrics module there.rag-index.ts's two fixes mirror its own already-fixed siblings (rag_index_tree_error,rag_list_paths_error) and additionally register + increment a newgittensory_rag_pipeline_errors_total{op}counter, since this file already imports other dependencies and has no such constraint — closing the gap where an embedding-provider outage was invisible toGittensoryQdrantErrorRateHigh(that counter only fires inside the Qdrant adapter itself).rag.test.tswith console.error assertions, and added two new tests reachingindexRepo/reindexChangedPaths's own outer catch (every other I/O step in those functions already self-catches, so a thrown Cloudflare-binding access — a realistic Workers-runtime failure mode — is the one way to reach it) confirming both the log shape and the new counter.Found via a fresh performance/scalability/accuracy hardening audit of the self-host ORB stack. Tracked under #1667.
Scope
src/review/rag.ts— 4 catches: console.log → console.error + level:errorsrc/review/rag-index.ts— 2 catches: console.log → console.error + level:error + new countersrc/selfhost/metrics.ts— registergittensory_rag_pipeline_errors_totaltest/unit/rag.test.ts,test/unit/rag-index.test.ts— coverage for every changed line/branchValidation
npm run typechecknpm run test:coverage(full unsharded) — 545 files / 10824 tests passed;rag.ts100%,rag-index.ts99.32% lines / 90.62% branch (only line 184, an untouched pre-existing line, uncovered)git diff --checkcleanSafety
null/0/empty on error) — only the log level/shape and one new counter changed. No secrets, nosrc/**behavior change beyond observability.Closes #3894