# fix\(providers\): keep Pi turn refs honest after a failed entry capture · stienswout/t3code

[View on GitCafe](https://git.cafe/stienswout/t3code/commit/9a29151c60fed43c93c83faa46ce7089fc0dc6af)

Repository: [stienswout/t3code](https://git.cafe/stienswout/t3code)

Visibility: public

Requested revision: 9a29151c60fed43c93c83faa46ce7089fc0dc6af

Requested commit: 9a29151c60fed43c93c83faa46ce7089fc0dc6af

Commit: 9a29151c60fed43c93c83faa46ce7089fc0dc6af

Tree: 7b1ea3f280faaae693c3c354aa0e390fdfd167c0

Author: Wout Stiens

Committer: Wout Stiens

## Message

```
fix(providers): keep Pi turn refs honest after a failed entry capture

Two review findings on the session-tree work:

- When `get_entries` failed, `lastKnownLeaf` was left pointing at an entry
  Pi may have already advanced past. The next successful capture then used
  that stale `since` cursor, so its window spanned several turns and the
  first user entry it found belonged to an earlier one, aiming rollback too
  far back. A failed capture now marks the cursor stale; the next capture
  re-syncs it and skips the turn-start ref for that one turn instead.
- Log only the length of pi's stderr. The chunk is unbounded remote output
  and can carry credentials or prompt text, matching the `stderrLength`
  form used elsewhere in the server.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

```

## Parents

- [ccd158f63bc0f3e873ab8d16e9799b0f8f32abe0](https://git.cafe/stienswout/t3code/commit/ccd158f63bc0f3e873ab8d16e9799b0f8f32abe0?format=markdown)

[Source at this commit](https://git.cafe/stienswout/t3code/tree/9a29151c60fed43c93c83faa46ce7089fc0dc6af?format=markdown)
