[Bounty proposal] fix(semantic-scholar): URL normalization, null limit coercion, and connection pooling ($25 proposed)
Author: onlymrneoCreated Sep 18, 2026Updated Sep 18, 2026
Summary
In plugins/omi-semantic-scholar-app, several input edge cases and connection lifecycle gaps degrade chat tool execution:
Semantic Scholar Paper & Author URLs Fail Lookup:
normalize_identifierhandlesdoi.org/andarxiv.org/URLs, but does not recognizesemanticscholar.org/paper/URLs (e.g.https://www.semanticscholar.org/paper/Attention-Is-All-You-Need-Vaswani/204e3073870fae3d05bcbc2f6a8e263c9b72e776orhttps://semanticscholar.org/paper/204e3073870fae3d05bcbc2f6a8e263c9b72e776).- The raw URL string is quoted and forwarded to the Graph API path
/paper/https%3A//..., returning 404 "Paper not found". get_author_paperslacks URL normalization entirely: providing an author profile URL (https://www.semanticscholar.org/author/A.-Vaswani/1741101) orauthor: 1741101fails with 404.
Query Parameters, Fragments, and Enclosing Quotes Corrupt Upstream Queries:
- Browser-copied URLs often retain query strings (e.g.
?utm_source=chat) or fragments (#abstract,#citations). These are currently appended directly to the paper/author path segments, resulting in upstream 404 errors. - Quoted inputs (e.g.
"10.1038/nature12373",<https://arxiv.org/abs/...>) are not stripped before prefixing.
- Browser-copied URLs often retain query strings (e.g.
Backend
nullfor Omitted Optional Parameters Triggers 422 Unprocessable Entity:- In
models.py,SearchPapersRequest.max_resultsandGetAuthorPapersRequest.max_resultsare typedintrather thanOptional[int]. - When the backend sends explicit JSON
nullfor omitted optional fields (e.g.{"query": "attention", "max_results": null}), Pydantic raises a 422 validation error instead of defaulting to5.
- In
Lack of HTTP Client Lifespan Connection Pooling:
api_getinstantiated a freshhttpx.AsyncClienton every tool invocation, creating socket churn and connection overhead under consecutive queries.
Proposed Fix
- Full URL & Target Normalization:
- Add regex extraction for
semanticscholar.org/paper/paths to extract the 40-character hex SHA or CorpusId. - Implement
normalize_author_idto extract author IDs from profile URLs andauthor:prefixes. - Strip query strings (
?), fragments (#), and wrapping quotes/brackets.
- Add regex extraction for
- Defensive Model Coercion:
- Make
max_resultsOptional[int]in request models and clamp/defaultNoneor invalid types to5.
- Make
- Lifespan Connection Pooling:
- Implement FastAPI
lifespancontext manager storingapp.state.client, while preserving a graceful fallback client for unmanaged test contexts.
- Implement FastAPI
- Hermetic Regression Test Suite:
- Expanded hermetic test suite in
plugins/omi-semantic-scholar-app/test_main.pyfrom 46 to 60 tests covering all new normalization patterns, null coercions, and URL targets. All 60 tests pass in 0.07s.
- Expanded hermetic test suite in
Bounty Proposal ($25)
- Proposed Bounty: $25.00 USD (consistent with recent plugin reliability bounties)
- Payout Destination (Bitcoin / BTC):
bc1q3yjwx8s6mupuysh5p2ystvrtu8un5r0w9nxgn6 - PR Status: Ready for immediate submission with hermetic regression tests.
cc @josancamon19 @kodjima33
Source: BasedHardware/omi