fix: make restart lifecycle recoverable, responsive, and fast - #2023
Open
Yuimi-chaya wants to merge 12 commits into
Open
fix: make restart lifecycle recoverable, responsive, and fast#2023Yuimi-chaya wants to merge 12 commits into
Yuimi-chaya wants to merge 12 commits into
Conversation
Yuimi-chaya
force-pushed
the
codex/provider-sync-restart-recovery
branch
from
August 27, 2026 07:31
18fa98c to
a7ae566
Compare
Yuimi-chaya
force-pushed
the
codex/provider-sync-restart-recovery
branch
from
August 27, 2026 20:36
a7ae566 to
18ace02
Compare
Yuimi-chaya
force-pushed
the
codex/provider-sync-restart-recovery
branch
from
August 27, 2026 20:56
18ace02 to
42298da
Compare
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.
上游当前问题与来源
当前
main的重启问题不是单一端口故障,而是几段历史实现叠加后形成的一条同步启动链:887e2bc5引入的 Manager 重启命令是同步 Tauri command。当前代码仍在同一个调用中执行 Provider Sync 等待、Launcher 停止和 App 停止:commands.rs#L624-L662。5a3ed5c为避免强杀正在同步的 Launcher,加入了最长 30 秒的轮询等待;但等待使用std::thread::sleep,仍发生在上述同步命令中:commands.rs#L5928-L5956。安全意图是正确的,但 UI 会在等待和停止阶段失去响应。7bd4a742把 Provider Sync 放在 helper 和 Codex App 启动之前:launcher.rs#L332-L341。因此同步耗时会直接变成启动/重启耗时。e94efdb4的扫描路径会对每个 rollout 执行整文件fs::read_to_string:provider_sync.rs#L1275-L1291。大量或超大 JSONL 会造成高峰内存、重复全量扫描和启动延迟。5036ff05让 Manager 按 debug-port 停止 App。当前 Store App 直接启动时可能没有 CDP/debug listener,此时“重启”无法识别并停止正在运行的 App。c8f08ce1正确地移除了普通启动时的完整供应商覆盖;之后7081e847加入单模型路由。两者组合后,Launcher 可以启动本地协议代理,却不再保证 liveconfig.toml的活动 transport endpoint 指向该代理。情况举例
WouldBlock后会进入精简 activation 路径,跳过 Provider Sync、App state sync、插件市场维护、Dream Skin 同步、历史模型后缀清理和协议代理选择。57321监听,但活动供应商base_url仍保持上游地址,请求绕过本地代理,路由规则不生效。本 PR 的优化
1. 非阻塞且可恢复的重启事务
spawn_blocking承载原生进程与文件操作,避免冻结 Manager UI。2. 跨平台原生 App/Launcher 生命周期
Codex/ChatGPTApp 名称,并兼容当前与历史 Launcher 名称。AddrInUse和常见的WouldBlock,确保 App 已退出时重新进入完整 Launcher 生命周期。3. Provider Sync 有界内存与崩溃恢复
4. 未变化 rollout 启动快路径
12.327 s,全部未变化的第二次扫描37.5 ms。5. 协议代理启动不变量
apply_active_relay_profile:不会重写auth.json、模型/供应商选择、common/context、插件、catalog 或凭据。自动化验证
32/3257/57,另有 2 个 ignored synthetic benchmarks4/426/26138/13885/859/967/6722/22cargo check、focused Rust 2024 rustfmt、git diff --check真人测试
已在 Windows 11、当前 Windows Store Codex/ChatGPT App 上安装本 PR 的 release 构建并完成真人测试:
以上真人测试已通过。