Repository navigation
fix(research): preserve complementary web context - #2104
assafelovic merged 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change directly addresses the reported string-joining bug and includes targeted regression tests for the key behavioral branches.
Pull request overview
Fixes a bug in ResearchConductor.conduct_research() where complementary web-search context (a string) was mistakenly treated as an iterable of characters via " ".join(additional_research), corrupting the stored/returned research context.
Changes:
- Combine URL-derived context and complementary web-search context by joining the two non-empty strings with a single boundary.
- Add regression tests covering: non-empty complementary context, empty complementary result, and complementary search disabled.
File summaries
| File | Description |
|---|---|
gpt_researcher/skills/researcher.py |
Fixes context concatenation to avoid character-splitting corruption and ensures a single boundary between non-empty parts. |
tests/test_research_conductor_complement_context.py |
Adds parametrized async regression coverage for the complementary-context concatenation behavior. |
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 #2093
ResearchConductor.conduct_research()receives both URL-derived context and complementary web-search context as strings. The current implementation applies" ".join(...)to the complementary string, inserting spaces between every character before assigning the result toresearcher.context.This change joins the two non-empty context strings directly with a single boundary. It preserves the original URL context when complementary search returns no context and leaves the non-complementary path unchanged.
Verification:
🤖 Assisted by OpenAI Codex.