Repository navigation
Description
Pre-submission checklist
- Searched existing Issues, open PR files, and reranker history for this behavior.
- Checked the documented
tokencontract on both HTTP rerankers. - The failure is in MemOS request construction.
Bug Description
HTTPBGEReranker and HTTPBGERerankerStrategy both document token as a Bearer token added to Authorization, but only store it. Neither uses it when making the request. RerankerFactory.from_config also does not forward the option.
As a result a protected reranking endpoint receives no authentication despite a configured token, returns 401, and reranking falls back to the original candidates with zero scores.
How to Reproduce
On main 3a16e5fe3048a209f722806f4123fa2e533588fd, configure an HTTP BGE reranker with token="test-token" and call the public rerank method with two nonempty memories. Observe the outgoing prepared request:
import json
from unittest.mock import patch
import requests
from memos.reranker.http_bge import HTTPBGEReranker
def send(session, request, **kwargs):
print(request.headers.get("Authorization")) # None; expected Bearer test-token
response = requests.Response()
response.request = request
response.url = request.url
response.status_code = 401
response._content = b'{}'
return response
with patch.object(requests.Session, "send", send):
ranked = HTTPBGEReranker("https://reranker.example.test/rerank", token="test-token").rerank(
"query", [{"memory": "first"}, {"memory": "second"}], top_k=2
)
print(ranked) # original order, both scores 0.0The same failure occurs via RerankerFactory.from_config and with the strategy variant. A regression matrix across both construction routes and both implementations fails four token cases on baseline; eight no-token/explicit-header controls pass.
Environment
- macOS, Python 3.12.13, MemoryOS 2.0.36
- Project installed from
poetry.lockusing Poetry 2.2.1 with dev/test groups - Actual constructors, factory, ranking strategies, request serialization, and response handling run. Only
requests.Session.sendsupplies a controlled HTTP response. No hosted reranker/model was invoked.
Willingness to Implement
- I am working on a focused fix and regression tests for both variants, including forwarding the token from the existing factory configuration and preserving explicit
headers_extraoverrides.
Prepared with AI assistance; no personal agreement or human-review attestation is implied.
Activity