Skip to content

fix(host-runtime): answer External Thread settings and list requests from non-Desktop clients - #544

Open
tyyzqmf wants to merge 1 commit into
BytePioneer-AI:mainfrom
tyyzqmf:fix/external-thread-mobile-defaults
Open

tyyzqmf wants to merge 1 commit into
BytePioneer-AI:mainfrom
tyyzqmf:fix/external-thread-mobile-defaults

Conversation

@tyyzqmf

@tyyzqmf tyyzqmf commented Oct 16, 2026

Copy link
Copy Markdown

目的

修复 #543:ChatGPT iOS app 通过 SSH 连接 Remote Host 后,能看到 Claude Code External Thread,但发不出消息。

iOS app 在 turn/start 之前会先调 thread/settings/update,打开 Thread 时还会调 thread/attachment/list 和 thread/queue/list。Host 对 External Thread 的这些请求一律返回 -32076 External Thread does not support …,app 收到后就中止发送,turn/start 根本发不出去。

改动范围

  • 新增 packages/host-runtime/src/external-thread-official-defaults.ts。对 External Thread 的这三个方法,按官方 ThreadAttachmentListResponse / ThreadQueueListResponse / ThreadSettingsUpdateResponse 的结构返回空结果。
    • thread/settings/update 只确认、不应用。权限仍由 Harness 自己的 permission mode 决定,不会把官方的 sandbox / approval 套到 Harness 上。
  • app-server-host.ts 只在原有的 -32076 分支里查这张表,其他未支持的 thread/* 行为不变,这三个请求也不会转发给官方。
  • docs/architecture/official-traffic-ownership.md 补充了这个例外。

把 approvalPolicy / sandboxPolicy 映射到 Harness permission mode 留作后续讨论,本 PR 不做。

验证

自动测试(Linux aarch64,Node 22.22.1):

  • 新增 packages/host-runtime/test/app-server-host.external-official-defaults.test.ts。覆盖三个方法返回空结果、不转发官方,以及其他未支持方法仍返回 -32076。已确认去掉修复后该测试失败。
  • npx vitest run --config tests/vitest.config.js packages/host-runtime/test/app-server-host:25 个文件通过、1 个跳过;296 个测试通过、2 个跳过(均为原有的跳过)。
  • npm run lint、npm run typecheck 通过;改动文件 prettier --check 通过。
  • 未运行 npm run check:rust(本 PR 没有改 Rust)和 e2e。

实机验证(本地给已安装的 0.13.2 host-runtime.mjs 打了等价补丁):

  • Remote Host:Ubuntu 26.04.1 LTS aarch64,codexhost 0.13.2,Claude Code 2.1.301。
  • 客户端:ChatGPT iOS app 1.2026.272,SSH 连接。
  • 打补丁并 codexhost remote stop && start 后,iOS app 对 Claude Code Thread 发出了 turn/start(turnTrigger: "remote_ios",不带 model),Host 返回 inProgress。Claude Code transcript 收到了这条消息,回复以 item/agentMessage/delta 流式推回 app。抓包细节见 [Bug] ChatGPT iOS app(SSH)无法向 Claude Code External Thread 发送消息:thread/settings/update 等方法被 -32076 拒绝 #543。
  • 未验证:Codex Desktop 上的回归(Desktop 不发这几个请求,所以预期不受影响),以及 macOS / Windows Remote Host。

关联 Issue

Fixes #543

🤖 Generated with Claude Code

…from non-Desktop clients

Clients without the codexhost renderer, such as the ChatGPT iOS app over
SSH, call thread/settings/update before turn/start and list attachments
and queued submissions for every open Thread. The Host rejected these for
External Threads with -32076, which aborted every send from those clients.

Answer them with the empty official response shape instead. Settings
updates are acknowledged but not applied; the Harness keeps its own
permission mode.

Refs BytePioneer-AI#543

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: BytePioneer-AI/codex-host/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2017be27-8817-4dd5-9a00-20c76cd16f97
📥 Commits

Reviewing files that changed from the base of the PR and between 1aa9f65 and 4c84411.

📒 Files selected for processing: 4
  • docs/architecture/official-traffic-ownership.md
  • packages/host-runtime/src/app-server-host.ts
  • packages/host-runtime/src/external-thread-official-defaults.ts
  • packages/host-runtime/test/app-server-host.external-official-defaults.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 3
  • GitHub Check: Check windows-latest
  • GitHub Check: Check macos-14
  • GitHub Check: Check ubuntu-22.04
📝 Summary

Summary by CodeRabbit

  • 功能调整
    • 官方客户端请求外部 Thread 的附件列表和队列列表时,会收到空列表及空游标;设置更新请求会收到空结果,但不会应用设置。
    • 其他不支持的管理请求仍返回错误。

External Thread 现在对附件列表、队列列表和设置更新请求返回官方结构的空结果。其他未映射的线程级请求仍返回原有的 -32076 错误。

Changes: External Thread 请求兼容

Layer / File(s) Summary
空结果映射与请求处理
packages/host-runtime/src/external-thread-official-defaults.ts, packages/host-runtime/src/app-server-host.ts, packages/host-runtime/test/app-server-host.external-official-defaults.test.ts, docs/architecture/official-traffic-ownership.md
为附件和队列列表请求返回空数据及空游标,为设置更新请求返回空对象。Host 对未映射请求保留原有错误。集成测试验证响应及官方进程未收到这些请求;架构文档记录例外规则。

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: bytepioneer-ai

Merge Risk: ⚪ Minimal · up to 4c844

The compatibility responses appear ready to merge after normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Description check Passed 描述准确说明了 External Thread 的三个官方兼容响应、非转发行为、测试覆盖范围和实际验证结果,与变更内容直接相关。
Title check Passed 标题明确概括了 host-runtime 为非 Desktop 客户端处理 External Thread 设置和列表请求的主要修复,内容具体且与变更一致。
Linked Issues check Passed #543 的编码要求已满足。对 External Thread,thread/attachment/list 和 thread/queue/list 返回 { data: [], nextCursor: null },thread/settings/update 返回 {} 且不应用设置。app-server-host.ts 仅在原有 External Thread 的 `…
Out of Scope Changes check Passed 改动均与 #543 直接相关。默认响应实现解决官方客户端的兼容请求,Host 分支改动接入该响应,测试验证行为,架构文档记录例外规则。改动未实现 issue 中明确留作后续的模型展示或 permission mode 映射,也未改变其他未支持的 thread/* 行为。
Full details: Linked Issues check

Explanation

#543 的编码要求已满足。对 External Thread,thread/attachment/list 和 thread/queue/list 返回 { data: [], nextCursor: null },thread/settings/update 返回 {} 且不应用设置。app-server-host.ts 仅在原有 External Thread 的 -32076 分支使用该默认值;其他未支持方法仍返回 -32076。新增测试覆盖三种响应、不转发到官方进程,以及其他方法的错误行为。

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

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.

[Bug] ChatGPT iOS app(SSH)无法向 Claude Code External Thread 发送消息:thread/settings/update 等方法被 -32076 拒绝

1 participant