Skip to content

feat(papers): local-first live search, confirmed + faster#313

Merged
neuromechanist merged 3 commits into
developfrom
feature/issue-312-live-search-ux
Jun 5, 2026
Merged

feat(papers): local-first live search, confirmed + faster#313
neuromechanist merged 3 commits into
developfrom
feature/issue-312-live-search-ux

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Addresses dogfooding feedback on the live paper search (#308): it felt slow and got invoked too eagerly, leaving the user waiting with no warning. Closes #312.

Changes

  1. Local-first + explicit confirmation. The tool description and EEGLAB prompt now require the agent to search the local indexed library first, then offer a live search and wait for the user to confirm before running it. It must never call the live tool as the first action on a paper question.
  2. Announce the wait. When the user confirms, the agent says "OK, let me search through the latest literature - this might take a minute." before invoking it.
  3. Much faster. Live search now queries OpenAlex only (LIVE_SOURCES) instead of also waiting on Semantic Scholar (~1 req/s) and PubMed. Measured ~0.6s vs the previous multi-source wait. Default timeout tightened to 15s. Batch sync still uses all three sources for coverage.

Interaction (intended)

User: what are the latest papers on ICLabel?
Assistant: [calls search_eeglab_papers] Here's what's in our library: ... I can also search the latest literature - it takes about a minute. Want me to?
User: yes
Assistant: OK, let me search through the latest literature - this might take a minute. [calls search_eeglab_papers_live]

Tests

  • search_papers_live gains a sources arg (defaults to LIVE_SOURCES); timed live call returns 2026 papers in ~0.6s.
  • 242 tool/knowledge tests pass (incl. live network + cache); EEGLAB config validates with the new prompt; ruff clean.

Builds on #310.

Dogfooding showed live search felt slow and fired too eagerly.

- Live search now queries OpenAlex only (LIVE_SOURCES) instead of also
  waiting on Semantic Scholar (~1 req/s) and PubMed; latency drops from
  ~tens of seconds to ~1s. Batch sync still uses all three.
- Lower default timeout to 15s.
- Tool description + EEGLAB prompt require local-first: always search the
  indexed library first, OFFER a live search and wait for confirmation,
  and announce 'this might take a minute' before running it. Never call
  the live tool as the first action on a paper question.

Closes #312
…ming

Address PR review: a tool description can't enforce pre-call sequencing,
so phrase the announce guidance as 'when you call it, your message in that
turn should first tell the user...' - matters most for communities that
rely on the description without extra prompt guidance.
@neuromechanist

Copy link
Copy Markdown
Member Author

Review (Sonnet, pr-review-toolkit) + resolution

No critical issues. Confirmed solid: LIVE_SOURCES is an immutable tuple (safe default); sources threads through correctly; sync_all_papers still uses all 3 DEFAULT_SOURCES (no cross-contamination); timeout arithmetic fine; sort="year" recency preserved with OpenAlex-only; YAML structure valid with no leftover 'call live directly' examples; existing live/cache tests remain valid.

One 'important' finding addressed: the tool description's 'before calling it, tell the user...' implied pre-call sequencing a tool description can't enforce. Reworded to 'when you call it, your message in that turn should first tell the user...', matching the YAML framing - matters for communities that rely on the description without extra prompt guidance.

32 tool tests pass; ruff clean.

silent-failure-hunter:
- narrow live-search error handling: APIKeyError/ConfigurationError -> error
  log, OpenCiteError -> warning, both return []; let programming errors
  propagate instead of masquerading as 'no results'.
- escalate cache-write failure to logger.error(exc_info=True) (a lost cache
  write is a real degraded state).
- tool 'no results' message no longer falsely implies a timeout.

comment-analyzer:
- correct overstated duration: ~15s cap, not 'a minute' (tool description +
  EEGLAB prompt say 'a few seconds').
- tighten DEFAULT_SOURCES/LIVE_SOURCES rationale comments.

pr-test-analyzer:
- add TestSourceConstants (live = OpenAlex-only, strict subset of batch
  sources); exercise the new sources param + production timeout in the live
  test.
@neuromechanist

Copy link
Copy Markdown
Member Author

Full PR-review-toolkit pass (Sonnet) - all findings addressed

Ran code-reviewer + silent-failure-hunter + pr-test-analyzer + comment-analyzer.

silent-failure-hunter

  • Broad except Exception hid config + programming errors as empty results. Now: APIKeyError/ConfigurationError -> logger.error + []; OpenCiteError (transient/rate-limit) -> warning + []; other exceptions propagate instead of looking like 'no papers'.
  • Cache-write failure logged too quietly. Escalated to logger.error(..., exc_info=True) - a lost cache write is a real degraded state.
  • Tool message falsely implied a timeout for genuine empties. Reworded.

comment-analyzer

  • 'up to a minute' overstated the 15s cap ~4x. Corrected to '~15 seconds' (tool description) / 'a few seconds' (prompt). Note: this softens the literal 'a minute' wording from the original ask, since live search is now ~1-5s; happy to revert if preferred.
  • Tightened DEFAULT_SOURCES/LIVE_SOURCES rationale comments (peer-reviewed focus; server-side recency sort).

pr-test-analyzer

  • Added TestSourceConstants: live = OpenAlex-only and a strict subset of batch DEFAULT_SOURCES (guards the core contract deterministically).
  • Live test now passes sources explicitly + the production 15s timeout.

code-reviewer (earlier): description sequencing wording aligned with prompt.

31 offline + 1 live + 33 tool/config tests pass; ruff clean.

@neuromechanist neuromechanist merged commit 714e44f into develop Jun 5, 2026
7 checks passed
@neuromechanist neuromechanist deleted the feature/issue-312-live-search-ux branch June 5, 2026 09:15
@neuromechanist neuromechanist mentioned this pull request Jun 8, 2026
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.

1 participant