fix(inject): app-server patch 熔断不再被 provider 重试绕过,重试改指数退避 (issue #2256/#2255) - #2271
Merged
BigPizzaV3 merged 1 commit intoSep 22, 2026
Merged
Conversation
…izzaV3#2256/BigPizzaV3#2255) - noteAppServerModelRequestPatchMiss 删除 provider 模式提前 return,两条路径统一 miss 计数,maxMisses(8) 熔断对所有模式生效;熔断时清掉挂起的重试定时器。 - scheduleAppServerModelRequestPatchRetry 重试间隔从固定 250ms 改为指数退避 (250ms ×4 递增,30s 封顶),补丁装成功后 miss 计数与退避间隔复位。 - appServerFallbackAssetUrls 删除硬编码的旧版 bundle 哈希(gwqc41kz 等), 26.911+ 上本就匹配不到任何文件,属死代码;稳定模块名模式保持不变。 - 按 renderer-inject.test.ts 既有 harness 模式补 3 个回归测试。
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.
变更概述
修复 #2256 / #2255:Codex 桌面 26.911+ 改 bundle 哈希后,
installAppServerModelRequestPatch的 provider 重试路径绕过maxMisses熔断,失败退化为 250ms 无限重试,每轮全量重扫全部 app assets(实测每轮 fetch 275+ 个app://资源),空闲时主进程 + 渲染进程持续各烧约 1 核 / 0.3-1 核,整机卡顿。本 PR 仅修改
assets/inject/renderer-inject.js中 issue 点名的两处缺陷,并为apps/codex-plus-manager/src/renderer-inject.test.ts补充回归测试,不改变 patch 正常安装路径与非 provider 模式的既有行为。根因
noteAppServerModelRequestPatchMiss在codexRemoteSessionProviderPatchEnabled()为真(relayModepureApi或official+mixApiKey)时提前return,后面的appServerModelRequestPatchMissCount >= maxMisses熔断永远不可达,appServerModelRequestPatchDisabled永不置位;scheduleAppServerModelRequestPatchRetry固定 250ms、无退避、无上限。Codex 改 asset 命名后这层 patch 永远装不上,miss 变成无限重试,每轮经loadAppServerRequestModules→appServerFallbackAssetUrls全量重扫。gwqc41kz|c1urrgy0|hsvsqcnf在 26.911+ 上匹配不到任何文件(实测见验证),是死代码,且每个 Codex 大版本升级后都会变成这类过期名单。loadCodexAppModule路径在 issue #1960 已有 8 次上限 + 30s 冷却,但上述路径未对齐,循环回归。修复内容
noteAppServerModelRequestPatchMiss:删除 provider 模式的提前return,所有模式统一 miss 计数;达到maxMisses(8)后置位 disabled、清掉挂起的重试定时器并上报model_app_server_request_patch_skipped;未熔断时调度重试。scheduleAppServerModelRequestPatchRetry:重试间隔从固定 250ms 改为指数退避(250ms ×4 递增,30s 封顶);保留原有 provider 守卫,非 provider 模式行为与修复前完全一致(仍由白名单 tick 驱动,同样受熔断约束)。patchedCount > 0)复位 miss 计数与退避间隔。appServerFallbackAssetUrls:仅删除三个硬编码哈希(filter 正则与排序打分两处),稳定模块名模式(use-host-config、app-server-manager-signals、app-initial、app-main等)保持不变。验证结果
单元/回归测试(Node 24.15.0,Windows 10 19045):
renderer-inject.test.ts37 项全部通过(含新增 3 项)。真实环境 A/B 验收(Windows 10 19045,OpenAI.Codex 26.915.4065.0 MSIX,Codex++ 经管理器正常启动流程,激活 relay 为 pureApi 模式,
codexAppModelWhitelistUnlock开启;CDP 9229 注入 fetch 计数探针,空闲会话页测量):app://,约每 10s 完整重扫一轮not_found反复not_found ×1 → skipped ×1 → 静默window.fetch(不含动态import()的网络层),故绝对值偏低,但重扫模式一致;修复后两个测量窗口均为零。影响范围与限制
loadCodexAppModule熔断语义一致)。回滚方案
回退本 PR 的单个提交即可:恢复提前
return与固定 250ms 重试、还原两处正则中的哈希名单;不影响其他层。关联:#2256 #2255(同根因的两份报告)