|
| 1 | +# Feature Request: Playwright Fallback for Content Retrieval Failures |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +OpenBrain should use a headless Playwright browser as a fallback when the standard retrieval path fails to return usable content. |
| 6 | + |
| 7 | +## Problem |
| 8 | + |
| 9 | +Some pages are rendered mostly or fully through JavaScript. The current retrieval path can fail on these pages, returning empty or low-value content, which then causes extraction and summarization to fail. |
| 10 | + |
| 11 | +## Why this matters |
| 12 | + |
| 13 | +- Shared links in Discord can fail ingestion even when the page is valid in a normal browser. |
| 14 | +- Community knowledge capture quality drops when JavaScript-heavy sites cannot be indexed. |
| 15 | +- Operators currently have no reliable fallback for blocked or dynamically rendered content. |
| 16 | + |
| 17 | +## Current architecture context |
| 18 | + |
| 19 | +SourceBase (Discord bot) does not implement page retrieval directly. It delegates ingestion to OpenBrain via `ob add`. |
| 20 | + |
| 21 | +Because of this separation, the fallback logic belongs in OpenBrain, not in SourceBase. |
| 22 | + |
| 23 | +## Requested behavior |
| 24 | + |
| 25 | +1. Attempt the current retrieval path first (fast path). |
| 26 | +2. If retrieval or extraction fails due to known failure modes (for example: blocked response, script-rendered content, empty extraction), retry with Playwright. |
| 27 | +3. Feed Playwright-derived HTML/content into the existing extraction flow so downstream behavior stays consistent. |
| 28 | +4. Emit clear telemetry/event data when fallback is used. |
| 29 | + |
| 30 | +## Acceptance criteria |
| 31 | + |
| 32 | +- OpenBrain continues to use the existing retrieval path by default. |
| 33 | +- OpenBrain invokes Playwright fallback only when the fast path fails or yields unusable content. |
| 34 | +- JavaScript-heavy pages that previously failed can now be ingested successfully when fallback is enabled. |
| 35 | +- Timeout and resource controls exist for browser-based fallback. |
| 36 | +- Logs or progress output make fallback activation visible for diagnostics. |
| 37 | +- Automated tests cover success and failure cases for both fast path and fallback path. |
| 38 | + |
| 39 | +## Non-goals |
| 40 | + |
| 41 | +- Implementing custom retrieval logic in the SourceBase Discord bot. |
| 42 | +- Making Playwright the primary path for all URLs. |
| 43 | + |
| 44 | +## Related work |
| 45 | + |
| 46 | +- Work item: Use playright retrieve content if existing retrieval path fails (SB-0MNHOYCUK000RALJ) |
| 47 | +- Historical draft (deleted): Add Playwright fallback for blocked content extraction (SB-0MN4FHM2B0PI69AE) |
0 commit comments