Repository navigation
fix(search): order CLI semantic results by rerank score, matching the web - #1976
Merged
Merged
Conversation
… web The CLI's cross-cell semantic merge ordered tier 0 by BM25 and tier 1 by the per-namespace retrieval Score, and its result model dropped the rerankScore field entirely. query-serve documents that Score "is not the field results are ordered by ... sorting by it undoes reranking," so the CLI was effectively showing un-reranked results while the entire.io web BFF orders both tiers by the Cohere rerank score (ENT-1425/ENT-1431). Same query + repo + user returned wildly different order and counts between `entire search` and the web (e.g. 118/119 tier-0 positions differed on one query). This brings the CLI merge to parity: - add RerankScore to the search result Meta so the CLI parses and surfaces query-serve's cross-encoder score - order tier 0 by rerank score desc (BM25 tie-break) when every row was reranked, else the BFF's positional mixed-capability fallback - order tier 1 by rerank score desc (retrieval Score tie-break) - tests assert rerank ordering with BM25/Score set to the opposite order so a regression to the old keys fails, plus the mixed-cell fallback Verified end-to-end: the patched CLI's top results now match the web's rerankScore order exactly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012duPNCzBFuJLC9Axwo9oHA
Contributor
There was a problem hiding this comment.
Pull request overview
This PR brings the CLI’s semantic cross-cell merge ordering into parity with the web client by parsing and using query-serve’s cross-encoder rerank score, so identical queries yield consistent ordering and totals across CLI and entire.io.
Changes:
- Add
Meta.RerankScoreto the search result model so the CLI parses rerank scores returned by query-serve. - Update semantic merge ordering to sort tier 0 and tier 1 by rerank score (with appropriate tie-breakers) and implement the mixed-capability tier-0 fallback to match the BFF behavior.
- Add/adjust tests to assert rerank-first ordering and the tier-0 mixed-capability fallback behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/entire/cli/search/search.go | Extends search result metadata to include rerankScore from the backend response. |
| cmd/entire/cli/search_v4.go | Reworks cross-cell semantic ranking to use rerank score and adds tier-0 mixed-capability fallback ordering logic. |
| cmd/entire/cli/search_v4_test.go | Updates tier ordering expectations and adds coverage for the tier-0 mixed-capability fallback. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Address review caveats: assert query-serve's rerankScore is parsed off the wire (a dropped field silently reverts ordering) and that absent stays nil, and assert the tier-0 (BM25 desc) and tier-1 (Score desc) secondary keys when rerank scores tie. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012duPNCzBFuJLC9Axwo9oHA
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 87b8942. Configure here.
evisdren
approved these changes
Aug 12, 2026
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.
https://entire.io/gh/entireio/cli/trails/1032
Problem
entire search(CLI) and entire.io (web) return different results for the same query + repo + user — different order and different totals. Root cause: the CLI's cross-cell semantic merge orders by the wrong key.Score, and its result model had norerankScorefield at all (it silently dropped it when parsing the response).entire-searchquery-serve) is identical for both clients, but the ordering that consumes the rerank score is a separate re-implementation in each client (Go in the CLI, TS in the BFF), and the CLI's copy never got the fixes the web did.Scorefield: "It is NOT the field results are ordered by … sorting by it undoes reranking." The CLI was sorting by exactly that. The web BFF orders both tiers by rerank score (ENT-1425 / ENT-1431); the CLI was sitting at the pre-fix behavior.Measured on EU prod, same user/repo:
"dependabot"onentirehq/entire.io: 118 of 119 tier-0 positions differed between CLI and web; totals 100 vs 121."antithesis reranking": different use github runners #1, 15 of 18 positions differed; CLI output carried norerankScore.This is the same divergence class as the "wildly different results" reports.
Fix
Bring the CLI merge to parity with the web:
RerankScoreto the search resultMetaso the CLI parses and surfaces query-serve's cross-encoder score;Scoretie-break);Scoreset to the opposite order, so a regression to the old keys fails, plus a mixed-capability fallback test.Repos, tier-2 promotion, dedupe, caps, and counts are unchanged.
Verification
go build ./cmd/entire/...,go vet, and the search test suites pass."dependabot"now match the web'srerankScoreorder exactly (0.6276, 0.6036, 0.5790, 0.5637, …), andrerankScoreis now present on every reranked row.Follow-up (not in this PR)
🤖 Generated with Claude Code
Note
Cursor Bugbot is generating a summary for commit 9175836. Configure here.