A site that blocks automated readers usually does it politely. The request succeeds, the status is 200, and the body says "checking your browser". A language model handed that body will extract a brand from it. The gate exists so that the extractor never sees a page that is not the page.

The problem

Two of the ten failures found in the old onboarding flow were about this.

  • A subpage returned a 403 or a bot-check body, and that body went into the extractor’s input and into the list of sources.
  • A page that needed JavaScript returned an almost empty shell, and the readout reported success with nothing in it.

In both cases the fetch layer had done its job. It returned what the server sent. What was missing was a judgement about whether the text is the site’s content at all, made before anything downstream could treat it as evidence.

Seven outcomes, in order

Seven checks in order. blocked: host or redirect not allowed. not_html: content type is not text. fetch_failed: any error, or status 0. http_error: status 400 or above. challenge: bot-check phrases, and under 2,000 characters of text. thin: under 120 characters, or a JavaScript shell under 600. ok: normalised, chunked and sent to the extractor. A stored page records status and time always, and text and chunks only if ok. Notes say a page that cannot be read keeps what it had, pages not visited in this run are untouched, and a 200 response with a bot-check body is not evidence. Root page thin or challenged ends the readout as no_content, any other failed root as no_site, and a failed subpage as partial.
Figure 1. The gate. The first four outcomes are refusals by the network or the server. The next two are pages that answered with nothing useful. Only the last is evidence.

The whole gate is one function.

def assess(page: FetchedPage, text: str) -> PageOutcome:
    if page.error_kind in ("blocked_host", "redirect_blocked"):
        return "blocked"
    if page.error_kind == "non_text" or is_non_text(page.headers.get("content-type", "")):
        return "not_html"
    if page.error or page.status_code == 0:
        return "fetch_failed"
    if page.status_code >= 400:
        return "http_error"
    head = text[:2000]
    if _CHALLENGE.search(head) and len(text) < 2000:
        return "challenge"
    if len(text) < MIN_PAGE_CHARS or (_JS_SHELL.search(head) and len(text) < 600):
        return "thin"
    return "ok"
OutcomeRuleWhy it is separate
blockedthe fetch layer refused the host or a redirecta safety refusal on our side, not a fact about the site
not_htmlthe content type is not texta PDF or an image is not read by this pipeline
fetch_failedany transport error, or no statusthe network, not the page
http_errorstatus 400 or abovethe server said no
challengebot-check phrases in the first 2,000 characters and fewer than 2,000 characters in totalthe server said yes and sent something else
thinfewer than 120 characters, or a “JavaScript required” phrase with fewer than 600a shell with no content
oknone of the abovethe only outcome that is evidence

The order matters. A blocked host has no status code worth reading, so it is tested before status. A challenge page can be long if the site wraps it in a normal layout, so the phrase alone is not enough and the length condition keeps a real article that merely mentions “captcha” from being thrown away.

The two patterns are deliberately plain. One looks for the phrases bot-check pages use, such as “verify you are human”, “checking your browser”, “just a moment”, “access denied” and “captcha”, with their Korean equivalents. The other looks for “enable JavaScript” and “JavaScript is required”, also in both languages.

Normalising what passes

The text the gate measures is not the raw HTML. Scripts, styles, navigation, frames, templates and inline graphics are dropped. Headings become lines that start with #, which the chunker later uses as section boundaries. Whitespace is collapsed on each line and consecutive duplicate lines are removed, since menus and footers often repeat.

There is one fallback. If the text built from the document structure is less than half the length of the visible text, the visible text is used instead. Some sites put their content in elements the structural pass skips, and losing half a page silently is worse than keeping some boilerplate.

What happens to the result

A readout reads the home page and up to two more pages of the same owner. The gate’s outcome for each page decides two things: what is stored and how the run ends.

SituationStoredRun ends as
Root page ok, subpages okstatus, text, hash, chunksdone
Root page ok, a subpage not okthe subpage’s status and time onlypartial
Root page thin or challengestatus and time onlyfailed, no_content
Root page anything else not okstatus and time onlyfailed, no_site

A page that was readable last month and is blocked today keeps last month’s text and chunks. The stored status and time change, so the record shows that the latest attempt failed, and the content stays available to generators. A failed fetch is not proof that the content is gone. Pages that were not visited in this run are not touched at all.

When the root page is thin or challenged, the extractor is not called. There is nothing to extract from, and an empty readout reported as “no content” is more useful to the customer than an invented one reported as success.

Failure modes

What goes wrongWhat the gate doesRegression test
A subpage answers 403recorded as http_error, never extractedtest_f7_error_subpage_is_recorded_but_never_extracted
A bot check arrives with status 200challenge, not evidencetest_challenge_page_with_200_is_not_evidence
The page is a JavaScript shellthin, the run ends no_content, the extractor is skippedtest_f8_js_shell_is_no_content_and_skips_extraction
The root page cannot be fetchedthe run ends no_sitetest_no_site_when_root_fails
A page that was readable fails on re-readthe earlier text and chunks are kepttest_failed_reread_keeps_previous_text_and_chunks
Extraction returns nothing that survives verificationthe run ends no_contenttest_extraction_with_nothing_grounded_is_no_content

Limits I know about

The gate recognises challenges by phrase. A bot check with unfamiliar wording and a long body passes as ok, and its text reaches the extractor. The quote check downstream limits the damage, since a value needs a quote found in a page, but a challenge page is a page. The patterns have to be extended as new wording appears.

The design specifies more than the code does here. It describes a source status of “unknown” for a page that could not be read and a rule that retires a page only after two consecutive “gone” responses. Neither exists. Today a source keeps its last good content indefinitely, which is safe against a temporary block and wrong for a page the brand deleted on purpose.

A superseded run’s pages are stored before its result is refused. That is harmless, since the pages are real observations of the site, but it means the store can hold a reading that no accepted extraction was based on.