修复供应商切换状态丢失与 Fast/插件稳定性 / Fix provider-switch state loss and Fast/plugin stability#1345
Open
Yuimi-chaya wants to merge 5 commits into
Open
修复供应商切换状态丢失与 Fast/插件稳定性 / Fix provider-switch state loss and Fast/plugin stability#1345Yuimi-chaya wants to merge 5 commits into
Yuimi-chaya wants to merge 5 commits into
Conversation
… App 状态 为什么 / Why: Codex++ 切换供应商时已经能保留会话,但 Codex App 的 persisted state 和 desktop settings 会丢失,导致工作区、输入习惯、布局和个性化体验回到默认值。 Provider switching already preserves conversations, but Codex App persisted state and desktop settings can be lost, resetting workspace roots, input behavior, layout, and personalization. 改动 / Changes: - Add a safe allowlist-based .codex-global-state.json snapshot/merge module. - Preserve safe workspace, project hint, service-tier, onboarding, layout, and personalization state. - Preserve the live [desktop] table when writing provider config.toml, so settings such as Enter/Ctrl+Enter behavior and selected avatar are not overwritten by stale profile config. - Back up global state before writing merged state. 安全边界 / Safety: The sync deliberately excludes auth, API keys, prompt history, provider token cache, and permission maps. 同步刻意排除 auth、API Key、prompt history、provider token cache 和权限映射。
…供应商切换状态并加固内置插件守护 为什么 / Why: Codex++ 的主要使用场景是自定义 URL + API key。切换供应商后,如果工作区状态、特殊插件本地缓存或 Computer Use 运行时配置被重置,用户会被迫重新安装工作区或开 VPN 进入一次官方环境。 Codex++ is commonly used with custom URLs and API keys. After switching providers, losing workspace state, special plugin cache, or Computer Use runtime config forces users to reinstall workspace state or open the official environment through VPN once. 改动 / Changes: - Wire app-state capture/merge into launcher, relay switch, manager apply/clear paths. - Make builtin plugin guard active when full enhancements and plugin marketplace unlock are enabled, while keeping the force switch for other cases. - Preserve Browser, Chrome, Computer Use bundled plugin config and local openai-bundled marketplace state. - Ensure js_repl, local_shell, computer_use, Windows unelevated sandbox, notify config, and runtime export compatibility. - Set CODEX_ELECTRON_ENABLE_WINDOWS_COMPUTER_USE=1 for guarded Windows launches. - Update manager UI/i18n so the old Computer Use switch is described as a force-enable guard. 安全边界 / Safety: This is a local config/cache/runtime guard. It does not claim to bypass every possible organization or region gate inside Codex App ASAR. 这是本地 config/cache/runtime 兜底,不声称能 100% 绕过 Codex App ASAR 内部所有组织或地区 gate。
为什么 / Why: Fast/service-tier 判断依赖当前模型。如果 active relay profile 的 model list 或 profile model 是旧值,而 live ~/.codex/config.toml 已经选择了 gpt-5.5,Codex++ 会误以为当前模型未读取或不支持。 Fast/service-tier decisions depend on the current model. If the active relay profile model list is stale while live ~/.codex/config.toml already selects gpt-5.5, Codex++ may think the current model is unread or unsupported. 改动 / Changes: - Read the live Codex config model for the active relay profile catalog response. - Put the effective current model first, then merge profile model and model list entries. - Strip Codex++ model suffixes before catalog candidate dedupe. - Add tests for live config winning over stale relay profile values.
… 注入并兼容新版 Codex 资产 为什么 / Why: 用户实际遇到过界面已选 gpt-5.5 且请求可用,但 Codex++ 仍提示“当前模型未读取”或隐藏 Fast 入口。新版 Codex Desktop 还移除了旧 app-server-manager-signals-* asset,并调整了 composer DOM,导致注入报错和右下角 Fast badge 缺失。 Users have seen gpt-5.5 selected and working while Codex++ still reports the current model as unread or hides Fast. Newer Codex Desktop builds also removed the old app-server-manager-signals-* asset and changed composer DOM, causing injection errors and missing composer Fast badge. 改动 / Changes: - Treat unknown current model as pending, not unsupported; only known non-gpt-5.4 / gpt-5.5 models block Fast. - Resolve model from request params, visible UI, backend catalog, and last-known supported model. - Keep service_tier="priority" for pending supported paths instead of silently downgrading. - Load old Codex app assets optionally and log skipped diagnostics when they are absent. - Remove the hard-coded old app-server-manager asset import. - Add composer placement fallbacks based on model buttons, textarea, contenteditable, and textbox nodes.
…e-plugin-fast # Conflicts: # crates/codex-plus-core/src/relay_config.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文说明
摘要
本 PR 修复 Codex++ 在供应商切换和 Codex App 新版本注入中的几个长期体验问题:Codex App 本地状态丢失、工作区/个性化设置需要重复配置、Browser/Chrome/Computer Use 等内置插件在 API-key 模式下切换后变灰、Fast/service tier 因模型读取时序或新版 DOM/asset 变化而时隐时现。
本次按功能拆成 4 个 commit,方便逐块审查。
为什么
Codex++ 的核心场景之一是国内用户通过自定义 Base URL + API key 使用 Codex App,而不是依赖官方登录态。当前供应商切换已经能同步会话数据库,让历史对话继续可见,但 Codex App 自己的 persisted state / desktop settings / plugin cache / service-tier 状态没有完整保留。
这会带来几个实际问题:
Ctrl+Enter提交、Enter换行,切换后如果回到默认值,按一次 Enter 就可能误提交 prompt。gpt-5.5且请求可用时仍提示“当前模型未读取”或隐藏入口。改动
1. Codex App 状态同步
.codex-global-state.jsonsnapshot/merge 逻辑。backups_state/app-state-sync,并维护 latest safe snapshot。[desktop]table,避免覆盖composerEnterBehavior、selected-avatar-id、followUpQueueMode等 Codex Desktop 设置。2. 供应商切换入口和内置插件 guard
browser@openai-bundled、chrome@openai-bundled、computer-use@openai-bundled的本地 bundled 状态。js_repl、local_shell、computer_use、Windowsunelevatedsandbox、notify 配置和 runtime export 兼容修复。CODEX_ELECTRON_ENABLE_WINDOWS_COMPUTER_USE=1。3. Fast/service tier 模型目录稳定
~/.codex/config.toml的实际模型。4. 注入层 Fast 与 Codex App 新版兼容
gpt-5.4/gpt-5.5时才阻断 Fast。service_tier="priority",避免无声降级。app-server-manager-signals-*asset 缺失时记录 skipped,而不是持续 failed。安全边界
auth.json、API Key、prompt history、provider token cache、permission maps 等敏感内容。测试
node --check assets/inject/renderer-inject.jscargo fmt --checknpm run checkcargo --config "source.crates-io.replace-with='ustc-sparse'" --config "source.ustc-sparse.registry='sparse+https://mirrors.ustc.edu.cn/crates.io-index/'" test -p codex-plus-core --test codex_app_state --test relay_config --test relay_switch --test launcher --test model_catalog --test cdp_bridge手动验证
English Summary
Summary
This PR fixes several long-standing provider-switch and injection issues in Codex++: lost Codex App local state, repeated workspace/personalization setup, built-in Browser/Chrome/Computer Use plugins becoming unavailable in API-key mode after provider switches, and Fast/service-tier controls disappearing or being misdetected because of model-read timing or newer Codex App DOM/asset changes.
The change is split into 4 commits so each functional area can be reviewed separately.
Why
One of Codex++'s core use cases is using Codex App with a custom Base URL + API key, especially for users who do not rely on the official login state. Provider switching already syncs conversation data so historical threads stay visible, but Codex App's persisted state, desktop settings, plugin cache, and service-tier state were not fully preserved.
This causes several practical issues:
Ctrl+Enterto submit andEnterto insert a newline, resetting this behavior can cause an accidental prompt submission.gpt-5.5is visibly selected and requests work.Changes
1. Codex App state sync
.codex-global-state.jsonsnapshot/merge logic.backups_state/app-state-syncand keeps a latest safe snapshot.[desktop]table before writing provider config, avoiding overwrites of Codex Desktop settings such ascomposerEnterBehavior,selected-avatar-id, andfollowUpQueueMode.2. Provider-switch hooks and builtin plugin guard
browser@openai-bundled,chrome@openai-bundled, andcomputer-use@openai-bundled.js_repl,local_shell,computer_use, Windowsunelevatedsandbox, notify config, and runtime export compatibility.CODEX_ELECTRON_ENABLE_WINDOWS_COMPUTER_USE=1on guarded Windows launches.3. Fast/service-tier model catalog stability
~/.codex/config.toml.4. Injection-layer Fast and newer Codex App compatibility
gpt-5.4/gpt-5.5models.service_tier="priority"for pending paths instead of silently downgrading.app-server-manager-signals-*asset is missing, it logs skipped instead of repeatedly failing.Safety
auth.json, API keys, prompt history, provider token cache, permission maps, or similar sensitive data.Tests
node --check assets/inject/renderer-inject.jscargo fmt --checknpm run checkcargo --config "source.crates-io.replace-with='ustc-sparse'" --config "source.ustc-sparse.registry='sparse+https://mirrors.ustc.edu.cn/crates.io-index/'" test -p codex-plus-core --test codex_app_state --test relay_config --test relay_switch --test launcher --test model_catalog --test cdp_bridgeManual validation