Skip to content

fix(tui/settings): defer 1M toggle until close#557

Open
cbusillo wants to merge 2 commits intojust-every:mainfrom
cbusillo:fix/tui-defer-1m-toggle-until-close
Open

fix(tui/settings): defer 1M toggle until close#557
cbusillo wants to merge 2 commits intojust-every:mainfrom
cbusillo:fix/tui-defer-1m-toggle-until-close

Conversation

@cbusillo
Copy link

@cbusillo cbusillo commented Mar 8, 2026

Summary

  • stage session fast mode and 1M context changes while the model settings overlay is open
  • apply those staged changes only when the settings overlay closes
  • add regression coverage so the toggle no longer reconfigures the session mid-settings

Why

Flipping the 1M context setting could immediately reconfigure the session while the user was still inside the settings screen. In practice that meant the session could compact before the user had even exited settings.

Validation

  • cargo test -p code-tui deferred_ --lib
  • ./build-fast.sh

Stage session fast-mode and context-mode changes while the model settings overlay is open, then apply them on close. This prevents the 1M context toggle from reconfiguring the session and compacting history while the user is still inside settings.

Add regression tests covering deferred apply and no-op restores.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c789762e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

impl ModelSettingsContent {
pub(crate) fn new(view: ModelSelectionView) -> Self {
let mut view = view;
view.defer_session_mode_toggles_until_close();

Choose a reason for hiding this comment

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

P1 Badge Flush deferred toggles when switching away from Model section

Deferring session-mode toggles here causes user changes to be dropped if they leave the Model section before closing settings. In section mode, Tab/arrow navigation is handled by settings_handlers.rs (because ModelSelectionView::handle_key_event_direct returns false for those keys), so the active section can change without closing the overlay; later close_settings_overlay() only calls notify_close() for the current active section, which means ModelSettingsContent::on_close may never run and the staged fast/1M updates are lost when the overlay is dropped.

Useful? React with 👍 / 👎.

Run `on_close` for all mounted settings sections so deferred model-setting updates still apply even if the user navigates away from Model before closing the overlay.

Add a regression test covering section-switch then close.
@cbusillo
Copy link
Author

cbusillo commented Mar 8, 2026

Addressed the review concern about deferred updates being lost after navigating away from the Model section.

Follow-up commit: c6aeb65b6

What changed:

  • SettingsOverlayView::notify_close() now runs on_close() for every mounted settings section, not just the currently active one
  • that guarantees deferred model-setting updates still flush when the user leaves Model and then closes settings from another section
  • added a regression test covering the section-switch-then-close path

Validation:

  • cargo test -p code-tui overlay_notify_close_flushes_deferred_model_updates_after_section_change --lib
  • ./build-fast.sh

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