reduce snapshot churn and speed up HistoryId lookups#486
reduce snapshot churn and speed up HistoryId lookups#486ConstantinHvber wants to merge 1 commit into
Conversation
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)
There was a problem hiding this comment.
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.
|
Codex PR triage, 2026-06-03: This still looks directionally useful for long-session TUI lag, but it is draft, non-mergeable, and based on old main. Please rebase, resolve current chatwidget/history-cell divergence, undraft when ready, and include |
Implement fixes to address long-session TUI lag and history-state mismatch degradation.