## TL;DR

The agent re-checks the same commit because it never records progress. Keep a cursor of the last checked commit, advance it after each check, and skip already-checked commits.

## Error

```text
scanner agent stuck in a loop re-checking the same commit
```

## Steps

1. Confirm the loop: logs show the same commit hash checked repeatedly. Expected: the stuck cursor (or missing cursor) found.
2. Store a cursor: the last fully checked commit. Expected: durable progress.
3. Advance the cursor only after the check completes and persists. Expected: crashes resume, not repeat.
4. Skip commits at or before the cursor. Expected: forward progress.
5. Alert if the cursor does not advance over several runs. Expected: stuck agents surface.

## When to use

- Agents stuck re-checking commits.
- Building commit-walking agents.

## When not to use

- Checks failing (fix the check).
- The commit keeps changing (then re-checking is correct).

## Tool compatibility

- Commit cursors; agent schedulers.

## Variant phrasings

### agent stuck on one commit

Advance a cursor.

### re-checking same commit

Record progress.

## Why it happens

Without a persisted cursor, every run starts from the same place and repeats the same work.

## Edge cases

- Rebased history moves commits; cursors keyed by hash need rebase handling.
- Partial checks must not advance the cursor; only completed ones.
- Multiple agents need cursor coordination or they duplicate work.

## Provenance

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