fix(rag): restore bounded live retrieval reranking#919
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughMedication monitoring queries now require subject-specific retrieval evidence. Second-stage reranking persists a bounded ChangesMedication retrieval and ranking
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Query
participant RetrievalIntent
participant EvidenceSelection
participant Reranker
participant ReleasedOrdering
Query->>RetrievalIntent: classify medication monitoring query
RetrievalIntent->>EvidenceSelection: require clinical_subject
EvidenceSelection-->>Reranker: annotate subject match
Reranker->>Reranker: compute bounded releaseRankScore
Reranker->>ReleasedOrdering: persist score for final ordering
ReleasedOrdering-->>Query: deduplicated ranked results
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #3542 (success). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a99227447
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
Key stabilizeReleasedSearchOrder off whether the final result set carries releaseRankScore instead of the sticky second_stage_rerank_used telemetry flag. Sync telemetry to the final set so intermediate rerank passes cannot mis-route later hybrid fallthrough results. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7cf8e55633
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f10137551
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Final release verification
4f10137551b8e09d724b87219852e03317cf50b9: static checks, unit coverage, production build, safety/config, Semgrep, Gitleaks, GitGuardian, and PR policy.313e57a405da53dfcb0d851a937af2f50465a489.Clinical KB Database(sjrfecxgysukkwxsowpy) was rechecked through MCP after deployment and isACTIVE_HEALTHY; the intended migration ledger entries are present and both edge functions are active.Summary
finalRankaligned with the returned order.Verification
npm run verify:pr-localnpm run verify:uiwhen UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed (full Chromium gate passed earlier in this release task: 239/239; this corrective diff is backend-only)npm run verify:releasebefore release or handoff confidence claimsnpm run eval:retrieval:quality(must stay 36/36) when retrieval, ranking, selection, chunking, or scoring behavior changed — draft is intentionally blocked pending the exact-head hosted canarynpm run eval:rag -- --limit 15+npm run eval:quality -- --rag-onlywhen answer generation, the synthesis prompt, or answer post-processing changed (not applicable: no answer-generation change; the hosted canary answer subset remains required)npm run check:production-readinesswhen clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed (passed earlier in this release task)npm run check:deployment-readinesswhen deployment startup, hosting, or rollout behavior changed (not applicable: no hosting/startup change)Focused checks:
npm run test -- tests/rag-answer-fallback.test.ts tests/answer-ranking.test.ts tests/rag-second-stage-ranking.test.ts tests/retrieval-selection.test.ts tests/semantic-rerank.test.ts— 5 files, 85 tests passednpm run typecheck— passednpx prettier --check src/lib/rag.ts src/lib/types.ts tests/rag-second-stage-ranking.test.ts— passedgit diff --check— passednpm run verify:cheap— attempted but deferred because another legitimate Database worktree held the repository-wide heavyweight lock for its Chromium UI gateLive regression evidence motivating this correction:
Risk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
Summary by CodeRabbit