Fix idle session breaking resize and input on reconnect

Two bugs introduced in the idle tracker pause commit:

1. handleOutput() short-circuited entirely when idle, skipping
   connector.OnData() — so terminal output never reached clients
   even after reconnecting. Fix: still call connector.OnData()
   during idle; only skip the expensive tracker.Feed().

2. When a WebSocket client reconnects to an existing session,
   handleWebSocket never called UpdateConnector(), so the idle
   flag was never cleared and the tracker stayed paused. Fix:
   create a fresh connector and call session.UpdateConnector()
   on reconnect, which clears idle and rebuilds the tracker.
This commit is contained in:
GitHub Copilot
2026-02-18 15:09:31 +00:00
parent d9d012996e
commit 247c1a3340
4 changed files with 24 additions and 12 deletions
+7
View File
@@ -515,6 +515,13 @@ func (s *LocalServer) handleWebSocket(w http.ResponseWriter, r *http.Request) {
session := s.sessionManager.GetSession(sessionID)
if session != nil && session.IsRunning() {
sessionCreated = true
// Clear idle state so the output pipeline resumes fully
connector := &localClientConnector{
server: s,
sessionID: sessionID,
routeKey: routeKey,
}
session.UpdateConnector(connector)
replay := daResponsePattern.ReplaceAll(session.GetReplayBuffer(), nil)
if len(replay) > 0 {
s.enqueueWSFrame(routeKey, websocket.BinaryMessage, replay)