Split ChatWidget state into focused modules#21866
Open
etraut-openai wants to merge 2 commits intomainfrom
Open
Split ChatWidget state into focused modules#21866etraut-openai wants to merge 2 commits intomainfrom
etraut-openai wants to merge 2 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ChatWidgethas been carrying several independent domains in one large state bag: transcript bookkeeping, turn lifecycle, queued input, status surfaces, connectors, review mode, and protocol dispatch. That makes otherwise-local changes hard to reason about because unrelated fields and side effects live beside each other inchatwidget.rs.This is the first cleanup PR in a larger decomposition effort. It does not try to make
chatwidget.rssmall in one sweep; instead, it establishes focused state boundaries that later handler, popup, rendering, and effect-synchronization extractions can build on.This PR keeps
ChatWidgetas the composition layer while moving focused state into smallercodex-tuimodules. The widget still owns effects that touch the bottom pane, app events, command submission, redraw scheduling, and terminal-title updates.Changes
codex-rs/tui/src/chatwidget/for input queues, turn lifecycle, transcript bookkeeping, status state, connectors, review mode, and app-server protocol dispatch.ChatWidgetto hold grouped state structs and route input/lifecycle/status operations through those focused helpers.chatwidget/protocol.rswhile leaving feature handlers and side effects onChatWidget.ChatWidgettest literal with the normal constructor plus narrow test overrides, so future state moves do not require every field to be restated in test setup.Longer-term direction
Follow-up PRs can continue shrinking
chatwidget.rsby moving behavior, not just state, into focused modules:ChatWidgetstays focused on composition.BottomPanemutation by applying domain-specific sync outputs at clearer boundaries.