fix: recover reconnect after incomplete output capture

This commit is contained in:
cabbage committed 2026-10-27 14:36:06 +00:00
1 parent b52ca5a7c2
commit 6906ed52f2
9 files changed
+692 -3

No files matched your search

+6 -1
View File
@@ -232,7 +232,12 @@ func (server *AgentServer) serveConnection(parent context.Context, connection *w
server.writeLoop(sessionContext, connection, queue, heartbeat, started)
cancel()
}()
defer func() { <-writerDone }()
defer func() {
// A reader can end before the writer observes the closed transport.
// Cancel first so cleanup does not wait for the next heartbeat write.
cancel()
<-writerDone
}()
for {
messageType, payload, err = connection.Read(sessionContext)