Skip to content

perf: short-circuit model list via bridge (−34s startup)#1304

Open
lennney wants to merge 1 commit into
BigPizzaV3:mainfrom
lennney:perf/model-shortcut
Open

perf: short-circuit model list via bridge (−34s startup)#1304
lennney wants to merge 1 commit into
BigPizzaV3:mainfrom
lennney:perf/model-shortcut

Conversation

@lennney

@lennney lennney commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Intercept list-models-for-host calls in the renderer inject script and return model names from the Codex++ bridge (<1ms) instead of waiting for the app-server RPC (~34s).

Inspired by PR #620 by @congxb.

How it works

  1. Bridge is already loaded and has the model catalog
  2. When codex calls list-models-for-host, intercept and check bridge
  3. If models are available, return immediately via patchAppServerModelResult — skip the full app-server roundtrip
  4. If models not yet loaded, load them on-demand then short-circuit
  5. If bridge is disabled or models unavailable, fall through to original RPC

Verification

  • Model list still works correctly (bridge falls through to original RPC if models not loaded)
  • 91 tests passing (1 pre-existing failure — also on upstream/main)

Intercept list-models-for-host calls in the renderer inject script
and return model names from the Codex++ bridge (<1ms) instead of
waiting for the app-server RPC (~34s).

Inspired by PR BigPizzaV3#620 by @congxb.
@lennney lennney force-pushed the perf/model-shortcut branch from 236cac8 to ae721e0 Compare July 2, 2026 15:07
@lennney lennney marked this pull request as ready for review July 2, 2026 15:07
Copilot AI review requested due to automatic review settings July 2, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 在 Codex 渲染器的注入脚本中拦截 list-models-for-host 请求:当 Codex++ bridge 已能提供模型目录时,直接用 bridge 的模型名构造返回值,从而跳过首次启动时耗时很长的 app-server RPC 往返(PR 描述中约 34s),以显著降低启动阶段模型列表可用的等待时间。

Changes:

  • client.sendRequest 的补丁中对 list-models-for-host 增加短路逻辑:优先从 /codex-model-catalog 加载/读取模型名并立即返回
  • 当 bridge 模型名不可用时保持原行为:回退到原始 sendRequest(app-server RPC)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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