Repository navigation
docs: rewrite remote environment guide for users - #4693
Conversation
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
@codex review |
Codex Review SummaryThis 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. |
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01f10d40f2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| There is **no silent fallback to the local environment** after a drop: a command like `rm` or `git` that was meant for the remote machine must never land on yours. The next tool call opens the pipe again. While the target stays unreachable, tool calls fail with an `environment.unavailable` error. A call that was already in flight on the old connection fails and is not retried on the new connection. | ||
|
|
||
| Each SSH platform probe and the executor handshake has its own 10-second limit. SSH connections using an executor path can run up to two probes before the handshake; bare executable names skip them. A target that never answers the handshake fails with an `initialize timed out` error instead of hanging silently, and when the launcher wrote anything to stderr — a stuck password prompt or an `npx` download's progress — the error includes that tail so the cause is visible. | ||
| Only Kimi Code CLI can pick an environment for one launch. Sessions created from other clients such as the Web UI use the [default environment](#setting-a-default-environment), and run on your machine when no default is set. |
There was a problem hiding this comment.
Do not claim the CLI is the only environment selector
This excludes supported API and SDK clients: sessionCreateSchema accepts environment_id and environment_cwd, POST /api/v1/sessions passes them to ISessionManager.create, and the public Node SDK exposes the equivalent CreateSessionOptions.environmentId and environmentCwd. As written, consumers may incorrectly conclude that programmatic session creation cannot override the default environment; narrow this statement to clients that currently lack a picker, such as the Web UI.
Useful? React with 👍 / 👎.
| - **Small-file latency adds up**: session startup reads many small files, and each read is a remote round trip; remote sessions start slower than local ones. | ||
| - **One shared connection per target**: workspaces bound to the same environment share a single connection instead of opening one each. The flip side: a connection drop affects every workspace bound to that target, and a turn in flight on the old connection fails as on a drop. | ||
| - **Resuming a session reconnects to its environment**: if the environment has been removed or cannot be reached, resuming fails. | ||
| - **Changing an environment's configuration disconnects it**: commands running on the target environment are terminated, and the next use connects with the new settings. |
There was a problem hiding this comment.
Limit the disconnect warning to launcher changes
When a user changes only defaultCwd, the connection is not disconnected and running commands are not terminated: declarationFingerprint() includes only the launcher fields, and reconciliation simply updates the declaration when that fingerprint is unchanged. Since defaultCwd is prominently presented as environment configuration above, this blanket warning misstates the behavior; retain the prior launcher-field qualification.
AGENTS.md reference: docs/AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
| ### Windows target environments | ||
|
|
||
| Windows targets use Git Bash for the `Bash` tool, matching local Windows sessions. Install [Git for Windows](https://gitforwindows.org/) and the Windows `kimi` binary on the target. Native PowerShell tool commands and Windows Docker containers are not supported. | ||
| Windows targets need [Git for Windows](https://gitforwindows.org/) installed (the `Bash` tool runs through Git Bash). |
There was a problem hiding this comment.
Restore the Windows Docker limitation
For a Windows Docker container, installing Git for Windows is not sufficient: the Docker launcher always runs docker exec ... sh -c, so native Windows containers are unsupported. The rewrite removes the previous explicit warning while presenting generic Windows-target setup, which can send users toward a configuration that cannot connect; state that Windows targets require SSH or a custom launcher and that Windows Docker containers are unsupported.
AGENTS.md reference: docs/AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
| kimi --environment dev-box | ||
| ``` | ||
|
|
||
| Once the session opens, the footer shows `dev-box` before the working directory. From then on, the files the agent reads and writes and the commands it runs are on `dev-box`. |
There was a problem hiding this comment.
Preserve the local plan-file exception
In Plan mode, the files handled by Read, Write, and Edit are not all on dev-box: planFileTarget() deliberately points into the local session directory, and the file tools route matching plan paths through the host filesystem before acquiring the remote environment. The rewrite deletes this exception and then states that all files the agent reads and writes are remote, so users can look for or back up plans on the wrong machine; restore the plan-file locality note.
AGENTS.md reference: docs/AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
| - **Hooks and MCP servers run on your machine by default**: they cannot see files on the target environment; stdio MCP servers can run on the target environment through `environment_id`, see [MCP](../customization/mcp.md). | ||
| - **Web tools run on your machine**: `WebSearch` and `FetchURL` reach the network your computer is on. | ||
| - **File paths in prompts resolve on the target environment**: `/tmp/x.png` refers to a file on the target environment; paste local images directly instead. | ||
| - **Tower mode is not supported**, and the footer does not show git status. |
There was a problem hiding this comment.
Document the project-agent limitation
For remote users who keep custom agents in a project's .kimi-code/agents/ or .agents/agents/, the shortened limitations list removes the only warning that neither the local launch project's nor the target project's agent profiles are discovered. The SDK regression test explicitly confirms that a remote session's profile catalog contains only user-level agents, so the missing project agent silently disappears from selectors; retain this caveat or users will reasonably expect target-project agents to work.
AGENTS.md reference: docs/AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
| - **`ControlMaster`**: BatchMode connections can ride an existing master connection — the basis of the password-only setup below. | ||
|
|
||
| Host keys use `StrictHostKeyChecking=accept-new` (trust on first use): the first connection to a new host records its key in `known_hosts` without asking, while a later host-key change fails the connection until you fix the entry by hand. | ||
| Kimi Code connects to SSH hosts non-interactively. If the following command succeeds in your terminal, Kimi Code can connect: |
There was a problem hiding this comment.
Describe the SSH probe as an authentication check
A successful ssh -o BatchMode=yes dev-box true only proves that a noninteractive command can authenticate and run; Kimi Code still has to locate the configured remoteBin, start exec-server, complete its initialization handshake, and pass executor-version and platform checks. The command therefore succeeds when the executor is missing, outdated, or incompatible, while the text tells users that Kimi Code can connect; describe it as an SSH authentication check instead.
AGENTS.md reference: docs/AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
| - **One shared connection per target**: workspaces bound to the same environment share a single connection instead of opening one each. The flip side: a connection drop affects every workspace bound to that target, and a turn in flight on the old connection fails as on a drop. | ||
| - **Resuming a session reconnects to its environment**: if the environment has been removed or cannot be reached, resuming fails. | ||
| - **Changing an environment's configuration disconnects it**: commands running on the target environment are terminated, and the next use connects with the new settings. | ||
| - **An outdated Kimi Code CLI on the target environment cannot connect**: run the install command again on the target environment to upgrade. |
There was a problem hiding this comment.
Upgrade the configured executor path
When an environment overrides remoteBin with an absolute path or a bare executable name, rerunning the page's standard install command updates the default ~/.kimi-code/bin/kimi, not necessarily the executable the launcher still invokes. That leaves the configured executor below the minimum version and the connection continues to fail; the guidance should tell users to replace the binary at the configured remoteBin path or update the setting to the newly installed binary.
AGENTS.md reference: docs/AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01f10d40f2
ℹ️ 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".
| ### Windows target environments | ||
|
|
||
| Windows targets use Git Bash for the `Bash` tool, matching local Windows sessions. Install [Git for Windows](https://gitforwindows.org/) and the Windows `kimi` binary on the target. Native PowerShell tool commands and Windows Docker containers are not supported. | ||
| Windows targets need [Git for Windows](https://gitforwindows.org/) installed (the `Bash` tool runs through Git Bash). |
There was a problem hiding this comment.
Restore the Windows process-tree cleanup caveat
For Windows targets running background commands whose leader exits first, this rewrite removes the previous warning that orphaned descendants may survive (base guide line 155). ProcessManager.maybeClose() drops the exited entry and returns on win32 instead of retaining the process group (packages/agent-core-v2/src/remote/server/processManager.ts:225-240), so users can leave remote processes behind; keep this caveat in the Windows section.
AGENTS.md reference: docs/AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
Requirement or Bug
远程环境指南(
docs/*/guides/remote-environment.md)原本更像设计规格:大量篇幅在讲路径规范化、错误码、心跳参数、/new的绑定优先级这类实现细节,用户真正关心的"怎么把一台机器或容器配起来"反而被淹没。这个 PR 把它改写成面向用户的任务式文档。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路:指南只保留用户配置和使用远程环境时需要的信息——每种接入方式一个最小可抄的示例,加上会踩到的限制;字段级细节交给
config-files.md#environments。页面结构(中英文镜像):
关键取舍:
kimi二进制(官方安装脚本默认落在~/.kimi-code/bin/kimi,与remoteBin默认值一致),"执行器"对用户不直观remoteBin默认值,零配置删除的内容清单
defaultCwd的路径规范化与符号链接语义config.invalid、environment.not_found、environment.unavailable等错误码/new在无会话时取--environment的优先级StrictHostKeyChecking机制说明、ControlMaster方案/feedback、项目级 Agent 文件、远程无热重载、Windows 进程树清理其余改动:
config-files.md:remoteBin字段说明从"执行器路径"改为"kimi的路径";Windows 链接指向新锚点。kimi-command.md:--environment的链接指向新锚点。Behavior Changes and Affected Users
None。只改
docs/下的 Markdown,不进入任何发布产物;没有改动代码、配置、契约文件。文档内锚点变化:
#windows-目标→#windows-目标环境、#windows-targets→#windows-target-environments、#kimi-environment-与-environment-cwd→#临时指定环境、#kimi-environment-and-environment-cwd→#picking-an-environment-for-one-launch;仓库内引用已同步更新,VitePress 构建无死链。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.