a3a6787776
request failed" / "shell request failed" runTuiSession awaited audit.create() (a Redis round-trip) and then accessibleHosts() (a directory API call) BEFORE calling runTui(), which is where the pty/shell/exec/subsystem listeners actually get attached to the session. The client sends its pty-req and shell requests immediately after opening the session -- if either await took long enough for those requests to arrive first, ssh2 auto-rejects any channel request with no listener (CHANNEL_FAILURE), which is exactly what OpenSSH reports as "PTY allocation request failed on channel 0" / "shell request failed on channel 0". The connection then just sat there, since nothing was left to drive it. runGrammar already has this exact fix (see its own comment); runTuiSession never got the equivalent treatment. Fixed the same way: register the session listeners synchronously, before any await, by having runTui take a Promise for the hosts list instead of the resolved list -- the shell handler awaits it internally once the client actually sends a shell request, which by construction happens only after the listener already exists. Verified: publickey auth against a real deployment succeeds (confirms the earlier ldaps:// fix holds), and the failure reproduces with the exact reported error strings for a bare `ssh user@host` (TUI/picker mode, no target) connection. Full suite: 50/50 passing, no regressions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>