Repository navigation
feat(hosts): explain SSH connection failures and next steps - #5100
Conversation
* 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)
|
|
@codex review |
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: |
There was a problem hiding this comment.
💡 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".
| hostsStore().unavailable(hostId) | ||
| ? 'workspace.removeWorkspaceConfirmHostOffline' | ||
| : 'workspace.removeWorkspaceConfirmHost', |
There was a problem hiding this comment.
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 👍 / 👎.
| 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.
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", |
There was a problem hiding this comment.
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 👍 / 👎.
| (decision.kind === 'builtin-command' && decision.leave === true); | ||
| if (sessionBound && props.beforeSubmit !== undefined && props.beforeSubmit() === false) return; | ||
| if (sessionBound && !passSubmitGate()) return; |
There was a problem hiding this comment.
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 👍 / 👎.
| 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 }); |
There was a problem hiding this comment.
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 👍 / 👎.
| 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 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 👍 / 👎.
Requirement or Bug
将已合并的 #5085 backport 到
release/2026-11-19,让本次 release 的 desktop / Web SSH 主机用户获得连接失败指引、主机设置快捷入口和远程项目多目录能力。本 PR 只有从
4a8a2f3d4e9a30027c4e5854a1d880d6a444ee65cherry-pick 的26bea7d0f1fbe3218fb874ba1369fb06f3a0b20a;cherry-pick 无冲突。按任务决定不新增 changeset。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
沿用 #5085 中已验证的界面截图;本次 cherry-pick 无冲突。
简化连接失败时的信息展示:
把“复制自定义供应商入口”改为“导入”:
主机缺少可用模型时,在 composer 中提供配置入口:
Behavior Changes and Affected Users
受影响模块为 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 来源标记不同。workspaces-store、hostDisplayName、hostsPanel、workspaceEditDialog共 137 项通过。composerRunningSendMode的新增主机模型配置用例通过;同文件 5 个旧用例失败,其中 4 个超时、1 个受前序未挂载影响。release 基线独立运行该文件也复现前述 3 个运行中发送用例超时;该文件在本机 backport 上 6 项通过。未修改这些旧测试。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.