## TL;DR

Full history is unbounded work. Bound it with commit ranges, stream findings as they come instead of buffering, and let the agent resume from the last completed commit.

## Error

```text
agent failed to finish the full-history scan: trufflehog timed out with error
```

## Steps

1. Split history into commit ranges the agent processes sequentially. Expected: each range fits the budget.
2. Stream JSON findings per commit instead of collecting everything in memory. Expected: constant memory use.
3. Record the last completed commit as a resume cursor. Expected: timeouts resume, not restart.
4. Skip or sample binary-heavy ranges that slow detectors disproportionately. Expected: the long tail shrinks.
5. Reassemble the streamed findings into the final report. Expected: complete history covered.

## When to use

- Agent trufflehog scans timing out on long histories.
- Building resumable scan agents.

## When not to use

- Authentication failures.
- The scan errors on a specific commit (investigate it).

## Tool compatibility

- Trufflehog git scans; JSON streaming; resume cursors.

## Variant phrasings

### trufflehog full history timeout

Range and resume.

### agent scan of git history never finishes

Same bounding.

## Why it happens

History length times detector cost exceeds any single run budget; without cursors, each timeout restarts from zero.

## Edge cases

- Rewritten history invalidates cursors; detect and restart cleanly.
- Shallow or partial clones change what history exists; document the clone flags.
- Findings order is not stable across runs; dedup by finding id.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_M4UDsY1XHUXdPBLpnbTVZA
