Skip to content

fix(codex): keep local proxy config stable during failover#3776

Open
MonitorAllen wants to merge 4 commits into
farion1231:mainfrom
MonitorAllen:fix/codex-failover-no-live-rewrite
Open

fix(codex): keep local proxy config stable during failover#3776
MonitorAllen wants to merge 4 commits into
farion1231:mainfrom
MonitorAllen:fix/codex-failover-no-live-rewrite

Conversation

@MonitorAllen
Copy link
Copy Markdown

Summary

  • Keep Codex failover provider switches internal when Codex is already routed through the local proxy.
  • Avoid rewriting ~/.codex/config.toml or rebuilding proxy_live_backup from provider snapshots during Codex failover.
  • Preserve Codex client-owned TOML tables while restoring or repairing live config backups, including mcp_servers, plugins, projects, marketplaces, memories, desktop, and features.
  • Add regression coverage for failover, stale backup restore, startup takeover repair, and backup hot-switch preservation.

Background

When Codex local proxy and auto failover are enabled, Codex should remain pointed at the CC Switch local endpoint while CC Switch changes the upstream provider internally.

Before this change, the failover path reused the normal provider hot-switch flow. For Codex, that could write the selected provider snapshot back to the live config. If that provider snapshot was stale, user-owned Codex settings such as MCP servers, plugins, project trust entries, desktop settings, and feature flags could be dropped.

This PR separates the Codex failover path from normal live config switching. Provider-owned routing still updates internally, while the Codex client live config stays stable when local proxy routing is already active.

Related

Related discussions: #3700, #3756, and the overlapping normal provider-write work in #3697.

This PR focuses specifically on Codex local proxy + auto failover behavior and startup takeover backup repair.

Verification

  • CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse ASDF_RUST_VERSION=stable cargo test services::proxy::tests:: -- --test-threads=1
  • ASDF_RUST_VERSION=stable cargo fmt --check
  • git diff --check

@farion1231
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@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: 92b24246d5

ℹ️ 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".

Comment thread src-tauri/src/services/proxy.rs
@farion1231
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@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: 0fbaba6ec5

ℹ️ 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".

Comment thread src-tauri/src/services/proxy.rs
@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

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.

2 participants