Closed as not planned
Description
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:
-
For all active sessions with TTYs, print a message that the workspace is closing - feat(agentssh): Gracefully close SSH sessions on Close #7027
- Send an interrupt (e.g.
SIGHUP
) to the commands/shells started via SSH- Wait for processes to exit (for some amount of time)
- Sens
SIGKILL
to the remaining processes
- Stop accepting new SSH connections (potentially allow
--debug
or similar flag overrides) - Do not run
shutdown_script
until the above is complete - refactor(agent): Move SSH server into agentssh package #7004
I think it would make sense to refactor SSH functionality for the agent as a separate package, e.g. See list above.agentssh
or agent/sshd
.
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