Streamline TUI monoliths: split event_loop.rs match into per-domain reducers, slim app.rs
- Dominant language
- Rust
- Stars
- 41k
- Forks
- 3.6k
- Avg merge
- 13h 59m
- Merged PRs (30d)
- 299
Description
User ask: 'our code is getting rather chunky — is it not possible to streamline this'.
`tui/src/tui/ui/event_loop.rs` is a multi-thousand-line single match over EngineEvent; `tui/src/tui/app.rs` is similarly monolithic. `session_state.rs::apply` already shows the right shape: a small per-domain reducer applied before the big match. Extend that pattern (Codex structures its event handling the same way): move cohesive arms (cost/usage, streaming, tools, goals, compaction, notifications) into per-domain reducer modules with focused tests, leaving event_loop.rs as dispatch. No behavior change; migrate arm-by-arm so each step is small and reviewable. Per AGENTS.md this is a declared one-way direction once started: new event handling goes in reducers, touched arms migrate.
Tracker: #5573.
Contributor guide
Research direction
Read AGENTS.md and session_state.rs::apply first to understand the declared reducer direction, then inspect tui/src/tui/event_loop.rs and tui/src/tui/app.rs. Group the cost/usage, streaming, tools, goals, compaction, and notification arms into cohesive reducer modules, adding focused tests as you migrate. Done means event_loop.rs primarily dispatches, new handling uses reducers, and behavior is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100