Conversation
anurag629
approved these changes
Nov 13, 2026
anurag629
left a comment
Member
There was a problem hiding this comment.
Thanks @bhushan4work. plan() now uses the defaults when topK or candidates isn't finite, so topK: NaN asks the store for 20 candidates and sources come back instead of slice(0, NaN). Finite values still get the Math.floor and the minimum of 1. The tests cover NaN and Infinity for topK and NaN for candidates, in both retrievers. All checks pass, including e2e.
Member
|
Merged, thanks @bhushan4work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Closes #598
plan()inpackages/core/src/retrieval/retrievers.tsnow falls back toDEFAULT_TOP_Kwhenquery.topKoroptions.candidatesis not a finite number (NaN,Infinity,-Infinity), sofinish()no longer callschunks.slice(0, NaN)and silently returns no sources. Finite values keep the existingMath.floor+ minimum of 1 behavior, including0, negatives, and fractions. Added regression tests for bothvectorRetrieverandhybridRetriever, plus a patch changeset for@chatcops/core.How I tested this
packages/core/tests/retrieval/retrievers.test.tscoveringtopK: NaN,topK: Infinity, andcandidates: NaNfor both retrievers. Each asserts the store receives a finitetopKand sources are returned. Confirmed these fail ondev.topK: 0, negative numbers, and fractions is unchanged.pnpm -r build,pnpm test, andpnpm -r typecheck.AI assistance
none
Checklist
devpnpm -r build,pnpm testandpnpm -r typecheckpass locallypnpm changeset) if this changescore,widgetorserverpnpm apirun andapi/committed if an exported type or option changed