Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 97d0324 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
liruifengv
approved these changes
Nov 17, 2026
6 tasks done
Collaborator
Author
|
Re-submitted against |
This branch has not been deployed
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.
Requirement or Bug
在只能通过 HTTP 代理访问公网的 CLI / desktop 内嵌服务器环境中,Remote Control 的 relay WebSocket 仍尝试直连,导致连接无法建立。此 PR 让 management、HTTP tunnel 和 stream WebSocket 遵循现有代理环境变量,使这些环境中的 Remote Control 可以通过代理连接 relay。
Bug Reproduction Steps
HTTP_PROXY/HTTPS_PROXY,然后启用 Remote Control。CONNECT隧道建立;NO_PROXY命中的目标和本地 WebSocket 仍直连。Root Cause
ws不会读取 CLI 为 fetch / undici 安装的全局 dispatcher。Remote Control 在connectWebSocketAttempt中直接构造WebSocket,但没有传 Node HTTP agent,因此代理环境变量对这条传输路径无效。这是根本修复:在 relay 建连边界补齐
ws原生支持的代理 agent,而不是增加重试或绕过现有传输。Code Changes
复用现有代理地址和
NO_PROXY解析,为每个 Remote Control client 的 relay origin 创建一个HttpsProxyAgent。该 agent 只注入 relay 连接,不安装为全局 agent,因此本地 loopback WebSocket 不会受到影响。ws使用HTTP_PROXY/http_proxy,wss使用HTTPS_PROXY/https_proxy,保留 HTTPALL_PROXY回退和NO_PROXY语义。NO_PROXY时维持原直连路径;非法代理 URL 沿用现有容错方式,警告后直连。https-proxy-agent@7.0.6补为remote-control的直接依赖,并更新锁文件。CONNECT代理,使用无法直接解析的中性 relay 域名验证两条初始 relay 连接都经过代理,同时保留 Authorization 断言;测试总数不变。Behavior Changes and Affected Users
CONNECT建连NO_PROXYNO_PROXYws不读取配置,静默直连受影响模块与覆盖:
packages/remote-control:本地和 m0-dev 均为 51/51;typecheck、build 通过。真实回归覆盖代理CONNECT、management / HTTP tunnel 和既有 Authorization 行为;stream 与鉴权回退复用同一已接线的connectRelay路径。packages/agent-core-v2:仅导出既有代理解析函数,typecheck 通过;既有NO_PROXY工具测试继续覆盖回环地址和匹配语义。remote-control、kap-server、CLI build 通过,CLI bundle 已确认包含代理实现。完整验证记录与未改动区域失败
packages/agent-core-v2/test/remote/process.test.ts的 2 个全量失败在隔离重跑中随全文件 23/23 通过。apps/kimi-code/test/tui/kimi-tui-startup.test.ts的 4 个 OAuth 启动用例在全量和隔离重跑中均为 5 秒超时。该文件及其行为不在本 PR diff 或代理建连路径中,因此这里不宣称全量测试通过。lint:imports仍有 4 处位于未改文件的报告;sherif仍有 3 个缺失 package.json 的 workspace warning,均未由本 PR 引入或扩大。Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.