Skip to content

Assistant SSH tools ​

The Uptinio assistant can open an SSH session to a project server and run install/admin commands using vaulted credentials. This is separate from the Go agent poller channel (run_server_command).

Tools ​

ToolPurpose
run_ssh_commandRun command (shell string) or argv (array) over SSH
install_on_serverBuild a package-manager install command and run it over SSH

Prefer run_server_command when the Go agent is online and the command is a simple allowlisted argv. Use SSH for package installs and broader admin work. Keep Ruby Net::SSH for hosts without a suitable Go agent.

Auth & host ​

  • Host: server.public_ip → private_ip → hostname
  • Port: tool arg → credential metadata.port / URL → 22
  • Username: tool arg → credential fields.username → root
  • Credential kinds: ssh_pem (private_key, optional username) or username_password
  • If credential_ref is omitted and the project has exactly one ssh_pem, that credential is used; otherwise the tool returns needs_credentials
  • credential_ref accepts cred:UUID, exact/case-insensitive name, @name chat mentions, and slugified names (e.g. @uptinio-root-key)

Private keys and passwords are never returned to the model. stdout/stderr are scrubbed via CredentialBroker.

Approval ​

Commands pass CommandAllowlistFilter unless project.allow_all_commands. Non-allowlisted commands return needs_approval and reuse the same command-approval widget / resume path as run_server_command (resume_tool: run_ssh_command or install_on_server).

Implementation ​

  • SSH runs inside AssistantChatJob (Que), not the HTTP/SSE request. Closing the tab does not abort SSH.
  • SshCommandRunner — Net::SSH session; captures stdout/stderr/exit status; closes the session in ensure
  • Host-key policy is currently verify_host_key: :never (ephemeral containers); operators should pin host keys for production
  • Timeout hard cap: 300 seconds (default 60 for run_ssh_command, 120 for install_on_server)
  • SshCommandRunner force-closes the Net::SSH session when the budget expires (Ruby Timeout alone is unreliable against blocking IO) and emits progress every ~5s (SSH still running…)
  • Progress is broadcast as ActionCable status events via ActionsTracker#emit_status
  • Transport failures (timed_out, auth_failed, host_unreachable, …) return structured tool results and notify Bugsnag via AssistantErrorNotifier
  • Agent update path: get_server_install_instructions → one run_ssh_command with update_command / install_command (timeout 120–180s, max 300). Do not chain extra package-manager steps in the same SSH call.

Package managers (install_on_server) ​

ManagerCommand shape
apt (default)DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y …
dnfdnf install -y …
yumyum install -y …
apkapk add --no-cache …