Skip to content

Conversation

@ConstantinHvber
Copy link

@ConstantinHvber ConstantinHvber commented Jan 2, 2026

Implement fixes to address long-session TUI lag and history-state mismatch degradation.

  • Fix 1: throttle non-forced history snapshot persistence (reduce full snapshot rewrite frequency to 5 secs during rapid UI/progress updates)
  • Fix 2: add a lazy HistoryId→cell-index cache with dirty tracking + self-healing lookups; throttle “history-state mismatch” warnings; adjust tool-card/running-tool resolution to use the new lookup; add regression test to keep the index consistent under churn
  • Fix startup panic: route the “Connecting MCP servers…” notice through the background helper (avoid inserting BackgroundEvent via “prelude” path) and remove the now-unused helper
  • Cleanup: remove non-Linux cgroup stubs and adjust spawn/exec cfg blocks to eliminate macOS warnings

Implement the “testlagfix” work to address long-session TUI lag and history-state mismatch degradation.

  - Fix 1: throttle non-forced history snapshot persistence (reduce full snapshot rewrite frequency during
    rapid UI/progress updates)
  - Fix 2: add a lazy HistoryId→cell-index cache with dirty tracking + self-healing lookups; throttle
    “history-state mismatch” warnings; adjust tool-card/running-tool resolution to use the new lookup; add
    regression test to keep the index consistent under churn
  - Fix startup panic: route the “Connecting MCP servers…” notice through the background helper (avoid
    inserting BackgroundEvent via “prelude” path) and remove the now-unused helper
  - Cleanup: remove non-Linux cgroup stubs and adjust spawn/exec cfg blocks to eliminate macOS warnings
  - Version bump: set build/package version to 0.6.29-testlagfix (Rust workspace + codex-cli npm metadata)
Copilot AI review requested due to automatic review settings January 2, 2026 17:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses TUI performance degradation during long sessions by implementing a lazy HistoryId-to-cell-index cache with dirty tracking and self-healing lookups, throttling history snapshot persistence, and fixing a startup panic related to MCP server connection notices.

Key Changes:

  • Added a lazy HistoryId→cell-index HashMap cache with dirty tracking and automatic rebuild/self-healing to speed up history cell lookups
  • Throttled non-forced history snapshot persistence from 400ms to 5 seconds to reduce I/O during rapid UI updates
  • Fixed startup panic by routing "Connecting MCP servers…" notice through the background helper instead of creating a special-case BackgroundEventCell

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
code-rs/tui/src/history_cell/mod.rs Removed unused new_connecting_mcp_status() helper function
code-rs/tui/src/chatwidget/tools.rs Reformatted tool resolution fallback chain for clarity
code-rs/tui/src/chatwidget/running_tools.rs Changed resolve_entry_index to take &mut ChatWidget to enable cache lookups
code-rs/tui/src/chatwidget.rs Implemented HistoryId index cache with dirty tracking, updated all insert/replace/remove operations to maintain index consistency, throttled snapshot persistence and mismatch warnings, added comprehensive test coverage
code-rs/core/src/spawn.rs Removed non-Linux cgroup stub declaration to eliminate macOS warnings
code-rs/core/src/exec.rs Refactored cgroup cleanup into platform-specific blocks to eliminate warnings
code-rs/core/src/cgroup.rs Removed non-Linux cgroup stub functions, consolidated platform-specific code under cfg attributes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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