fitPageContent() in content.js: 6 progressive collapse stages (dedup, nav links, references, lists, code blocks, sidebar debris) before hard truncation. No summarization, real content structurally compressed. Wired into both page extraction points in embed modal. Added .working pulse and .uncloseai-spinner CSS animations for #004. Updated tickets #001 (CSP root cause), #004 (CSS ready), #005 (fixed).
2.8 KiB
005: Context overflow causes blank or hallucinated responses
Reporter: cthegray Date: 2026-03-03 Priority: high Status: open Affects: All platforms, chat quality
Description
When the context window fills up (long pages injected as context), the model either:
- Returns completely blank responses (silent failure, nothing displayed)
- Starts hallucinating about unrelated content, specifically talking about the uncloseai.com page itself or the Nous Research page
Reproduction
- Navigate to a very long page (e.g., Wikipedia's Napoleon article)
- Use the page-read feature to inject the page content as context
- Ask a question about the page
- Response is either blank or talks about uncloseai/Nous Research instead of the page content
Analysis
The page content is likely exceeding the model's max_model_len (context window). When this happens:
- The API may return an error that the client silently swallows (blank response)
- The context may be truncated in a way that drops the user's page content but keeps the system prompt and uncloseai UI text, causing the model to talk about those instead
- The Nous Research hallucination suggests the model's training data is bleeding through when it has no useful context to work with
Possible fixes:
- Check page content length before injection, truncate intelligently if it exceeds the model's
max_model_len(available from/v1/modelsdiscovery) - Show a user-facing warning when context is too long: "This page is too long, content has been trimmed"
- Implement chunked summarization for long pages (summarize in sections, then inject summaries)
- Never silently swallow API errors: if the completion fails, show the error to the user
- Prioritize user message and page content over system prompt when truncating
Fix Implemented
Smart content collapsing in content.js via fitPageContent(). Progressive stages run in order of aggressiveness, stopping when content fits:
- Deduplicate paragraphs: remove exact duplicate blocks (common in scraped DOM)
- Collapse nav links: 5+ consecutive links become
[Navigation: N links including ...] - Collapse references: dense URL/citation clusters become
[... N references collapsed] - Collapse lists: 7+ item lists keep first 5, note
[... N more items] - Collapse code blocks: 12+ line blocks keep first 10, note
[... N more lines] - Collapse sidebar debris: runs of 6+ short fragments get compressed
- Hard truncate: last resort, cuts at paragraph/sentence boundary
No summarization. All content stays real, just structurally compressed. Uses max_model_len from model discovery with 15k token overhead reserved for system prompt, computed intel, chat history, and output.
Notes
Hermes bumped to 82k context. Wikipedia Napoleon (~67k tokens) should fit after collapsing without hard truncation.