Skip to content

feat(tools): Rerank unclear tool search matches with the fast model - #2904

Merged
dcramer merged 6 commits into
mainfrom
feat/tool-search-model-rerank
Nov 12, 2026
Merged

dcramer merged 6 commits into
mainfrom
feat/tool-search-model-rerank

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Stacked on #2903. Part of #2893.

searchTools still ranks by word match first. When the word match is unclear, the fast model picks from the top 20 candidates. Unclear means: the best tool's name lacks the query's action and object, the next score is within 70% of the best, or the #2903 no-fit rule fired. The model returns up to 3 candidate names, or none. Names that are not candidates are dropped. A clear winner skips the model.

  • A timeout (5s) or a transient provider failure keeps the word match. Other failures go to the tool call.
  • The query and tool text go in the prompt as escaped data.
  • Telemetry: app.tool_search.rerank.* (TELEMETRY.md "Tool Search").
  • About 1,000 input tokens per call at 20 candidates.

Tests: the test architecture check does not allow model fakes in packages/junior/tests. So the ranking tests check the word match and which queries go to the model, and a clear search runs through searchTools with no model. The new classifiers eval (tool-search.eval.ts) runs the model path with the real model.

via @dcramer.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 12, 2026 9:05pm UTC

Request Review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

sentry-junior Bot and others added 4 commits November 12, 2026 20:30
When the word match cannot tell which tool fits, send the top 20
candidates to the fast model. It picks up to 3 of them, or none. A clear
winner skips the model.

Refs #2893

Co-Authored-By: David Cramer <[email protected]>
CI has no AI Gateway credentials, so unclear queries failed there.
A query such as "automation list update channel" dropped
searchAutomations below the score cutoff, because "list" did not match
the search action. A list query now also matches search tools at the
synonym weight. A search query still does not match list tools.
Main now sends core model calls through @/chat/core-model, which names
each operation and where its cost goes, and no longer accepts
temperature. The rerank call now uses it as tool_search_rerank, and a
run passes its Conversation and Turn as the cost owner.

Main's new issue comment tool shares the update action with issue tools,
so "edit my issue comment" and "modify an issue" now go to the model.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2818ebb. Configure here.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

13 screenshot changes — 13 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automations Runs Filters · Desktop
Automations Runs Filters · Desktop
Changed
Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Attachment · Mobile
Conversation Attachment · Mobile
Changed
Conversation Attachment Modal · Desktop
Conversation Attachment Modal · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
Changed
Show 7 more changed screenshots
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Conversation Question Picks And Text · Desktop
Conversation Question Picks And Text · Desktop
Changed
Memories · Mobile
Memories · Mobile
Changed
Push Notifications Tip · Desktop
Push Notifications Tip · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed

A rerank answer with names that are all outside the candidate list is a
bad answer, not a choice of none. Keep the word match and log
tool_search.rerank.failed, like a timeout.
createPiAgentTools now takes an options object, and searchToolsCost has
no default. A new caller must choose who pays for the rerank call.
Tests and evals pass { owner: "none" }.

Co-Authored-By: David Cramer <[email protected]>
@dcramer
dcramer merged commit 6707c6f into main Nov 12, 2026
55 of 56 checks passed
@dcramer
dcramer deleted the feat/tool-search-model-rerank branch November 12, 2026 21:35

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 3a82a14b Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant