papertrail/backend/engines/gpt-researcher/PR_pr_fix-brave-snippet-bypasses-scraper.md
caelum0x 174222bcaa feat: Builder-Track named-user tools, bio + evidence-intelligence platform, Apache-2.0
Builds PaperTrail from the base skeleton into a full evidence-verification platform
for the "Built with Claude: Life Sciences" hackathon (Builder Track).

New named-user features (Build Beyond the Bench):
- Lab Notebook Companion — rough bench notes -> structured, searchable, grounded
  experiment records (lib/labNotebook, /console/lab-notebook, migration 0059)
- Clinical Trial Matcher — de-identified patient notes -> ranked eligible
  ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning
  (lib/trialMatcher, /console/trial-matcher, migrations 0060)

Platform:
- Deterministic verification moat (biostats recompute, exact-span grounding)
- 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar,
  PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier)
- Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise
  governance (RBAC, /api/v1 gateway, metering, audit chain, retention)
- 17 OSS projects assimilated into native TypeScript on our stack (backend/engines
  retained + credited in NOTICE)
- Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site
- Next.js 16 upgrade, benchmark harness (honest smoke-test caveat)

Licensing: Apache-2.0 (LICENSE + NOTICE).
2026-07-10 16:23:13 +03:00

36 lines
1.5 KiB
Markdown

# One-line summary
Fix Brave search result classification so snippet-only results are sent to the scraper instead of being treated as already-fetched full content.
## Problem
Brave search results populate `body` with snippet text, not full-page content. In `ResearchConductor._search_relevant_source_urls()`, results were classified as already-fetched whenever `len(raw_content) > 100`, where `raw_content` fell back to `result["body"]`. That caused Brave results with long snippets to bypass scraping entirely.
In the failing reproduction, this manifested as every sub-query logging **"Scraping content from 0 URLs"** because all Brave hits were treated as prefetched content before the scraper ever saw them.
This PR intentionally contains only the snippet-classification fix. The separate scraped-count tracking used by local safeguard logic belongs to the safeguards PR, not this one.
## Solution
- Stop treating `body` as full page content in `_search_relevant_source_urls()`
- Use only explicit `raw_content` to identify retriever results that already contain full text
- Leave snippet-only results in the URL list so the normal scraper path runs
- Add focused tests covering:
- snippet-only retriever results are queued for scraping
- explicit `raw_content` results remain prefetched
## Testing
Verified locally with:
- `uv run python -c "from gpt_researcher.skills.researcher import ResearchConductor; print('ok')"`
- `uv run python -m unittest tests.test_research_conductor_retrieval`
## Breaking changes
None.
## Related issues
- Potentially related: #1263