Skip to content

Prevent unified research search from stalling on slow providers - #55

Draft
universea with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-research-interrupted-issue
Draft

Prevent unified research search from stalling on slow providers#55
universea with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-research-interrupted-issue

Conversation

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown

Some search_papers requests could hang long enough for Claude Desktop to report an interrupted response, causing the research flow to stop. This change makes unified search resilient to slow/hanging upstream connectors by failing slow sources independently and returning partial results.

  • Per-source timeout isolation in unified search

    • Added SEARCH_PAPERS_SOURCE_TIMEOUT_SECONDS and _run_search_with_timeout(...) in paper_search_mcp/server.py.
    • Wrapped each source task in search_papers(...) with asyncio.wait_for(...).
    • On timeout, the source is recorded in errors and contributes 0 results, while other sources continue and return normally.
  • Behavioral coverage for timeout path

    • Added tests/test_search_papers_timeout.py with focused async tests:
      • one source times out while another succeeds (partial results preserved),
      • normal non-timeout path remains unchanged.
async def _run_search_with_timeout(source_name: str, search_task):
    try:
        return await asyncio.wait_for(search_task, timeout=SEARCH_PAPERS_SOURCE_TIMEOUT_SECONDS)
    except asyncio.TimeoutError as exc:
        raise TimeoutError(
            f"search for source '{source_name}' timed out after {SEARCH_PAPERS_SOURCE_TIMEOUT_SECONDS} seconds"
        ) from exc

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.archives-ouvertes.fr
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • api.base-search.net
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • api.biorxiv.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • api.crossref.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • api.medrxiv.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • api.openaire.eu
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • api.semanticscholar.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • citeseerx.ist.psu.edu
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • dblp.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • doaj.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • eprint.iacr.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • eutils.ncbi.nlm.nih.gov
    • Triggering command: /usr/bin/python python - (dns block)
  • export.arxiv.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
    • Triggering command: /usr/bin/python python - (dns block)
  • scholar.google.com
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • sci-hub.se
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)
  • zenodo.org
    • Triggering command: /usr/bin/python python -m unittest discover -s tests -p test_*.py -q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 16, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix research interrupted issue in Claude desktop program Prevent unified research search from stalling on slow providers Apr 16, 2026
Copilot AI requested a review from universea April 16, 2026 14:32
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.

research interrupted issue

2 participants