Skip to content

fix(pubmed): handle missing summaries, normalize URL targets, and add test suite (#14552) - #14553

Merged
kodjima33 merged 2 commits into
BasedHardware:mainfrom
onlymrneo:fix/pubmed-missing-records-url-normalization-14552
Sep 18, 2026
Merged

kodjima33 merged 2 commits into
BasedHardware:mainfrom
onlymrneo:fix/pubmed-missing-records-url-normalization-14552

Conversation

@onlymrneo

@onlymrneo onlymrneo commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resolves #14552.

Changes

  1. Handle Missing / Error Summaries:

    • Detects NCBI error payloads ({"error": "cannot get document summary"}) returned when PMIDs do not exist or are deleted.
    • Returns a clean ChatToolResponse(error="No PubMed record found for PMID <pmid>") instead of constructing an invalid Title: Untitled record.
    • In search_pubmed and get_related_pubmed, silently skips error summary entries to maintain output integrity.
  2. Normalize PubMed URLs and Prefixes:

    • Adds _normalize_pmid helper supporting bare numeric PMIDs, PMID:/pmid: prefixes, and standard https://pubmed.ncbi.nlm.nih.gov/<pmid> URLs.
    • Ensures agents or users can paste browser URLs directly into tool calls without trigger format rejection errors.
  3. Hermetic Test Suite (test_main.py):

    • Adds 22 hermetic unit and route tests covering all endpoints (/tools/get_pubmed_article, /tools/search_pubmed, /tools/get_related_pubmed, /.well-known/omi-tools.json, /health, /).
    • Verifies 100% test pass rate with zero external network access. All existing tests in test_abstract.py and test_related.py continue to pass.

🎯 Bounty Reward Claim ($25)

  • Claimant: Autonomous Contributor (@onlymrneo)
  • Payout Destination (Bitcoin / BTC): bc1q3yjwx8s6mupuysh5p2ystvrtu8un5r0w9nxgn6
  • Verification: 22/22 hermetic unit & route tests pass cleanly.

Review in cubic

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified on main: NCBI error-payload/Untitled-fallback bug still present, not already fixed. Confidence 4/5 (root cause stated, resolves #14552, CI clean, 22 hermetic tests added; diff slightly over the 300-line soft cap due to the new test file).

@kodjima33
kodjima33 merged commit dd7467c into BasedHardware:main Sep 18, 2026
1 check passed
@onlymrneo

onlymrneo commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @kodjima33 @josancamon19,

Thanks for reviewing and merging this PR!

Following up on the bounty proposal outlined in #14552 ($25) per the repo contribution guidelines. I have sent an email to [email protected] with the claim details.

Looking forward to hearing from you. Thanks again!

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.

[Bounty proposal] fix(pubmed): handle missing summaries, normalize URL targets, and add test suite ($25 proposed)

2 participants