Skip to content

fix(shim): support Codex Desktop 26.1117's App server host launch chain - #980

Merged
BytePioneer-AI merged 1 commit into
mainfrom
fix/shim-app-server-host
Nov 20, 2026
Merged

BytePioneer-AI merged 1 commit into
mainfrom
fix/shim-app-server-host

Conversation

@BytePioneer-AI

Copy link
Copy Markdown
Owner

Codex Desktop 26.1117.31558 starts its local app-server as Desktop -> App server host utility -> shim. The Shim treated every depth > 1 caller as a native tool helper and exec'd the official CLI, so Host Node never started and the Launcher timed out (Codex Desktop did not start the codexhost Host chain before timeout).

An indirect call is now the main app-server only when all of these hold: its argv has the Desktop local app-server signature, CODEX_INTERNAL_ORIGINATOR_OVERRIDE is Codex Desktop, and the parent chain is a utility from the same validated bundle directly under the validated Desktop root. Computer Use app-servers (app-server --listen stdio://) stay helpers; direct Desktop -> Shim is unchanged. Helper routing and lease admission use one classification. The Launcher's Shim -> Node check is not relaxed.

Validation: cargo test --locked -p codexhost-shim --features codexhost-shim/test-utils (88 passed, 5 ignored; the new indirect-main test failed before the change). An isolated debug launch on Desktop 26.1117.31558 reached Host chain ready in 4.0 s (Desktop -> utility -> shim -> Node). Not exercised: the browser helper.

Risk: the argv signature is a Desktop implementation detail; if a later Desktop changes it, indirect calls fall back to helper and need re-sampling.

…s the main app-server

Desktop now starts its local app-server through an App server host utility
(Desktop -> utility -> shim). The Shim classified every depth > 1 caller as a
native tool helper and exec'd the official CLI, so the Host chain never
started and the Launcher timed out after 30 s.

An indirect invocation is the main app-server only when its argv carries the
Desktop local app-server signature, CODEX_INTERNAL_ORIGINATOR_OVERRIDE is
Codex Desktop, and the parent chain is a utility from the same validated
bundle directly under the validated Desktop root. Browser and Computer Use
app-servers (app-server --listen stdio://) stay helpers. Direct Desktop -> Shim
invocations are unchanged. Helper routing and lease admission share one
classification.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T07:27:53.601482Z 82c1da2 PR opened
🔒 Security Review ✅ Completed 2026-11-20T07:28:49.509326Z 82c1da2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Summary

Summary by CodeRabbit

  • Bug 修复
    • 改进了对桌面应用主进程、辅助进程及其他调用来源的识别,覆盖更多 macOS 启动场景。
    • 本地运行时现在会依据调用来源进行准入判断;现有的运行时映射检查、命令行回退及所有权错误处理保持不变。

shim 新增统一的 Desktop 调用方分类。macOS 分类逻辑检查参数签名、originator 和进程祖先链。shim 使用分类结果决定 helper 路由,并将该结果传入本地 runtime 准入。

Changes: Desktop 调用方分类

Layer / File(s) Summary
分类规则与验证
crates/shim/src/desktop_invocation.rs
新增 DesktopCaller 和统一分类函数。Windows 根据 Launcher PID 与进程祖先链分类;macOS 根据本地 app-server 参数签名、originator 和进程祖先链分类。新增测试覆盖直连、间接调用及祖先链无法验证等情况。
shim 路由与本地 runtime 准入
crates/shim/src/lib.rs, crates/shim/src/local_runtime_lease.rs
shim 根据分类结果设置 desktop_helper,并将分类结果传给 admit_local_runtime。准入逻辑改用 DesktopCaller::is_non_desktop() 判断调用方。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Shim
  participant classify_desktop_caller
  participant admit_local_runtime
  Shim->>classify_desktop_caller: stock Codex 路径和调用参数
  classify_desktop_caller-->>Shim: DesktopCaller
  Shim->>admit_local_runtime: DesktopCaller
Loading

Possibly related PRs

Suggested reviewers: ump45nose, mouzhi

Merge Risk: Moderate · up to 82c1d

The change lets Codex Desktop 26.1117's utility-mediated launch start the Host Node. A restart or replacement of the Shim through a different utility process while the earlier one is still running can be rejected as belonging to another Desktop, so the replacement Host does not start. Resolve the lease owner identity before merging, or explicitly accept the limitation.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82c1da2f3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +152 to +156
return if depth == 1
|| (depth == 2
&& marked
&& originator == Some(OsStr::new(super::DESKTOP_ORIGINATOR))
&& child.executable.starts_with(bundle))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update the documented macOS launch-chain contract

For Desktop 26.1117's Desktop -> App server host -> Shim invocation, this branch now intentionally classifies a depth-2 caller as Main, but docs/platforms/macos/macos-native-tools.md lines 89–90 still state that only a direct Desktop child retains Host routing and every deeper descendant uses the stock CLI. That leaves the feature's compatibility guidance and future regression criteria describing the opposite behavior; document this validated indirect-main exception alongside the implementation.

AGENTS.md reference: AGENTS.md:L102-L103

Useful? React with 👍 / 👎.

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.

1 participant