v1.8.2: session management hardening

- Fix infinite reconnect loop in terminal (_send_to_shell guard)
- Safe language switch: disconnect + reconnect instead of object transplant
- Improved SFTP reconnect flow with proper validation
- Add log.debug to all silent exception handlers in ssh_client

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chrome-storm-c442
2026-02-24 02:38:27 -05:00
parent bae7a916f2
commit 1a7b075cca
6 changed files with 36 additions and 35 deletions

View File

@@ -163,14 +163,14 @@ class ShellSession:
if self._channel:
try:
self._channel.close()
except Exception:
pass
except Exception as e:
log.debug(f"ShellSession channel close: {e}")
self._channel = None
if self._client:
try:
self._client.close()
except Exception:
pass
except Exception as e:
log.debug(f"ShellSession client close: {e}")
self._client = None
def reconnect(self):
@@ -353,14 +353,14 @@ class SFTPSession:
if self._sftp:
try:
self._sftp.close()
except Exception:
pass
except Exception as e:
log.debug(f"SFTPSession sftp close: {e}")
self._sftp = None
if self._client:
try:
self._client.close()
except Exception:
pass
except Exception as e:
log.debug(f"SFTPSession client close: {e}")
self._client = None
def listdir_attr(self, path: str) -> list: