Skip to content

fix(core): widen rerank reads only for rows without a matched chunk - #1758

Merged
phernandez merged 1 commit into
mainfrom
fix/1746-rerank-read-cap
Oct 11, 2026
Merged

phernandez merged 1 commit into
mainfrom
fix/1746-rerank-read-cap

Conversation

@phernandez

Copy link
Copy Markdown
Member

Summary

Follow-up to #1757, which merged one commit before the fix for Codex's finding on it (#1757 (comment)).

#1757 let every rerank prefix row read its note text as far as reranker_max_document_chars. A vector-matched row is reranked on its matched chunks, never its body (rerank_document_text prefers matched_chunk_text). So vector-only search with reranker_max_document_chars=0 or above 4,000 read large note bodies for nothing, which brings back the per-query transfer #1746 removed.

  • _materialize's wider limit is now lexical_snippet_limit. It applies only to rows outside vector_keys: hybrid's full-text-only hits, whose note text is their rerank document.
  • Vector-matched rows always read at SNIPPET_READ_LIMIT, and vector-only search no longer passes a wider limit.
  • _fetch_row_texts returns early for an empty key list, so the split costs no extra session.

Test plan

  • New test_vector_rerank_prefix_keeps_the_read_cap_for_matched_rows: vector search with reranker_max_document_chars=0 and a 135 KB embedded note keeps a 4,000-character read. It fails on main.
  • test_unbounded_reranker_reads_a_lexical_rows_whole_text (from fix(core): read rerank prefix text up to the reranker's document limit #1757) still passes: a full-text-only hit still reaches the reranker past 4,000 characters.
  • just fast-check
  • tests/repository: 1189 passed

🤖 Generated with Claude Code

https://claude.ai/code/session_01EQPZkbnuxxtTEJoNJCkt45

The previous commit read every rerank prefix row's note text as far as
the reranker's document limit. A vector-matched row is reranked on its
matched chunks, never its body, so vector-only search with an unbounded
limit read large note bodies for nothing, the transfer #1746 removed.
Only rows the vector leg did not match (hybrid's full-text-only hits)
read past the cap now; vector-matched rows always read at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EQPZkbnuxxtTEJoNJCkt45
Signed-off-by: phernandez <paul@basicmachines.co>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T23:10:01.038941Z dad4d76 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@phernandez
phernandez merged commit 27f0770 into main Oct 11, 2026
32 checks passed
@phernandez
phernandez deleted the fix/1746-rerank-read-cap branch October 11, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant