Trim history.jsonl when history.max_bytes is set (#6242)

This PR honors the `history.max_bytes` configuration parameter by
trimming `history.jsonl` whenever it grows past the configured limit.
While appending new entries we retain the newest record, drop the oldest
lines to stay within the byte budget, and serialize the compacted file
back to disk under the same lock to keep writers safe.
This commit is contained in:
liam
2025-12-02 17:01:05 -05:00
committed by GitHub
parent 77c457121e
commit 4d4778ec1c
4 changed files with 319 additions and 80 deletions

View File

@@ -124,7 +124,7 @@ experimental_use_profile = false
[history]
# save-all (default) | none
persistence = "save-all"
# Maximum bytes for history file (currently not enforced). Example: 5242880
# Maximum bytes for history file; oldest entries are trimmed when exceeded. Example: 5242880
# max_bytes = 0
# URI scheme for clickable citations: vscode (default) | vscode-insiders | windsurf | cursor | none