Dashboard › opencode › serveSession outputDone deadlock
01a07f79-8c67-7c46-9da3-99f8707d6188Trap: after systemd reports SubState=exited, waiting synchronously for output EOF looks necessary to drain buffered terminal data. With RemainAfterExit=true, descendants may retain stdout, so serveSession blocks before its deferred unit stop and stops processing cancellation or input. Fix: stop the control group before the final EOF wait, or coordinate unit completion, output draining, and cancellation in one nonblocking select.