You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): t3_thread_search keeps a better title match over a weaker one - #44245
t3_thread_search can drop a title match and list a weaker one in its place. With six threads titled "Heron 1" to "Heron 6", each holding a message "a heron sighting", an agent that calls t3_thread_search with { "query": "heron", "limit": 5 } gets Heron 1, 2, 3, 4 and 6. Heron 5 is missing, and limit: 6 lists all six by title in order.
Steps (Linux, no sign-in):
In one project, rename six threads "Heron 1" to "Heron 6" and send "a heron sighting" in each.
From an agent thread in that project call t3_thread_search with { "query": "heron", "limit": 5 }.
The result has four title matches and one message match for the thread ranked sixth by title. The fifth is missing.
With the default limit of 50 it needs over 40 title matches, so agents that pass a small limit (5, 10) hit it with a handful of threads.
Cause
In searchThreads (apps/server/src/orchestration-v2/ThreadSearch.ts), titleHits is the top limit title matches, and all of them are passed to the message search as excludedThreadIds (the threads the caller already lists). But only titleHits.slice(0, limit - messageSlots) is listed. Title matches ranked between limit - messageSlots and limit are neither listed nor allowed back as message matches, while title matches ranked past limit were never excluded, so one of them can take the message slot.
Change
Every title match is now excluded from the message search, not only the top limit. The message slots go to threads the titles miss, so a weaker title match can no longer take a slot from a better one. Message-only threads keep their room. One file, ten lines.
Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New ThreadSearch.test.ts case "keeps a better title match over a weaker one found by its messages".
FAIL ThreadSearch.searchThreads > keeps a better title match over a weaker one found by its messages
AssertionError: expected [ 'thread:heron-1', …(4) ] to deeply equal [ 'thread:heron-1', …(4) ]
- "thread:heron-5",
+ "thread:heron-6",
Reviewing files that changed from the base of the PR and between 21de9d1 and 35e1960.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
searchThreads now excludes every ranked title match from message search before applying the result limit. A test checks that title matches take precedence and that the returned thread ordering remains stable.
Changes: Thread Search Match Precedence
Layer / File(s)
Summary
Title match exclusion and regression test apps/server/src/orchestration-v2/ThreadSearch.ts, apps/server/src/orchestration-v2/ThreadSearch.test.ts
searchThreads excludes all ranked title matches from message search before limiting results. The test checks title-sourced results and thread ordering for limits of six and five.
This change keeps stronger title matches from being displaced by weaker message matches when the result limit is small. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(server): t3_thread_search keeps a better title match over a weaker one" matches the main change. The PR changes ThreadSearch.searchThreads so every title match is excluded from message …
Description check
The description follows the repository template. It has Problem, Cause, Change, Scope, and Verification content, and it gives reproduction steps and the cause in ThreadSearch.ts. Verification lists th…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(server): t3_thread_search keeps a better title match over a weaker one" matches the main change. The PR changes ThreadSearch.searchThreads so every title match is excluded from message search, which stops a weaker title match from taking a slot from a better one. The title is a conventional commit, short, and specific.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Cause, Change, Scope, and Verification content, and it gives reproduction steps and the cause in ThreadSearch.ts. Verification lists the new test, the failing output on main, the passing output with the fix, and the checks run. It also states what was not verified. The template's Change and Scope headings are present in substance, though the author used a Cause section that the template does not list. The description does not link an issue. It explains why none is needed, which the template allows for small obvious bug fixes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Created six Replay threads, sent 'a heron sighting' through each web composer, then called real MCP t3_thread_search('heron') with limits 6 and 5. Fresh isolated databases; web browser, 1280×800, light theme. The labeled panel displays actual server responses.
…r one (pingdotgg#44245)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
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
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
Problem
t3_thread_searchcan drop a title match and list a weaker one in its place. With six threads titled "Heron 1" to "Heron 6", each holding a message "a heron sighting", an agent that callst3_thread_searchwith{ "query": "heron", "limit": 5 }gets Heron 1, 2, 3, 4 and 6. Heron 5 is missing, andlimit: 6lists all six by title in order.Steps (Linux, no sign-in):
t3_thread_searchwith{ "query": "heron", "limit": 5 }.With the default limit of 50 it needs over 40 title matches, so agents that pass a small limit (5, 10) hit it with a handful of threads.
Cause
In
searchThreads(apps/server/src/orchestration-v2/ThreadSearch.ts),titleHitsis the toplimittitle matches, and all of them are passed to the message search asexcludedThreadIds(the threads the caller already lists). But onlytitleHits.slice(0, limit - messageSlots)is listed. Title matches ranked betweenlimit - messageSlotsandlimitare neither listed nor allowed back as message matches, while title matches ranked pastlimitwere never excluded, so one of them can take the message slot.Change
Every title match is now excluded from the message search, not only the top
limit. The message slots go to threads the titles miss, so a weaker title match can no longer take a slot from a better one. Message-only threads keep their room. One file, ten lines.Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New
ThreadSearch.test.tscase "keeps a better title match over a weaker one found by its messages".Test commit alone, on main f7ec68b:
With the fix:
vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and test (2 files, 36 tests) all pass.Not verified: I did not run a real agent against a live app; the test builds the six threads and calls
searchThreadsdirectly.Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.