fix(inject): graceful fallback for app-server model patch when module is missing (#1324)#1360
Open
LeoLin990405 wants to merge 1 commit into
Open
Conversation
installAppServerModelRequestPatch() runs on every model-whitelist refresh tick (~120ms). On Codex builds where the app-server-manager-signals-* module was renamed/removed (26.623+), loadCodexAppModule() throws on every tick, so model_app_server_request_patch_failed was emitted continuously and the failed lookup was retried forever. Report the first miss (telemetry preserved), stay quiet afterwards, and disable this layer once it is clearly unavailable, emitting a single model_app_server_request_patch_skipped summary. The remaining whitelist layers (Statsig config / React state / response JSON patch) keep injecting the custom models, so this is a graceful fallback rather than a behavior change. The miss counter resets on success and per document, so a late-loaded module chunk is still patched. Refs BigPizzaV3#1324
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.
问题 / Problem
installAppServerModelRequestPatch()会在模型白名单刷新循环里被反复调用(scheduleCodexModelWhitelistRefresh每 120ms tick 一次)。在 Codex26.623+版本里app-server-manager-signals-*模块被改名/移除后,loadCodexAppModule("app-server-manager-signals-")每一 tick 都抛异常:model_app_server_request_patch_failed(诊断日志被刷屏);loadCodexAppModule失败即删缓存,每次都重新扫描)。对应 issue #1324。维护者也在该 issue 中指出:这一层(app-server request patch)失败并不致命——其它层(Statsig / React state / 响应 JSON patch)仍能把自定义模型补进模型选择器。所以现状只是「无谓的噪音 + 无谓的重试」。
installAppServerModelRequestPatch()runs on every whitelist refresh tick (~120ms). On Codex26.623+, where theapp-server-manager-signals-*module was renamed/removed,loadCodexAppModule()throws every tick, somodel_app_server_request_patch_failedwas emitted continuously and the doomed lookup was retried forever. Per the maintainer's own note on #1324 this layer is non-fatal — the other whitelist layers still inject the custom models.改动 / Change
只改
assets/inject/renderer-inject.js一个文件,纯 opt-out 降级,不改成功路径行为:8次仍失败 → 判定该 Codex 版本确实没有此模块,停用这一层并补一条model_app_server_request_patch_skipped汇总;Graceful fallback, JS-only, no change to the success path:
8consecutive misses, disable this layer and emit onemodel_app_server_request_patch_skippedsummary;其余白名单层(
patchStatsigModelWhitelist/patchReactModelState/installModelJsonResponsePatch)不受影响,继续照常工作。范围说明 / Scope
本 PR 只处理 #1324 里的「日志刷屏 + 无限重试」问题(即 issue 建议里的第 2 点,优雅降级)。#1324 里关于聚合 profile 的
read_codex_model_catalog()修复(问题 B)由 #1325 / @Marnie0415 跟进,本 PR 不涉及、无冲突。Scope: this PR only addresses the diagnostic spam / infinite retry from #1324 (suggestion #2, graceful fallback). The aggregate-profile
read_codex_model_catalog()fix (part B) is handled separately in #1325 by @Marnie0415 and is out of scope here.测试 / Testing
node --check assets/inject/renderer-inject.js通过;renderer-inject.js为纯注入资产,仓库内无对应 JS 测试套件;未触碰任何 Rust 代码,cargo构建/测试不受影响。