/experimental saves on Esc and writes flags the user never toggled
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- PR merge metrics
- PR metrics pending
Description
What happens
Opening /experimental, then pressing Esc without touching anything, writes
every experimental feature flag to the config file. The popup's own footer
reads "press space to select or enter to save for next conversation", so Esc is
expected to discard.
Steps to reproduce
- Start with a
config.tomlthat has no[features]section. - Run
codex, type/experimental, press Enter. - Press Esc without toggling anything.
- Look at
~/.codex/config.toml.
Expected: the file is unchanged.
Actual: the file now carries an entry for every feature listed in the popup.
The same happens when a single flag is toggled and saved with Enter: the write
carries all the listed features, not just the one that changed. On a machine
where a flag was left at a non-default value on purpose, opening the popup once
is enough to pin every other flag to its current value.
Root cause
ExperimentalFeaturesView::on_ctrl_c in
codex-rs/tui/src/bottom_pane/experimental_features_view.rs sends
AppEvent::UpdateFeatureFlags with the full feature list, then marks the view
complete. handle_key_event routes both keymap.accept and keymap.cancel to
that same method, so cancelling takes the saving path. The comment on the
method (// Save the updates) suggests it was written for acceptance and later
reused for cancellation.
Suggested fix
Split the two paths: cancel (and Ctrl-C) closes without emitting anything,
accept emits only the features whose value differs from the state the popup
was opened with. Keeping the opening state in the view is enough; no new
plumbing is needed.
Context
I ran into this while working on per-scope configuration in my own fork, where
a popup writing flags nobody toggled is easy to spot. Happy to open a separate
issue for that work if there is interest — this report is only about the popup
behaviour, which reproduces on a stock build of main.
The change and its tests are ready on a branch, if the team wants it:
https://github.com/openai/codex/compare/main...apieum:codex:fix/experimental-popup-discards
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in codex-rs/tui/src/bottom_pane/experimental_features_view.rs, focusing on ExperimentalFeaturesView::on_ctrl_c and handle_key_event, and inspect the existing tests for this view. Verify that Esc and Ctrl-C close without writing, while Enter persists only changed flags, then run the relevant TUI tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100