Skip to content

feat(hosts): explain SSH connection failures and next steps - #5085

Merged
7Sageer merged 7 commits into
mainfrom
feat/ssh-ux-polish
Nov 19, 2026
Merged

7Sageer merged 7 commits into
mainfrom
feat/ssh-ux-polish

Conversation

@7Sageer

@7Sageer 7Sageer commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

SSH 主机连接失败时,用户需要知道该检查地址、端口、密钥,还是安装或更新 Kimi Code CLI。当前失败摘要缺少下一步,重试期间也容易丢失原有诊断。远程项目需要支持多个目录,并可以从失败提示和项目菜单直接打开对应主机设置。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

失败信息分成原因摘要与处理建议两层,主机名只在需要指代当前机器时出现。远端未安装或版本过低时提供复制命令;开始重试后,界面继续显示上一次失败原因。

flowchart LR
  A[SSH host status] --> B[Connection failure summary]
  B --> C[Guidance and copyable commands]
  C --> D[Host settings]
  E[Workspace menu] --> D
  F[Remote workspace editor] --> G[Multiple directories and primary directory]
Loading

hostsStore 记录需要聚焦的主机,openHostSettings 统一打开对应设置;desktop 与 Web 共用同一套 renderer 接线。远程目录选择返回多个路径,目录导入和 home 查询按目标 host 路由。

阅读顺序:

  1. packages/app-components/src/settings/HostsPanel.vue 与 HostTestResult.vue:失败展开、重试状态和复制命令。
  2. packages/app-components/src/composables/useHostFailureText.ts 与双语 workspace.ts:原因及处理建议。
  3. packages/app-client/src/composables/useAppDialogs.ts、packages/app-components/src/HostNotice.vue 与 WorkspaceMenu.vue:主机设置入口。
  4. WorkspaceEditDialog.vue 与 useWorkspaceFolderPicker.ts:远程多目录与主目录。
  5. packages/app-client/src/stores/workspaces.ts:按 host 查询及离线移除提示。

Screenshots / Recordings

简化连接失败时的信息展示:

SSH failure summary and next steps

把“复制自定义供应商入口”改为“导入”:

SSH host sign-in and provider import actions

主机缺少可用模型时,在 composer 中提供配置入口:

SSH host model configuration in composer

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
SSH 连接失败 只有简短失败状态 显示原因、处理建议;安装或更新场景可复制命令 desktop / Web 的 SSH 主机用户 查看原始错误详情
SSH 重试 进入 connecting 后缺少上次诊断的完整上下文 显示「正在重试」并保留上次失败原因;服务端配合保留诊断字段 正在重连 SSH 主机的 desktop / Web 用户 无需操作
模型配置 主机 ready 但未登录或没有模型时,在工作区提示登录或复制模型 在 composer 的模型入口打开对应主机设置,发送前引导完成配置 尚未配置远程模型的 desktop / Web 用户 在 SSH 设置中登录或复制模型
远程项目目录 编辑时替换单个目录 可添加多个目录并设置主目录,也可从远端项目配置导入 使用 SSH 远程项目的 desktop / Web 用户 原有单目录流程仍可使用
主机设置入口 需要从设置导航寻找主机 从连接提示和项目菜单直接打开对应主机 desktop / Web 的 SSH 主机用户 原设置入口仍可使用
离线项目移除 与在线项目共用确认文案 明确只从本应用隐藏,远端文件不删除 移除不可用 SSH 主机项目的 desktop / Web 用户 取消移除

受影响模块为 SSH 设置、composer 模型入口、工作区菜单和目录编辑。测试覆盖失败指引、复制命令、重试显示、主机聚焦、模型配置门控、远程多目录及离线移除提示。本地项目创建与编辑路径保持原行为。

测试按用户操作和行为契约合并重复场景,移除布局、样式及逐字文案断言:安装与升级命令由 HostTestResult 的参数化用例覆盖;失败行的重连与编辑入口、空主机导航和账号状态重载并入同文件场景;主目录切换的焦点、提示及提交顺序在远程编辑场景验证;配置导入与断线提交限制在远程目录场景验证。正常主机的项目编辑入口、重试诊断、发送门控、离线移除提示继续由原组件或 store 测试覆盖。

验证
  • Linux:相关 5 个测试文件,143 项通过。
  • pnpm --filter kimi-code-app run typecheck:通过。
  • pnpm lint:通过,0 warnings / 0 errors。
  • 未做真实 SSH 主机的人工端到端走查。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7339550

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@7Hanrui

7Hanrui commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-19T07:52:37.319107Z
We couldn’t complete this review. Comment @codex review to try again.
7339550 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +602 to +604
hostsStore().unavailable(hostId)
? 'workspace.removeWorkspaceConfirmHostOffline'
: 'workspace.removeWorkspaceConfirmHost',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +2656 to +2659
const hostSetupId = computed(() => {
const hostId = client.visibleWorkspace?.value?.hostId;
if (hostId === undefined || hostsStore().displayState(hostId) !== 'ready') return undefined;
return hostsStore().needsLogin(hostId) ? hostId : undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +16 to +17
const retrying = computed(() => displayState.value === 'connecting' && (error.value !== undefined || host.value?.connectFailure !== undefined));
const state = computed(() => retrying.value ? 'failed' : displayState.value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@7Sageer
7Sageer marked this pull request as ready for review November 19, 2026 06:33
@pkg-pr-new

pkg-pr-new Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@7339550
npx https://pkg.pr.new/@moonshot-ai/kimi-code@7339550

commit: 7339550

@7Hanrui

7Hanrui commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 92040663e3

ℹ️ 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".

@7Sageer
7Sageer merged commit 4a8a2f3 into main Nov 19, 2026
17 checks passed
@7Sageer
7Sageer deleted the feat/ssh-ux-polish branch November 19, 2026 08:37
7Sageer added a commit that referenced this pull request Nov 19, 2026
…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]>
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.

3 participants