Skip to content

fix(retrievers): fall back after blank normalization - #2105

Merged
assafelovic merged 1 commit into
assafelovic:mainfrom
remote-controlled-man:fix/blank-retriever-fallback-2094
Sep 26, 2026
Merged

assafelovic merged 1 commit into
assafelovic:mainfrom
remote-controlled-man:fix/blank-retriever-fallback-2094

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

Fixes #2094

get_retrievers() selects a truthy raw header or configuration value before normalization. When that value contains only commas and whitespace, normalization removes every entry and the function returns an empty list, leaving downstream search paths without a usable retriever.

This change applies the default fallback after normalization whenever no retriever names remain. Existing selection priority and invalid non-empty name behavior remain unchanged.

Verification:

  • Extended the existing whitespace tests across plural and singular headers, configuration values, absent selections, valid selections, and invalid names.
  • Related offline suite: 13 passed.
  • Python compilation checks passed.

🤖 Assisted by OpenAI Codex.

Copilot AI lite review requested due to automatic review settings September 6, 2026 17:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is minimal, directly addresses the reported failure mode, and includes targeted regression tests that cover the new behavior and key existing behaviors.

Pull request overview

This PR fixes a bug in get_retrievers() where an explicit-but-all-blank header/config value (e.g., " , , ") would be treated as a selection, then fully normalized away, resulting in an empty retriever list rather than falling back to the default retriever.

Changes:

  • Apply the default retriever fallback after normalization when no retriever names remain.
  • Extend whitespace-related regression tests to cover blank plural/singular headers, blank config values, absent selection, and invalid names.
File summaries
File Description
gpt_researcher/actions/retriever.py Adds a post-normalization fallback to ensure get_retrievers() never returns an empty list for all-blank selections.
tests/test_get_retrievers_whitespace.py Expands coverage to confirm blank selections fall back to the default and existing behaviors remain intact.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@assafelovic assafelovic left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and tested: applied on current main individually and together with this round's other fixes, full offline suite green on Python 3.12 and 3.14, plus a live research run compared against main. Thank you!

@assafelovic
assafelovic merged commit 5b6c046 into assafelovic:main Sep 26, 2026
9 checks passed
@remote-controlled-man
remote-controlled-man deleted the fix/blank-retriever-fallback-2094 branch October 13, 2026 01:28
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.

Bug: an all-blank retrievers header bypasses the default retriever

3 participants