Skip to content

fix: honor bearer tokens in HTTP BGE rerankers - #2626

Merged
endxxxx merged 2 commits into
MemTensor:dev-v2.0.37from
Elon-Jiang:fix/bge-reranker-token
Nov 18, 2026
Merged

endxxxx merged 2 commits into
MemTensor:dev-v2.0.37from
Elon-Jiang:fix/bge-reranker-token

Conversation

@Elon-Jiang

@Elon-Jiang Elon-Jiang commented Nov 17, 2026 •

Copy link
Copy Markdown

Description

Fixes #2625.

Configuring token on either HTTP BGE reranker currently sends no Authorization header. Protected endpoints return 401 and the reranker silently falls back to the original order with zero scores. Both constructors already document bearer authentication.

Add the bearer header when the token is nonempty, preserve explicit headers_extra overrides, and forward the existing option through RerankerFactory.from_config for both variants. No dependencies or API signatures change.

Type of change

  • Bug fix (non-breaking)

How Has This Been Tested?

  • Unit tests: poetry run pytest tests/reranker/ -q — 36 passed.
  • Regression steps: the new parameterized public-interface test fails 4 cases on unchanged main and passes all 12 with this fix. It covers constructors/factory, both rerankers, bearer auth, no-token requests, case-insensitive explicit authorization overrides, unchanged extra headers, and actual relevance ordering.
  • make format — passed (643 files checked/formatted).

The test runs real factory/constructor, strategy, ranking, Requests serialization/prepared headers and error handling. Only requests.Session.send is replaced with a controlled HTTP response that rejects missing authentication; no hosted model service was called.

Full suite: HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 make test — 1,017 passed, 9 skipped, 38 warnings. All optional dependencies were installed from the lockfile. The offline flags avoid downloading the unrelated Qwen example model in test_load_with_real_directory; no live-model success is claimed. The initial unrestricted run was interrupted while loading that example (472 passed, 8 skipped); the initial dev/test-only collection lacked optional Torch. Applicable actual commit hooks also pass.

Checklist

  • Reviewed the focused diff and public behavior using AI assistance; no human review is claimed.
  • Added a test comment describing the controlled HTTP boundary.
  • Added regression tests.
  • Documentation issue/PR: not applicable; existing token documentation already specifies the intended behavior.
  • Linked the related Issue.
  • Reviewer: no specific maintainer has been requested; available for project review.

Reviewer Checklist

Left for the reviewer; upstream checks and maintainer acceptance are pending.

AI assistance was used for investigation, implementation and local validation.

@Memtensor-AI Memtensor-AI added area:core MOS 编排层 / 框架底座 / 跨模块问题 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Nov 17, 2026
@Memtensor-AI

Memtensor-AI commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2626
Task: c8894137dee0a979
Base: main
Head: fix/bge-reranker-token
Head SHA: 8f109c13d5d3ab46cbf20ae1fdd1fc614e3d6757

✅ OpenCodeReview: Review complete: 0 finding(s) across 4 selected item(s).

Generated by cloud-assistant via Open Code Review.

@Memtensor-AI Memtensor-AI added status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发 and removed status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Nov 17, 2026
@Memtensor-AI Memtensor-AI added status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 and removed status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发 labels Nov 18, 2026
@endxxxx

endxxxx commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for wiring the configured Bearer token through both HTTP BGE rerankers. I pushed a follow-up in 8f109c1 to prevent Requests from replacing the configured token with Basic auth from .netrc when preparing the initial request. An explicit Authorization header in headers_extra still takes precedence, and requests without a configured token retain their existing behavior. I added regression coverage for both rerankers, and all 48 reranker tests passed on the development branch.

@endxxxx
endxxxx changed the base branch from main to dev-v2.0.37 November 18, 2026 12:08
@endxxxx
endxxxx merged commit 27230ef into MemTensor:dev-v2.0.37 Nov 18, 2026
13 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core MOS 编排层 / 框架底座 / 跨模块问题 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: HTTP BGE rerankers ignore configured bearer token

4 participants