Skip to content

Refactor chatwidget input flow into modules#22407

Merged
etraut-openai merged 1 commit into
mainfrom
etraut/chatwidget-refactor-phase-2
May 13, 2026
Merged

Refactor chatwidget input flow into modules#22407
etraut-openai merged 1 commit into
mainfrom
etraut/chatwidget-refactor-phase-2

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

Why

chatwidget.rs is still carrying too many unrelated responsibilities in one file. #22269 started a five-phase effort to move coherent behavior domains into focused modules while keeping chatwidget.rs as the composition layer.

This PR is phase 2 of that plan. It extracts the input and submission flow as a mechanical move before the later protocol, popup/status, and constructor/orchestration phases.

What Changed

  • Added codex-rs/tui/src/chatwidget/input_flow.rs for composer input results, queued user-message draining, pending-input previews, and mode-specific submission entry points.
  • Added codex-rs/tui/src/chatwidget/input_submission.rs for user-message construction/submission, shell prompt submission, structured mention resolution, and blocked image draft restoration.
  • Added codex-rs/tui/src/chatwidget/input_restore.rs for initial-message submission, pending steer restoration after interrupts, and thread input snapshot/restore behavior.
  • Registered the new modules and removed the moved ChatWidget impl methods from codex-rs/tui/src/chatwidget.rs.

Follow-On Refactor Phases

The five-phase plan from #22269 is:

  • Phase 1: mechanical helper and state moves. Completed in Refactor chatwidget state into modules #22269.
  • Phase 2: extract input and submission flow, including queued user messages, shell prompt submission, pending steer restoration, and thread input snapshot/restore behavior. This PR.
  • Phase 3: extract protocol, replay, streaming, and tool lifecycle handling, while preserving active-cell grouping, transcript invalidation, interrupt deferral, and final-message separator behavior.
  • Phase 4: extract settings, popups, and status surfaces, including model/reasoning/collaboration/personality popups, permission prompts, rate-limit UI, and connectors helpers.
  • Phase 5: clean up the remaining constructor and orchestration code once the larger behavior domains have moved out, leaving chatwidget.rs as the composition layer.

@etraut-openai etraut-openai merged commit 2630a6c into main May 13, 2026
38 of 39 checks passed
@etraut-openai etraut-openai deleted the etraut/chatwidget-refactor-phase-2 branch May 13, 2026 04:17
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants