Skip to content

fix(research): preserve complementary web context - #2104

Merged
assafelovic merged 1 commit into
assafelovic:mainfrom
remote-controlled-man:fix/complementary-context-2093
Sep 26, 2026
Merged

assafelovic merged 1 commit into
assafelovic:mainfrom
remote-controlled-man:fix/complementary-context-2093

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

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 to researcher.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:

  • Added regression coverage for non-empty, empty, and disabled complementary search paths.
  • Related offline suite: 15 passed.
  • Python compilation checks passed.

🤖 Assisted by OpenAI Codex.

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

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 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 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 77114db into assafelovic:main Sep 26, 2026
9 checks passed
@remote-controlled-man
remote-controlled-man deleted the fix/complementary-context-2093 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: complementary web context is split into space-separated characters

3 participants