fix: a closed terminal hangs its shell up instead of killing it, so the history is saved; idle shells end with their session, and on agent stop

This commit is contained in:
redtea committed 2026-10-14 19:50:50 +03:00
1 parent 114c6fc530
commit 10ffa393ca
3 files changed
+57 -10

No files matched your search

+4
View File
@@ -54,6 +54,10 @@ func (a *Agent) bridgeStream(parent context.Context, sid string, rw io.ReadWrite
ctx, cancel := context.WithCancel(parent)
defer cancel()
defer rw.Close()
// A session closed from the panel (a tab reloaded, a window shut) ends
// the stream at once, not on its next output: an idle shell would live
// on until the agent stopped.
go func() { <-ctx.Done(); rw.Close() }()
// Downstream: pull input frames and write them to the stream.
go func() {