From 323ae311fee2bb032bf6ae1a31d790b3b4326659 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 8 May 2026 12:15:36 +0200 Subject: [PATCH] chatwait: return immediately when session is idle Fixes a race where the client starts a new chatwait read after the turn has ended (EnsureTrailingNewline already fired), causing a 5-second blocking delay before the shell prompt reappears. --- store/sessionfile.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/store/sessionfile.go b/store/sessionfile.go index 58ed225..161a1d0 100644 --- a/store/sessionfile.go +++ b/store/sessionfile.go @@ -198,6 +198,9 @@ func (h *sessionHelper) fileSpec(name string, mode os.FileMode) FileSpec { ctx, cancel := context.WithCancel(connCtx) defer cancel() context.AfterFunc(h.sess.Ctx, cancel) + if h.sess.Core.State() == "idle" { + return nil, nil + } offset := 0 if base == "" { n, _ := h.sess.LogInfo()