Repository navigation
feat(hosts): explain SSH connection failures and next steps - #5085
Conversation
|
|
@codex review |
Codex Review Summary: ❌ FailedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6cb492fa9
ℹ️ 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".
| hostsStore().unavailable(hostId) | ||
| ? 'workspace.removeWorkspaceConfirmHostOffline' | ||
| : 'workspace.removeWorkspaceConfirmHost', |
There was a problem hiding this comment.
Show offline removal copy for failed SSH hosts
When an SSH host is disconnected with a connection error, its display state is failed, but unavailable() only recognizes disabled and missing, so this branch incorrectly shows the online-removal message. deleteWorkspace() then catches the failed remote deletion and removes only the local entry, meaning users are told other clients will stop seeing the project even though its remote record remains; use the offline copy for failed/blocked hosts as well.
AGENTS.md reference: AGENTS.md:L190-L190
Useful? React with 👍 / 👎.
| const hostSetupId = computed(() => { | ||
| const hostId = client.visibleWorkspace?.value?.hostId; | ||
| if (hostId === undefined || hostsStore().displayState(hostId) !== 'ready') return undefined; | ||
| return hostsStore().needsLogin(hostId) ? hostId : undefined; |
There was a problem hiding this comment.
Gate signed-in hosts that still have no models
When a ready SSH host is authenticated but reports modelsReady: false, needsLogin() returns false because it only matches signedOut, so hostSetupId remains undefined and neither the setup pill nor the submit gate is activated. This is a valid account state already represented by HostAccount, and the general chat gate deliberately returns ok for every remote host, so these users submit into a host with no resolvable model and receive a backend failure instead of the new configuration flow; gate on the host account's model readiness, not only its sign-in status.
AGENTS.md reference: AGENTS.md:L190-L190
Useful? React with 👍 / 👎.
| host_unreachable: 'Check your local network, VPN, or routing settings', | ||
| connect_timeout: 'Make sure {name} is online and the SSH port is allowed through the firewall or security group', | ||
| authentication_failed: 'Check the SSH key and username, then reconnect', | ||
| host_key_changed: "Verify {name}'s identity, run ssh-keygen -R {host} locally, then reconnect", |
There was a problem hiding this comment.
Normalize host targets before suggesting ssh-keygen -R
For accepted SSH targets such as [email protected] or ssh://[email protected]:2222, interpolating the raw {host} produces a command that does not remove the actual known-hosts entry. The local ssh-keygen usage specifies ssh-keygen -R hostname; user prefixes must be removed and non-default ports use the [hostname]:port key form. Parse the configured target into that lookup form before displaying this remediation.
AGENTS.md reference: AGENTS.md:L190-L190
Useful? React with 👍 / 👎.
| import { copyTextToClipboard } from '@moonshot-ai/app-core/lib'; | ||
| import { Icon, Spinner } from '@moonshot-ai/app-ui'; | ||
|
|
||
| const UPDATE_COMMAND = 'kimi upgrade'; |
There was a problem hiding this comment.
Upgrade the configured remote executable
When a host uses the Advanced “Kimi Code CLI executable” setting, an outdated result was produced by invoking that configured path, but the copy action always emits kimi upgrade. If the configured binary is /opt/kimi, kimi-canary, or otherwise absent from PATH, the suggested command either fails or upgrades a different installation; construct the command from the host's remoteBin with shell-safe quoting.
AGENTS.md reference: AGENTS.md:L190-L190
Useful? React with 👍 / 👎.
| import { Icon, Spinner } from '@moonshot-ai/app-ui'; | ||
|
|
||
| const UPDATE_COMMAND = 'kimi upgrade'; | ||
| const INSTALL_COMMAND = 'curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash'; |
There was a problem hiding this comment.
Respect the active region in the install command
Global clients use the repository's https://code.kimi.ai/kimi-code CDN profile, but this action always copies the mainland .com installer URL. For global users whose network cannot reach the mainland endpoint, the advertised recovery command fails precisely when they need to install the missing CLI; derive the installer URL from the existing region profile instead of duplicating one profile here.
AGENTS.md reference: AGENTS.md:L107-L107
Useful? React with 👍 / 👎.
| const retrying = computed(() => displayState.value === 'connecting' && (error.value !== undefined || host.value?.connectFailure !== undefined)); | ||
| const state = computed(() => retrying.value ? 'failed' : displayState.value); |
There was a problem hiding this comment.
Preserve the diagnostic before marking a retry
Once a retry reaches the server, SshKapBridge.establish() calls update('connecting'), whose optional arguments overwrite both the previous failure and error with undefined before publishing the host snapshot. This predicate then becomes false, state changes to plain connecting, and the notice disappears for most of the retry; HostsPanel.retrying() has the same dependency. Preserve the last diagnostic in the server snapshot or separately in the client rather than relying on fields that the retry transition clears.
AGENTS.md reference: AGENTS.md:L190-L190
Useful? React with 👍 / 👎.
commit: |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
9204066 to
8721b69
Compare
Signed-off-by: 7Sageer <[email protected]>
Signed-off-by: 7Sageer <[email protected]>
Signed-off-by: 7Sageer <[email protected]>
Signed-off-by: 7Sageer <[email protected]>
Signed-off-by: 7Sageer <[email protected]>
…5100) * feat(hosts): explain SSH connection failures and next steps * test(hosts): consolidate UX behavior coverage * Delete .changeset/ssh-connect-failure-guidance.md * Delete .changeset/ssh-offline-project-remove.md * Delete .changeset/ssh-host-login-failure.md * Delete .changeset/ssh-host-project-directories.md * Delete .changeset/ssh-open-host-settings.md --------- (cherry picked from commit 4a8a2f3) Signed-off-by: 7Sageer <[email protected]>
Requirement or Bug
SSH 主机连接失败时,用户需要知道该检查地址、端口、密钥,还是安装或更新 Kimi Code CLI。当前失败摘要缺少下一步,重试期间也容易丢失原有诊断。远程项目需要支持多个目录,并可以从失败提示和项目菜单直接打开对应主机设置。
Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
失败信息分成原因摘要与处理建议两层,主机名只在需要指代当前机器时出现。远端未安装或版本过低时提供复制命令;开始重试后,界面继续显示上一次失败原因。
hostsStore记录需要聚焦的主机,openHostSettings统一打开对应设置;desktop 与 Web 共用同一套 renderer 接线。远程目录选择返回多个路径,目录导入和 home 查询按目标 host 路由。阅读顺序:
packages/app-components/src/settings/HostsPanel.vue与HostTestResult.vue:失败展开、重试状态和复制命令。packages/app-components/src/composables/useHostFailureText.ts与双语workspace.ts:原因及处理建议。packages/app-client/src/composables/useAppDialogs.ts、packages/app-components/src/HostNotice.vue与WorkspaceMenu.vue:主机设置入口。WorkspaceEditDialog.vue与useWorkspaceFolderPicker.ts:远程多目录与主目录。packages/app-client/src/stores/workspaces.ts:按 host 查询及离线移除提示。Screenshots / Recordings
简化连接失败时的信息展示:
把“复制自定义供应商入口”改为“导入”:
主机缺少可用模型时,在 composer 中提供配置入口:
Behavior Changes and Affected Users
受影响模块为 SSH 设置、composer 模型入口、工作区菜单和目录编辑。测试覆盖失败指引、复制命令、重试显示、主机聚焦、模型配置门控、远程多目录及离线移除提示。本地项目创建与编辑路径保持原行为。
测试按用户操作和行为契约合并重复场景,移除布局、样式及逐字文案断言:安装与升级命令由
HostTestResult的参数化用例覆盖;失败行的重连与编辑入口、空主机导航和账号状态重载并入同文件场景;主目录切换的焦点、提示及提交顺序在远程编辑场景验证;配置导入与断线提交限制在远程目录场景验证。正常主机的项目编辑入口、重试诊断、发送门控、离线移除提示继续由原组件或 store 测试覆盖。验证
pnpm --filter kimi-code-app run typecheck:通过。pnpm lint:通过,0 warnings / 0 errors。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.