Bound TUI thread replay buffers by delta size (#39081)

## Why

The per-thread replay buffer limited its event count, but streamed agent-message
deltas could still retain an unbounded amount of text while a thread was
inactive.

## What changed

- Coalesce adjacent deltas for the same thread, turn, and item into chunks of up
  to 4 KiB.
- Limit buffered agent-message deltas to 256 KiB, discard a single delta larger
  than that limit, and evict the oldest events when either buffer limit is
  exceeded.
- Keep pending input and approval state in sync when eviction removes the
  corresponding request, including clearing side-thread status indicators.

## Testing

Added coverage for delta coalescing, byte-based eviction, oversized deltas,
replaying only retained text, and side-thread status updates after eviction.

GitOrigin-RevId: 88d85353a124467d467822d2fd9854312b68d547
This commit is contained in:
Tamir Duberstein authored and copyberry committed 2026-08-17 21:03:06 +00:00
1 parent 8ef139667f
commit 9c099e94a2
7 files changed
+496 -43

No files matched your search

+1
View File
@@ -229,6 +229,7 @@ mod session_lifecycle;
mod side;
mod startup;
mod startup_prompts;
mod thread_event_buffer;
mod thread_events;
mod thread_goal_actions;
mod thread_routing;