Skip to content

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

Merged
BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
tyyzqmf:fix/external-thread-mobile-defaults
Oct 17, 2026
Merged

BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
tyyzqmf:fix/external-thread-mobile-defaults

Conversation

@tyyzqmf

@tyyzqmf tyyzqmf commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

目的

修复 #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) <[email protected]>
@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: 482b1503-e5f7-4c4a-ac48-b1d7fd2a611e
📥 Commits

Reviewing files that changed from the base of the PR and between 4c84411 and 8cc4e5d.

📒 Files selected for processing: 5
  • 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
  • packages/host-runtime/test/app-server-host.official-passthrough.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: 4
  • GitHub Check: Check windows-latest
  • GitHub Check: Check macos-14
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check Linux ARM64
📝 Summary

Summary by CodeRabbit

  • 功能调整
    • 外部 Thread 的附件列表和队列列表请求会返回空列表及空游标。
    • 设置更新仅在使用中性默认值时返回空结果,且不会改变原有权限模式;包含其他设置值的请求仍会报错。
    • 原生 Codex Thread 的相关请求继续按原样转发;其他不支持的管理请求仍会报错。

External Thread 现在对附件列表、队列列表和符合中性默认值的设置更新请求返回官方结构的空结果。其他未映射或设置参数不符合条件的请求仍返回 -32076。原生 Codex Thread 请求继续原样转发。

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, packages/host-runtime/test/app-server-host.official-passthrough.test.ts, docs/architecture/official-traffic-ownership.md
附件和队列列表请求返回空数据及空游标。设置更新仅在字段符合中性默认值时返回空对象;其他设置仍返回 -32076。测试覆盖外部请求的结果及原生 Codex Thread 的原样转发。

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 8cc4e

The compatibility change is mergeable after normal checks; no concrete outstanding issue is established.

Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed 已满足 #543 的编码要求。External Thread 的 thread/attachment/list 和 thread/queue/list 返回空数据及 nextCursor: null。thread/settings/update 仅接受中性默认值、省略字段或 null,并返回成功结果且不改变 Harness 权限。非中性设置和未知字段继续返回 -32076。…
Out of Scope Changes check Passed 改动均与 #543 直接相关。Host 分支和默认响应函数实现官方客户端所需的兼容行为。测试验证外部 Thread 与原生 Codex Thread 的边界。架构文档记录该例外。改动未实现模型展示、权限模式映射或其他明确留作后续的功能。
Title check Passed 标题准确概括了主要变更:Host 为非 Desktop 客户端的 External Thread 设置和列表请求提供响应。措辞清晰且具体。
Description check Passed 描述与变更相关。它说明了三个请求类型、接受的默认设置、错误处理、透传行为和测试结果。
Full details: Linked Issues check

Explanation

已满足 #543 的编码要求。External Thread 的 thread/attachment/list 和 thread/queue/list 返回空数据及 nextCursor: null。thread/settings/update 仅接受中性默认值、省略字段或 null,并返回成功结果且不改变 Harness 权限。非中性设置和未知字段继续返回 -32076。原生 Codex Thread 请求继续原样转发。新增测试覆盖这些响应、未转发行为和不支持方法的错误行为。

✨ 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.

Accept only the neutral Codex defaults sent before mobile submissions, leaving native Harness permissions unchanged. Reject restrictive policies and other settings rather than acknowledging unapplied changes.

Verify default acknowledgements allow a subsequent Turn, preserve native Codex passthrough, and reject permission, model, cwd and unknown setting changes.
@BytePioneer-AI
BytePioneer-AI merged commit 389e21d into BytePioneer-AI:main Oct 17, 2026
5 checks passed
BytePioneer-AI added a commit that referenced this pull request Oct 17, 2026
Revert the additions from 8cc4e5d, including the settings guard, extra tests and documentation changes. Keep the original implementation authored in 4c84411.
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 拒绝

2 participants