Skip to content

fix(device-utils): stabilize remote shell sessions - #32

Merged
tmunzer-AIDE merged 5 commits into
mainfrom
fix-remote_shell
Jul 14, 2026
Merged

fix(device-utils): stabilize remote shell sessions#32
tmunzer-AIDE merged 5 commits into
mainfrom
fix-remote_shell

Conversation

@tmunzer-AIDE

Copy link
Copy Markdown
Collaborator

Improve EX/SRX remote shell handling by waiting for the initial shell output before sending the first keystrokes, buffering that output for the caller, and ignoring websocket close races during send.

Add ShellSession.send_commands() as a convenience wrapper for sending multiple commands without manually appending line endings.

Replace the sshkeyboard-based interactive shell with platform-specific terminal input loops, including POSIX raw-mode handling and Windows console key mapping. Remove the now-unused sshkeyboard dependency and update the lockfile.

Update shell tests and README documentation for the new behavior.

Improve EX/SRX remote shell handling by waiting for the initial shell
output before sending the first keystrokes, buffering that output for the
caller, and ignoring websocket close races during send.

Add ShellSession.send_commands() as a convenience wrapper for sending
multiple commands without manually appending line endings.

Replace the sshkeyboard-based interactive shell with platform-specific
terminal input loops, including POSIX raw-mode handling and Windows console
key mapping. Remove the now-unused sshkeyboard dependency and update the
lockfile.

Update shell tests and README documentation for the new behavior.
Copilot AI review requested due to automatic review settings July 14, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the stability and usability of device remote shell sessions (EX/SRX) by adding a “wait for initial shell output” readiness phase, buffering that initial output for callers, and modernizing the interactive shell input handling while removing the sshkeyboard dependency.

Changes:

  • Add ShellSession._wait_for_shell_ready() and buffering so the first shell output is captured before the first keystrokes are sent.
  • Introduce ShellSession.send_commands() for sending multiple commands with automatic line endings.
  • Replace sshkeyboard-based interactive input with platform-specific loops (POSIX raw-mode + Windows console mapping) and remove sshkeyboard from dependencies; update tests and README.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
uv.lock Updates the resolved dependency graph (notably removing sshkeyboard) and bumps mistapi to 0.63.1.
pyproject.toml Removes sshkeyboard from project dependencies.
src/mistapi/device_utils/__tools/shell.py Implements readiness waiting + buffering, adds send_commands(), and replaces interactive input handling with POSIX/Windows loops.
tests/unit/test_shell.py Expands unit coverage for readiness waiting, send close-races, and Windows key mapping behavior.
README.md Updates examples and documents the new send_commands() API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/mistapi/device_utils/__tools/shell.py
Comment thread README.md
Comment thread README.md
Comment thread src/mistapi/device_utils/__tools/shell.py
@tmunzer-AIDE
tmunzer-AIDE merged commit fdddcf8 into main Jul 14, 2026
7 checks passed
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