# perf\(server\): bound terminal history by bytes \(\#9748\) · gitcafe/t3code

[View on GitCafe](https://git.cafe/gitcafe/t3code/commit/cf9729d5ee9660c08556e823080d3bb19648ed28)

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

Visibility: public

Requested revision: cf9729d5ee9660c08556e823080d3bb19648ed28

Requested commit: cf9729d5ee9660c08556e823080d3bb19648ed28

Commit: cf9729d5ee9660c08556e823080d3bb19648ed28

Tree: 68117ec8193cd1221e24940b28a54383b59cc7e9

Author: Theo Browne

Committer: GitHub

## Message

```
perf(server): bound terminal history by bytes (#9748)

Keep at most 5,000 lines and 8 MiB of retained UTF-8 terminal history. Discard the oldest text at either limit while preserving complete live output.

Track bytes and newlines in small chunks. Join split surrogates before eviction. Restore only the needed file tail, handle short reads, and close the file before rewriting current or legacy history.

Created with GPT-6 Astra (preview) in Codex.

Co-authored-by: will <will@moondiner.com>
```

## Parents

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

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