Skip to content

fix(memory): Rank each sentence of a request during recall - #2642

Closed
sentry-junior[bot] wants to merge 3 commits into
mainfrom
fix/handoff-memory-recall
Closed

sentry-junior[bot] wants to merge 3 commits into
mainfrom
fix/handoff-memory-recall

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the integration eval coding/handoff.eval.ts › "when the turn hands off, do the new request". It has failed on every shard-2 run since #2585.

Cause. #2585 (55c00b77e) admits a recall candidate only when the reranker scores it at least 0.55 against the whole user message (packages/junior-memory/src/recall.ts). The eval's message has two requests: "Switch to the other configured profile first. Gut check". I got live voyage/rerank-2.5-lite scores in CI with a temporary probe:

query score vs. the gut-check memory
Switch to the other configured profile first. Gut check 0.475
Switch to the other configured profile first. 0.271
Gut check 0.856
gut check 0.854
Gut check please 0.763
thanks! 0.338
how's it going? 0.425

So the memory never reached the prompt. In the failing transcripts the model reads files and edits code, which the memory forbids, and never adds the verdict reaction. The last green run replayed a recording made before #2585: it has no rerank request. The eval did not catch this on #2585 because the integration evals do not run for changes to packages/junior-memory.

Fix. When the message has more than one sentence (Intl.Segmenter), recall also ranks the candidates against each of the first 5 sentences and keeps the best score per memory. The rerank calls run in parallel. The threshold and the single-sentence path do not change, so small-talk queries still score as they did in #2585's calibration.

Tests. A new storage test uses the live scores above. It fails without the fix. junior-memory tests (98) and typecheck pass. The PR has the trigger-evals label so the integration and behavioral evals run.

The branch has two temporary probe commits. The final diff does not include them; squash on merge.

via @dcramer.

--

View Session [Sentry]

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
@vercel

vercel Bot commented Nov 4, 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 4, 2026 3:59am UTC

Request Review

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
A request with two asks scored the memory for one ask below the 0.55 recall
threshold. The handoff integration eval has failed since #2585 for this reason:
the reranker scored its gut-check memory 0.48 against the whole message and
0.86 against "Gut check" alone.

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
@sentry-junior sentry-junior Bot added the trigger-evals Run evals on a PR label Nov 4, 2026
@sentry-junior sentry-junior Bot changed the title fix(memory): Recall the handoff eval's memory again (WIP) fix(memory): Rank each sentence of a request during recall Nov 4, 2026
@dcramer

dcramer commented Nov 4, 2026

Copy link
Copy Markdown
Member

this patch is awfully confusing and feels a bit like duct tape

@sentry-junior

sentry-junior Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

check / types and test / junior unit failed here because of a break on main, not this PR: web-batch-messages.test.ts imported webActorFromEmail, which #2630 removed (TS2305). #2643 fixed it on main as e35103a2d. Rebase onto main to clear those checks. ci / required failed only because those two did.

@sentry-junior

sentry-junior Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Closing unmerged: the handoff eval goes away with the handoff/turn router removal, so this fix is no longer needed.

The multi-request recall gap from #2585 stays open. The full eval message scored 0.475 and "Gut check" scored 0.856, against the 0.55 cutoff. @thomasjiangcy owns that as its own fix, with a multi-request memory eval case.

@sentry-junior sentry-junior Bot closed this Nov 4, 2026

This branch was successfully deployed

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

Labels

trigger-evals Run evals on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant