Skip to content

fix(tui): save config updates in order - #65761

Merged
Tarquinen merged 1 commit into
anomalyco:devfrom
OpeOginni:cli-save-order
Nov 23, 2026
Merged

Tarquinen merged 1 commit into
anomalyco:devfrom
OpeOginni:cli-save-order

Conversation

@OpeOginni

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #65523

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

  • Queue TUI config saves and reloads in order so an earlier theme preview cannot overwrite the confirmed choice.
  • Keep live previews unchanged.

How did you verify your code works?

  • Ran the issue's /themes reproduction against the patched TUI and checked that cli.json kept the selected theme.
  • Ran bun run check.

Screenshots / recordings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix works. I ran the #65523 reproduction script 12 times on each checkout. On the base branch, 6 of 12 picks left cli.json on a theme that was only previewed. With this change, all 12 picks were saved correctly. The config tests in packages/tui pass.

Saves now run one after another. Reloads from the file watcher join the same queue, so a reload set off by a save's own write runs after the saves already waiting and reads the newest file. A failed save doesn't block later ones, and the caller still gets the error (the callers in theme.tsx already handle it).

Public API is unchanged: this only touches the TUI's internal ConfigProvider, and update keeps the same signature.

I have no concerns that would block this.

@Tarquinen
Tarquinen merged commit c2a6ce7 into anomalyco:dev Nov 23, 2026
11 checks passed
beyondChang pushed a commit to beyondChang/opencode that referenced this pull request Nov 24, 2026
@amrkmn amrkmn mentioned this pull request Nov 26, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: theme picked in /themes is sometimes replaced by an earlier preview (saves race for cli.json's lock)

2 participants