# scan agent timed out on infinite scroll content load - how to fix it

## TL;DR

Cap the scroll: scroll until no new content appears for N consecutive attempts or a max-scroll budget is hit, then scan what loaded. Infinite scroll never settles, so the agent must define done. One line of why: waiting for network quiet on an infinite feed is waiting forever, the agent needs its own termination condition.

## The error, verbatim

```text
ScanAgentError: timed out waiting for infinite scroll to settle after 180s
    url: https://example.com/feed
    scrolls: 47, new_content_last_seen: scroll 12

```

## Fix it step by step

### Step 1: Reproduce the endless scroll

```bash
node agent/run-audit.js --route /feed | rg -i 'scroll|timed out' | head -5
```

Expected: The agent scrolls until its timeout fires.

### Step 2: Confirm content stopped arriving

```bash
node -e "console.log('check: after scroll 12 no new nodes appeared, the agent kept scrolling anyway')"
```

Expected: The log shows new content stopped long before the timeout.

### Step 3: Add the settle condition

```bash
rg -n 'scroll' agent/scanner.js | head -10
```

Expected: Add: stop after 3 scrolls with no new nodes or 25 scrolls max, then scan.

### Step 4: Re-run the audit

```bash
node agent/run-audit.js --route /feed | tail -4
```

Expected: Agent stops scrolling at the settle point and audits the loaded content.

### Step 5: Add a regression probe

```bash
node agent/run-audit.js --smoke | tail -3
```

Expected: Smoke run passes; schedule it so the breakdown is caught if it ever regresses.

## When to use this skill

- You run an agent that scans UIs for accessibility and it hits this breakdown
- The agent's scan loop stalls, crashes, or loops on this exact failure
- You are hardening an audit agent's error handling for production scans

## When NOT to use this skill

- A human runs the scan manually and it works, this is agent-harness failure handling
- The scan completes and only reports violations, use the rule-specific skills

## Compatibility

Scan agent harness with scroll primitives. The settle condition is consecutive no-new-content scrolls plus a max budget. Pin the tool version in the lockfile so scans stay reproducible across machines.

## Variant phrasings

### agent infinite scroll timeout

Same failure, same settle condition.

### scan never finishes on feed page

Practitioner phrasing.

### the breakdown hits other routes too

Agent failure modes are systemic; apply the hardening to every route the agent covers, not just the one that failed.

## Why it happens

Infinite scroll pages load more content as long as the agent scrolls, so any wait-for-settle strategy never settles. Agents that scroll-until-quiet loop until their global timeout. The correct termination is content-based: track node count or item count per scroll, stop after a few scrolls with no growth, and cap total scrolls regardless. The audit then covers a representative sample, and the agent reports how much content it covered. Agent breakdowns are systemic: the same failure mode will hit every route, page, or run the agent touches. Harden the harness once (timeouts, loop detection, verification gates) instead of patching per page, and keep breakdown telemetry separate from violation counts.

## Edge cases

- Report the coverage (items loaded vs estimated total) as audit metadata, a partial audit should say so.
- Virtualized feeds unload off-screen content, scrolling back up loses nodes, snapshot per viewport instead.
- Some feeds load on a timer without scrolling, the no-new-content counter handles those too.
- Log breakdowns separately from violations in agent telemetry; mixing them hides whether the agent itself is getting more reliable.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_3lC1FHWhfYx2l-_Huedc1w
