Skip to content

feat(vault): add host connection test to the host editor - #2984

Open
yh4922 wants to merge 2 commits into
binaricat:mainfrom
yh4922:feat/host-connection-test
Open

feat(vault): add host connection test to the host editor#2984
yh4922 wants to merge 2 commits into
binaricat:mainfrom
yh4922:feat/host-connection-test

Conversation

@yh4922

@yh4922 yh4922 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a "Test connection" button to the host editor (save / new-host aside panel). Clicking it opens a dialog that reuses the terminal's own connection UI — progress bar, per-hop jump-host chain, host-key verification, and password/2FA prompts — and runs a headless connection probe that authenticates and disconnects without opening a shell.

Type of Change

  • New feature

Related Issue (optional)

N/A

Changes Made

  • Main process: new netcatty:test-connection IPC channel reuses startSSHSession in a testMode that authenticates then tears down without opening a shell. Outcome is reported via a dedicated netcatty:test:result event, with cancellation via netcatty:test-connection:cancel.
  • Renderer: useHostConnectionTest hook + HostConnectionTestDialog component (portal-mounted, reuses TerminalConnectionDialog verbatim).
  • Single-credential auth for the test (no ssh-agent / ~/.ssh default-key fallback chain) with short test-only timeouts (8s TCP / 15s auth).
  • Reuses terminal chain progress, host-key verification, and keyboard-interactive/auth prompts; success keeps the same dialog with Retry/Close.
  • i18n strings for en / zh-CN / zh-TW / ru.

Screenshots / Demo

N/A

Testing

  • I have tested these changes locally (npm run dev)
  • Linting passes (npm run lint)
  • Tests pass — affected suites run: domain/hostConnectionTest.test.ts, electron/bridges/sshBridge/startSession.testConnection.test.cjs, plus startSession.agentForwarding, execCommand.systemAgent, HostDetailsPanel.proxyProfile, TerminalConnectionDialog regressions (68 tests, all passing)
  • Generated capability tool specs are updated when applicable (npm run generate:capability-tools)
  • No new console errors or warnings, if this affects app behavior

Checklist

  • My code follows the existing project style
  • I have added or updated relevant documentation
  • I have not introduced any breaking changes (or I have described them above)

@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: d7a1890d4a

ℹ️ 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 +1379 to +1380
testMode: true,
reuseTransport: 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 Route jump-host MFA prompts outside terminal scope

When the tested host uses a jump host that requires keyboard-interactive/MFA, this test-mode launch does not set _keyboardInteractiveScope for connectThroughChain; that function defaults jump prompts to terminal scope, and the renderer rejects terminal-scoped prompts whose session id is not in the terminal session list (application/app/useAppStartupEffects.ts:34-45). The target host prompt was switched to external scope, but the jump-host prompt is still auto-cancelled before the user can answer, so the new connection test fails for MFA bastions even though a normal terminal connection can succeed.

Useful? React with 👍 / 👎.

Comment thread electron/bridges/sshBridge/startSession.cjs Outdated
@yh4922

yh4922 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

目前是啥情况

Add a 'Test' button next to Save in the host editor that opens a dialog reusing the terminal's connection progress/auth/host-key UI, and runs a headless connection probe:

- Main process: netcatty:test-connection reuses startSSHSession in a testMode that authenticates then tears down without opening a shell, reports via netcatty:test:result, and supports cancellation (netcatty:test-connection:cancel).
- Renderer: useHostConnectionTest hook + HostConnectionTestDialog component; single-credential auth (no agent/default-key fallback) with short test timeouts (8s TCP / 15s auth).
- Reuses terminal chain progress, host-key verification, and auth prompts; success keeps the same dialog with retry/close.
@yh4922
yh4922 force-pushed the feat/host-connection-test branch from 5c1d56c to 4e6498a Compare August 25, 2026 10:20
Register the headless test-connection transport before connectThroughChain / createProxySocket runs, and update its pendingConn / chainConnections as hops and proxy sockets are established. This lets cancelTestConnection abort a slow/unreachable bastion or proxy dial instead of leaving it running until timeout.
@yh4922
yh4922 force-pushed the feat/host-connection-test branch from 4e6498a to 6965e49 Compare August 25, 2026 10:35
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