Skip to content

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

Merged
7Sageer merged 1 commit into
release/2026-11-19from
backport/5085-to-release-2026-11-19
Nov 19, 2026
Merged

7Sageer merged 1 commit into
release/2026-11-19from
backport/5085-to-release-2026-11-19

Conversation

@7Sageer

@7Sageer 7Sageer commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

将已合并的 #5085 backport 到 release/2026-11-19,让本次 release 的 desktop / Web SSH 主机用户获得连接失败指引、主机设置快捷入口和远程项目多目录能力。

本 PR 只有从 4a8a2f3d4e9a30027c4e5854a1d880d6a444ee65 cherry-pick 的 26bea7d0f1fbe3218fb874ba1369fb06f3a0b20a;cherry-pick 无冲突。按任务决定不新增 changeset。

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

沿用 #5085 中已验证的界面截图;本次 cherry-pick 无冲突。

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

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

未做真实 SSH 主机的人工端到端走查。

验证
  • pnpm lint:通过,0 warnings / 0 errors。
  • pnpm --filter kimi-code-app run typecheck:通过。
  • git range-diff 4a8a2f3d^! origin/release/2026-11-19..HEAD:只有 cherry-pick 来源标记不同。
  • Linux:workspaces-store、hostDisplayName、hostsPanel、workspaceEditDialog 共 137 项通过。
  • Linux:composerRunningSendMode 的新增主机模型配置用例通过;同文件 5 个旧用例失败,其中 4 个超时、1 个受前序未挂载影响。release 基线独立运行该文件也复现前述 3 个运行中发送用例超时;该文件在本机 backport 上 6 项通过。未修改这些旧测试。

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.

* feat(hosts): explain SSH connection failures and next steps

* test(hosts): consolidate UX behavior coverage

* Delete .changeset/ssh-connect-failure-guidance.md

Signed-off-by: 7Sageer <[email protected]>

* Delete .changeset/ssh-offline-project-remove.md

Signed-off-by: 7Sageer <[email protected]>

* Delete .changeset/ssh-host-login-failure.md

Signed-off-by: 7Sageer <[email protected]>

* Delete .changeset/ssh-host-project-directories.md

Signed-off-by: 7Sageer <[email protected]>

* Delete .changeset/ssh-open-host-settings.md

Signed-off-by: 7Sageer <[email protected]>

---------

Signed-off-by: 7Sageer <[email protected]>
(cherry picked from commit 4a8a2f3)
@changeset-bot

changeset-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 26bea7d

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: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T10:15:58.624146Z 26bea7d Manual request
ℹ️ 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.

@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@26bea7d
npx https://pkg.pr.new/@moonshot-ai/kimi-code@26bea7d

commit: 26bea7d

@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: 26bea7d0f1

ℹ️ 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 +677 to +679
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 Treat connection-failed hosts as offline in removal copy

When an SSH host is in the normal failed state, unavailable() returns false because it only recognizes disabled or missing hosts, so the confirmation incorrectly claims that other clients will stop seeing the project. If deleteWorkspace() cannot reach that host, it catches the cleanup error and only hides the local entry, which is exactly the behavior described by removeWorkspaceConfirmHostOffline; select the offline copy for failed hosts as well.

Useful? React with 👍 / 👎.

Comment on lines +8 to +9
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 Build recovery commands from the configured remote binary

When a host uses the Advanced “Kimi Code CLI executable” setting, these fixed commands may operate on a different installation: an outdated custom binary such as /opt/kimi is not upgraded by kimi upgrade, and installing the default binary does not fix a configuration that still points to a missing custom path. Pass the host's remoteBin into this component and construct an applicable command, or omit the copy action when the configured path cannot be handled.

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 the target passed to ssh-keygen

When the configured SSH address is one of the explicitly supported forms such as user@host, an ssh:// URL, or a non-default port, interpolating the raw address produces a command that does not remove the corresponding known-host key. OpenSSH's usage defines this operand as ssh-keygen -R hostname (with [host]:port needed for a port-specific entry), so users can follow this guidance and remain stuck on the same host-key error; derive and safely quote the effective hostname/port instead.

Useful? React with 👍 / 👎.

Comment on lines 1788 to +1789
(decision.kind === 'builtin-command' && decision.leave === true);
if (sessionBound && props.beforeSubmit !== undefined && props.beforeSubmit() === false) return;
if (sessionBound && !passSubmitGate()) return;

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 Allow session-reset commands through the model setup gate

When a ready SSH host has no configured models, passSubmitGate() opens host settings for every decision classified as sessionBound, including the model-independent /new and /clear built-ins (leave === true). Those commands previously remained usable and are needed to leave or reset the current session, but now typing either command does nothing except open settings; apply the host-model gate only to decisions that actually send work while retaining the existing trust gate where required.

Useful? React with 👍 / 👎.

Comment on lines 448 to 453
async function setEnabled(row: AppHost, value: boolean): Promise<void> {
if (pendingId.value !== '' || value === enabled(row)) return;
if (pendingIds.value[row.id] || busy.value || value === enabled(row)) return;
error.value = '';
pendingId.value = row.id;
pendingIds.value = { ...pendingIds.value, [row.id]: true };
try {
await store.save(row.id, { ...hostDefinition(row), enabled: value ? undefined : false });

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 Serialize host enablement saves or discard stale reloads

When users toggle two different host switches before the first request finishes, the per-row pendingIds check now permits both store.save() calls concurrently. Each save performs a putHost followed by load(), so an earlier list request can resolve after the later one and overwrite byId with a stale snapshot, making one switch appear reverted even though the server accepted it; retain the previous global write lock or add request-generation protection around the reload.

Useful? React with 👍 / 👎.

Comment on lines +2657 to +2659
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.

P2 Badge Gate signed-in hosts that still have no models

When the remote account is signed in but reports modelsReady: false, needsLogin() deliberately returns false, so hostSetupId remains unset even though the host cannot run a chat. Remote workspaces otherwise force chatGateVerdict to ok, which means the new host-settings pill and submit interception are both skipped and the unusable prompt is sent; base this setup gate on the remote account's modelsReady state rather than only the signed-out predicate.

Useful? React with 👍 / 👎.

@7Sageer
7Sageer merged commit 5be33da into release/2026-11-19 Nov 19, 2026
19 checks passed
@7Sageer
7Sageer deleted the backport/5085-to-release-2026-11-19 branch November 19, 2026 10:21
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.

2 participants