Skip to content

fix(tui): stop long-lived timer thread accumulation#558

Open
cbusillo wants to merge 2 commits intojust-every:mainfrom
cbusillo:fix/tui-rate-limit-refresh-scheduler
Open

fix(tui): stop long-lived timer thread accumulation#558
cbusillo wants to merge 2 commits intojust-every:mainfrom
cbusillo:fix/tui-rate-limit-refresh-scheduler

Conversation

@cbusillo
Copy link

Summary

  • stop leaked composer animation threads when the composer is dropped
  • replace rate-limit reset sleeper threads with a tracked cancellable Tokio task
  • add regression coverage for both thread accumulation paths

Why

Recent Every Code crash logs showed the TUI exhausting the 32-thread lightweight background pool over long-lived sessions. The original composer cleanup fixed one real leak, but fresh logs still showed saturation with rate-reset-refresh participating as a second long-lived sleeper path. This PR fixes both accumulation sites together.

Validation

  • cargo test -p code-tui drop_stops_running_animation_thread -- --nocapture
  • cargo test -p code-tui repeated_rate_limit_reschedules_do_not_consume_lightweight_threads -- --nocapture
  • PROFILE=release-prod ./build-fast.sh

Runtime check

  • ran the patched release-prod binary locally
  • observed a live t3code session on the new build run for about 3 hours with no new background thread spawn rejected entries after session start in ~/.code/debug_logs/critical.log.2026-03-10
  • note: the older vulnerable build could still survive for hours depending on workload, so this soak is supporting evidence rather than a proof by itself

@cbusillo cbusillo marked this pull request as draft March 10, 2026 02:55
@cbusillo cbusillo marked this pull request as ready for review March 10, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant