Before submitting#
Area#
apps/web
Steps to reproduce#
- Open a thread with substantial tool/activity history.
- Start a turn and let updates pause for 500 ms.
- Observe
EnvironmentCacheStore.saveThread receive the complete thread snapshot. Disposing the thread state writes it again.
A deterministic repro initializes makeEnvironmentThreadState with a running cached thread, advances TestClock by 500 ms, and observes saveThread.
Expected behavior#
Do not encode or write full cache snapshots during an active turn. Persist once the session settles.
Actual behavior#
Each quiet interval can encode and write the full retained thread, causing increasing allocation, garbage-collection, and UI latency as history grows.
Measured on one affected thread:
- 8,342 activities / approximately 78 MiB of payload data
- Cache encoding: 111 ms versus 1.16 ms for a fresh thread
- Cache loading/parsing: 118 ms versus 1.3 ms for a fresh thread
Provider streaming remained comparable to a fresh session. This is distinct from #2761, which concerns remote WebSocket congestion.
Impact#
Major degradation or frequent failure
Version or commit#
main at ecb35f758
Environment#
T3 Code desktop/nightly, Windows 11 with WSL2, Node.js 24.16.0, Codex provider.
Logs or stack traces#
No exception is thrown. The failure is repeated full-history encoding and allocation pressure.
Screenshots, recordings, or supporting files#
A deterministic regression test is included in the linked fix.
Workaround#
Start a fresh thread before tool/activity history becomes large.