Skip to content

fix: HTTP BGE rerankers ignore configured bearer token #2625

Open

Description

@Elon-Jiang

Pre-submission checklist

  • Searched existing Issues, open PR files, and reranker history for this behavior.
  • Checked the documented token contract 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.0

The 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.lock using Poetry 2.2.1 with dev/test groups
  • Actual constructors, factory, ranking strategies, request serialization, and response handling run. Only requests.Session.send supplies 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_extra overrides.

Prepared with AI assistance; no personal agreement or human-review attestation is implied.

Activity

  1. added
    area:core
    status:in-progress
    types:bug
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:corestatus:in-progresstypes:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions