Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7147f43
feat(ssh): add-and-connect fallback row for launcher search misses
zher52 Nov 4, 2026
2133ee7
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 4, 2026
4a91d03
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 4, 2026
c3a0534
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 4, 2026
1d200ee
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 9, 2026
a90c33c
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 9, 2026
594f5c8
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 10, 2026
13ece11
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 12, 2026
8a5da2a
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 12, 2026
19da736
fix(ssh): quick-add reuses the saved profile on a destination collision
zher52 Nov 12, 2026
078a912
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 12, 2026
140d95c
fix(ssh): make quick-add save one leased transaction
zher52 Nov 12, 2026
5e6a130
fix(ssh): only roll back a password this save actually wrote
zher52 Nov 13, 2026
9e69edb
test(ssh): keep the no-write rollback regression out of the platform …
zher52 Nov 13, 2026
e8142fa
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 13, 2026
f1a7e3b
fix(ssh): hand focus back to the terminal when quick-add is cancelled
zher52 Nov 13, 2026
53080f0
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 14, 2026
0c13ad3
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 14, 2026
264e6af
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 15, 2026
e57af08
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 16, 2026
80bd8ea
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 16, 2026
886927c
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 16, 2026
4035e49
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 16, 2026
20c05d4
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 17, 2026
b77d33a
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 17, 2026
1f7a3e5
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 18, 2026
f62c704
Merge remote-tracking branch 'origin/main' into feat/palette-add-ssh-…
zher52 Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Launcher "add and connect" fallback row

## Status

Accepted (#864).

## Context

Cmd/Ctrl+K and the command palette share one row projection
(`workspace/palette.rs::filtered_palette_rows`). Both list the same SSH host
authority (`SshHostLists`: saved/pinned plus `~/.ssh/config`). Typing a host
that is not in that authority produced an empty result with no next step: the
user had to open Settings → SSH, add the host, then come back and connect.

The rows are a projection, not a connection authority. A new host therefore
cannot be connected straight from the row: it has no profile, no credentials
and no label. The editor already owns validation, persistence, credential
storage and the `SettingsPaneEvent::LaunchSsh` transition that the host
library's "Connect" button uses.

## Evidence

- Row projection and filtering: `nebula_app/src/gpui_shell/workspace/palette.rs`.
- Existing edit dispatch pattern (`window.defer` into the settings pane):
`nebula_app/src/gpui_shell/workspace/launcher_menu.rs`.
- Prefilled editor and save pipeline:
`nebula_app/src/gpui_shell/ssh_settings.rs` (`open_ssh_editor`,
`save_ssh_editor`).
- Connect transition: `SettingsPaneEvent::LaunchSsh` handled in
`nebula_app/src/gpui_shell/workspace/settings_navigation.rs`.

## Decision

- When filtering yields no rows and the query looks like a host address
(non-empty, no whitespace, at least three characters, contains `@` or `.`),
append one row whose action is `WorkspacePaletteAction::AddSshHostAndConnect`.
- Address validity is decided by the editor's save-time validation, not by the
row predicate. A false positive only costs an opened editor.
- The action opens a workspace-owned overlay (`workspace/ssh_quick_add.rs`)
instead of navigating to Settings: the user's intent is "connect", and a
page switch in between is not part of that intent. The overlay renders above
the terminal, closes on Esc/Backdrop, and Enter submits.
- Field order and wording mirror the Settings editor's basic form exactly
(name optional, then address+port on one row with the address hint and a
composed-destination preview, then username, divider, the same segmented
authentication row in the same mode order). Divergence on purpose: the
overlay has no group/tags/notes organization block and no private-key file
picker. Choosing "Key" shows a hint and saving is rejected with guidance,
because a public-key profile without keys cannot connect. Validation,
destination composition, persistence and credential storage reuse the
existing authorities (`validate_ssh_destination`, `join_destination_*`,
`SshProfiles::save`, `ssh_credentials::store_password`); the full editor in
Settings remains the authority for proxy/jump/key/icon configuration, and
both write the same `ssh_profiles.json`.
- "More settings" carries the composed destination into the Settings editor
(`manage_launcher_ssh(dest, edit=true)`), so half-filled work continues
there instead of being retyped.
- Persistence is split from connecting (`persist_quick_add`), so failures keep
the overlay open with the reason, and tests can verify the disk side without
opening a session.

## Rejected alternatives

- Connect the typed address directly without saving: the existing design
records a first connection in `saved_hosts` anyway, and password hosts still
need the editor, so it would split one flow into two authorities.
- Only add the row to the launcher and not the command palette: both render the
same projection, so gating one would fork the row source.
- Treat the row as "edit this host": `Some(destination)` skips the new-host
username default, which produced `core.example.cn` instead of
`root@core.example.cn` in testing.
- Persist the intent: it describes one in-flight editor session, not user
configuration.

## Consequences

- New-host onboarding from the launcher is one flow: search → add → save →
connected tab, using the same profile/credential/label path as the host
library.
- Quick Jump folder/agent scopes and the launcher's Shell filter never show the
row; All and SSH views do.
- A host typed but never saved leaves no trace; cancel and Esc clear the intent.

## Validation

- `workspace::ssh_quick_add::tests::quick_add_draft_composes_and_validates`
covers destination composition, the port range and authority rejection.
- `workspace::ssh_quick_add::tests::quick_add_persists_a_nameless_profile_before_any_connection`
covers the disk side against a temp file: no auto "Host N" label, Auto auth.
The public-key save guard is asserted by the same module's validation test
path (`KeysNeedAdvancedEditor`).
- `workspace::palette::palette_tests::plausible_ssh_query_needs_host_shape`
covers the row predicate.
- i18n contract (`HostsAddAndConnect` with a `{destination}` placeholder),
`cargo fmt`, and `scripts/check_architecture.py --base origin/main` pass.

## Supersedes

None.

## Revisit when

The host library gains a way to create a profile without the editor (for
example a dedicated quick-add dialog), or the launcher starts owning connection
state rather than projecting it.
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Quick-add collision reuse and credential ordering

## Status

Accepted (#869 review, 2026-11-12).

## Context

The quick-add overlay only opens on a launcher search miss, but the final
validated destination is decided at save time: the user can start the form for
one address and edit it onto a destination that already has a saved profile.
`persist_quick_add` built a fresh subset profile (empty keys, default
connection options) and `SshProfiles::upsert` replaces the stored profile for
that exact destination, so saving silently discarded private keys, jump route,
label and icon and then connected with the degraded replacement. Password
storage also ran after `profiles.save()`, so a credential-storage failure was
reported by the form after the profile file had already changed.

## Evidence

- Save path: `nebula_app/src/gpui_shell/workspace/ssh_quick_add.rs`
(`persist_quick_add_with`).
- Replace-on-exact-match semantics and the existence probe:
`nebula_app/src/ssh_profiles.rs` (`SshProfiles::upsert`,
`SshProfiles::contains_destination`).
- Review reproduction on PR #869 (2026-11-12): a populated
`deploy@box.example` profile replaced through a quick-add save.

## Decision

- Save-time duplicate resolution against the final validated destination:
when the host library already holds a profile for it, quick-add persists
nothing and writes no credentials; it returns the destination and
`add_ssh_terminal` connects through the saved profile. Editing keys, jump,
label or icon remains the Settings editor's job via "More settings".
- Credential storage runs before the profile file is written: a
credential-storage failure leaves the host library untouched and the overlay
open with the error. The write set is one profile plus one credential, so
all-or-nothing ordering is achievable here.

## Rejected alternatives

- Overwrite the existing profile with the subset form: destroys editor-owned
fields and connects with the degraded replacement (the reported bug).
- Profile-save first with a partial-success message (the Settings editor's
pattern for proxy credentials): the overlay has no UI state for "saved but
password missing", so the kept-open form would invite a retry that now
collides with the profile it just wrote.
- Auto-route the collision into the Settings editor: the overlay's purpose is
connecting; silently switching pages breaks the one-flow intent recorded in
`2026-11-03-launcher-add-and-connect-ssh.md`.

## Consequences

- Typing an existing host's address into quick-add connects with the saved
configuration and changes nothing on disk or in the credential store.
- A stored password can exist for a destination whose profile save later
fails; it is keyed by destination and overwritten or reused by the next
successful save for that host.

## Validation

- `quick_add_collision_reuses_the_saved_profile_untouched`: a populated
profile (keys, jump host, label, icon) survives a colliding save
byte-for-byte and the injected credential recorder sees no call.
- `quick_add_password_failure_leaves_the_host_library_untouched`: a failing
credential store is injected and the profile file is never created.
- `persist_quick_add_with` takes the credential write as a parameter,
mirroring the closure-injected tests of `platform::credentials`, so tests
never touch the user keychain.

## Supersedes

None. Amends the persistence paragraph of
`2026-11-03-launcher-add-and-connect-ssh.md`.

## Revisit when

The overlay gains field-level merge into an existing profile, or the host
library grows a create path outside the Settings editor.
8 changes: 7 additions & 1 deletion nebula_app/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,11 @@
"title": "SSH hosts",
"subtitle": "Organize your saved hosts, manage sign-in options, and open a terminal.",
"add": "Add host",
"quick_add_title": "Add SSH host",
"quick_add_save_and_connect": "Save and connect",
"quick_add_address_required": "Enter a host address",
"quick_add_port_invalid": "Port must be 1-65535",
"add_and_connect": "Add and connect {destination}",
"connect": "Connect",
"exchange": "Import / export",
"pinned": "Pinned",
Expand All @@ -1190,7 +1195,8 @@
"via": "via {host}",
"connection_time_unknown": "Connection time has not been recorded for this host.",
"key_file": "Private key {name}",
"search_placeholder": "Name, address, tags"
"search_placeholder": "Name, address, tags",
"quick_add_keys_advanced": "Private keys are added in the full editor (More settings)"
},
"vcs": {
"changes": "Changes",
Expand Down
8 changes: 7 additions & 1 deletion nebula_app/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,11 @@
"title": "SSH 主机",
"subtitle": "整理已保存的主机、管理登录方式,直接打开终端会话。",
"add": "添加主机",
"quick_add_title": "添加 SSH 主机",
"quick_add_save_and_connect": "保存并连接",
"quick_add_address_required": "请填写主机地址",
"quick_add_port_invalid": "端口必须是 1–65535",
"add_and_connect": "添加并连接 {destination}",
"connect": "连接",
"exchange": "导入 / 导出",
"pinned": "置顶",
Expand All @@ -1190,7 +1195,8 @@
"via": "经 {host}",
"connection_time_unknown": "这台主机尚无已记录的连接时间。",
"key_file": "私钥 {name}",
"search_placeholder": "名称、地址、标签"
"search_placeholder": "名称、地址、标签",
"quick_add_keys_advanced": "私钥文件请在完整编辑器(更多设置)中添加"
},
"vcs": {
"changes": "变更",
Expand Down
2 changes: 1 addition & 1 deletion nebula_app/src/gpui_shell/ssh_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::gpui_shell::settings_pane::{SettingsPane, SettingsPaneEvent, SshStatu
use crate::gpui_shell::widgets::NebulaButton;

mod advanced;
mod editor;
pub(super) mod editor;
pub(super) mod library;
#[cfg(all(test, feature = "gpui-test-support"))]
mod serial_tests;
Expand Down
12 changes: 9 additions & 3 deletions nebula_app/src/gpui_shell/ssh_settings/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const EDITOR_WIDTH: f32 = 512.0;
const EDITOR_HEIGHT: f32 = 720.0;
const EDITOR_PADDING: f32 = 28.0;

pub(super) fn editor_input(
pub(in crate::gpui_shell) fn editor_input(
state: &Entity<InputState>,
label: &'static str,
window: &Window,
Expand All @@ -32,7 +32,10 @@ pub(super) fn editor_input(
.aria_label(label)
}

pub(super) fn editor_field(label: &'static str, control: impl IntoElement) -> gpui::Div {
pub(in crate::gpui_shell) fn editor_field(
label: &'static str,
control: impl IntoElement,
) -> gpui::Div {
v_flex()
.w_full()
.min_w_0()
Expand All @@ -41,7 +44,10 @@ pub(super) fn editor_field(label: &'static str, control: impl IntoElement) -> gp
.child(control)
}

pub(super) fn editor_hint(text: impl Into<SharedString>, cx: &gpui::App) -> gpui::Div {
pub(in crate::gpui_shell) fn editor_hint(
text: impl Into<SharedString>,
cx: &gpui::App,
) -> gpui::Div {
div()
.text_xs()
.line_height(gpui::relative(1.6))
Expand Down
33 changes: 6 additions & 27 deletions nebula_app/src/gpui_shell/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ mod launcher_menu;
mod logos;
mod notifications;
mod palette;
mod palette_action;
mod pane_header;
mod quick_jump;
mod quick_terminal;
Expand All @@ -82,6 +83,7 @@ mod session_recovery;
pub(crate) mod shell_launch;
mod shell_picker;
mod sidebar_resize;
mod ssh_quick_add;
mod terminal_activity;
use shell_picker::shell_palette_rows;
mod settings_navigation;
Expand Down Expand Up @@ -418,33 +420,7 @@ const PALETTE_FILTER_BAR_HEIGHT: f32 = 44.0;
const PALETTE_ROW_GAP: f32 = 4.0;
const PALETTE_SCROLLBAR_CONTENT_GUTTER: f32 = 16.0;

#[derive(Clone)]
enum WorkspacePaletteAction {
TerminalReading {
commands: bool,
},
Shared(crate::display::command_palette::PaletteAction),
/// 聚焦已经存在的工作区标签,不创建副本。
FocusTab(usize),
LayoutRecipes,
/// 先激活标签,再把焦点交给其中的明确 pane。
FocusPane {
tab: usize,
pane: u64,
},
/// 在 frecency 目录中新建终端;已有目录中的 pane 由上面的 FocusPane 命中。
OpenDirectory(std::path::PathBuf),
RunAiSession {
command: String,
cwd: Option<std::path::PathBuf>,
},
/// 启动器混排的 SSH 主机行(数据源 = 共享主机列表权威)。
LaunchSshHost(String),
/// 新建终端弹窗里的一台已检测 shell(旧壳 `ProfileRow::Shell`)。
LaunchShell(crate::shell_detect::DetectedShell),
/// 设置页“导入终端目录”落盘的可执行文件快照。
LaunchProfile(crate::config::ui_config::Profile),
}
pub(super) use palette_action::WorkspacePaletteAction;

#[derive(Clone, Copy)]
enum WorkspacePaletteHintStyle {
Expand Down Expand Up @@ -684,6 +660,8 @@ pub struct NebulaWorkspace {
theme_transition: crate::gpui_shell::theme::ThemeTransition,
/// GPUI presentation over the shared old-shell command catalog.
command_palette_open: bool,
/// 启动器「添加并连接」的工作区内浮层(#864);见 `ssh_quick_add`。
ssh_quick_add: Option<ssh_quick_add::SshQuickAddState>,
command_palette_input: Entity<InputState>,
command_palette_selected: usize,
/// 用户命令管理器贴在右侧覆盖显示,不占终端布局宽度,也不复用应用动作
Expand Down Expand Up @@ -953,6 +931,7 @@ impl NebulaWorkspace {
titlebar_background: window_titlebar::TitleBarBackground::default(),
theme_transition: crate::gpui_shell::theme::ThemeTransition::default(),
command_palette_open: false,
ssh_quick_add: None,
command_palette_input,
command_palette_selected: 0,
command_manager_open: false,
Expand Down
Loading
Loading