Skip to content

Refactor coder agent SSH server for better process and connection control #6177

Closed as not planned

Description

@mafredri

This is, in part, to better support shutdown_scripts as part of #4677 and #6139. But improved user experience is also a big factor.

Problem: Even though the coder agent initiates a graceful shutdown, the SSH connections are abruptly closed leaving SSH clients hanging. Similarly any process started inside an SSH session will be left running (e.g. sleep 1000 &) after the SSH server is closed.

To improve upon this, we need to:

I think it would make sense to refactor SSH functionality for the agent as a separate package, e.g. agentssh or agent/sshd. See list above.

Future work/ideas:

  • Consider forking/forkexec coder agent to manage new SSH connections
    • This could allow the coder agent to be updated without terminating active connections

Activity

  1. self-assigned this
    on Feb 13, 2023
  2. spikecurtis commented on Mar 16, 2023

    @spikecurtis
    Contributor

    For all active sessions with TTYs, print a message that the workspace is closing

    I recall that Jetbrains Gateway requests a PTY when they SSH to run commands. So, I don't think the presence of a PTY is a reliable indicator that you have a human with a shell on the other end. Printing stuff could have undesirable effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cliArea: CLIstaleThis issue is like stale bread.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions