Repository navigation
fix(retrievers): fall back after blank normalization - #2105
assafelovic merged 1 commit into
Conversation
There was a problem hiding this comment.
🟢 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
left a comment
There was a problem hiding this comment.
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!
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:
🤖 Assisted by OpenAI Codex.