Skip to content

Let Codex CLI update wait for GSwitch's own work - #179

Merged
squarepots merged 1 commit into
mainfrom
fix/cli-update-wait
Oct 8, 2026
Merged

squarepots merged 1 commit into
mainfrom
fix/cli-update-wait

Conversation

@squarepots

Copy link
Copy Markdown
Member

What changed

Update in the Codex CLI dialog now waits for GSwitch's own operation lock instead of failing at once. While a quota refresh or another GSwitch operation holds the lock, the update waits for it to finish, then runs codex update with the lock held and the existing external-Codex check. The unreachable CLI busy failure code and its two strings are removed. docs/security.md records the waiting behavior.

Why

The maintainer reported "Another GSwitch operation is in progress" when they clicked Update without starting anything else. Their screenshot shows Refreshing x/5 in the toolbar. Quota refreshes do not set the UI's busy state, so Update stayed enabled. The backend used a non-waiting try-lock, so the update collided with a refresh's short quota commit or with an expired saved sign-in's official token refresh, which holds the lock while App Server runs.

Every in-process lock holder is bounded by existing HTTP (20 s) and App Server (15 s start, 30 s request) timeouts, and the single-instance plugin rules out a second GSwitch process. Wake keeps its own non-dismissible dialog over the window while it runs, so the CLI dialog cannot be opened behind it. No UI gate was needed.

Validation

  • A new Rust regression test holds the operation lock on one thread and checks that the CLI update acquisition waits and then succeeds after release. Run against the old try-lock implementation, it failed as expected.
  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, and the full Rust suite (177 passed, 1 ignored) passed on Windows.
  • 157 frontend tests passed with pnpm test --exclude '.claude/**'; pnpm build, pnpm run version:check, and git diff --check passed.

Remaining

The real codex update was not run against the maintainer's installed CLI. No credentials, account state, provider protocol, or version files change.

Updating the CLI took the operation lock with a non-waiting try-lock, so
clicking Update while a quota refresh was committing or running an
official token refresh reported "Another GSwitch operation is in
progress" even though the user had started nothing that conflicts.

The update now waits for the lock the same way a quota commit does, then
runs with it held. Every in-process holder is bounded by existing HTTP
and App Server timeouts, and Wake keeps its own non-dismissible dialog
open while it runs. The CLI busy failure can no longer occur, so its
code and copy are removed.
@squarepots
squarepots merged commit 0174e1f into main Oct 8, 2026
12 checks passed
@squarepots
squarepots deleted the fix/cli-update-wait branch October 8, 2026 03:44
@squarepots squarepots mentioned this pull request Oct 8, 2026
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