rag: add retrieval phase latency telemetry#902
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe retrieval pipeline now records total and per-phase latency telemetry, exposes it through the search API and evaluation results, and shares request-start indexing versions across local, shared, and nested cache operations. ChangesRAG cache consistency and request context
Retrieval timing and telemetry
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SearchClient
participant SearchRoute
participant searchChunksWithTelemetry
participant rag-cache
SearchClient->>SearchRoute: request search
SearchRoute->>searchChunksWithTelemetry: execute retrieval
searchChunksWithTelemetry->>rag-cache: timed cache lookup
rag-cache-->>searchChunksWithTelemetry: cached or uncached result
searchChunksWithTelemetry-->>SearchRoute: results and latency telemetry
SearchRoute-->>SearchClient: response telemetry
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/rag.ts`:
- Around line 2467-2469: Update the fetchEnabledRagAliases call within the
ragAliasesPromise initialization to pass args.signal through to the concurrent
alias-loading operation, preserving the existing timing wrapper and arguments.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 65f0c704-e90e-4ac6-9b07-5d6a874dc593
📒 Files selected for processing (8)
scripts/eval-retrieval.tssrc/app/api/search/route.tssrc/lib/rag-cache.tssrc/lib/rag-contracts.tssrc/lib/rag.tstests/eval-retrieval.test.tstests/rag-tail-latency.test.tstests/rag-variant-early-exit.test.ts
Summary
Verification
npm run test— 313 files, 2,840 tests passed.npm run eval:rag:offline— 36 golden cases, 21 suites, 294 tests passed.npm run typechecknpm run check:production-readiness:ci— READY; only expected missing-local-env warnings.npm run verify:pr-localVerification not run:
npm run verify:pr-localwas not repeated after its constituent full unit, typecheck, lint, offline RAG, and readiness checks passed; hosted CI remains responsible for the clean production build.Live verification not run: no provider-backed retrieval or answer evaluation was run. No provider calls were made.
UI verification not run: no UI, routing, styling, or browser behavior changed.
Risk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Tests