From c5285ac25920b2e225bd02780d7a3c0d8c47bd29 Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Sat, 1 Aug 2026 21:45:39 +0200 Subject: [PATCH] fs/session: restore normal blocking semantics for statewait statewait is a blocking wait file with a 5-second timeout, not an indefinite long-block stream like chat. Remove LongBlock=true so the 9P server uses the normal blocking path (WithTimeout 5s) instead of WithCancel-only behavior. Also remove temporary statewait debug instrumentation. --- cmd/olliesrv/server.go | 4 ++++ fs/session/files.go | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/olliesrv/server.go b/cmd/olliesrv/server.go index 7620f61..56ca5e0 100644 --- a/cmd/olliesrv/server.go +++ b/cmd/olliesrv/server.go @@ -876,6 +876,10 @@ func (s *Server) read(cs *connState, fc *plan9.Fcall, ctx context.Context) *plan return errFcall(fc, err.Error()) } + if strings.HasSuffix(path, "/statewait") { + s.log.Debug("statewait read path=%q isBlocking=%v longBlock=%v oneShot=%v", path, entry.IsBlocking(), entry.LongBlock(), entry.OneShot()) + } + // OneShot entries yield data once per open; offset>0 means EOF. if entry.OneShot() && fc.Offset > 0 { return &plan9.Fcall{Type: plan9.Rread, Tag: fc.Tag, Count: 0} diff --git a/fs/session/files.go b/fs/session/files.go index 9feabfd..11774e7 100644 --- a/fs/session/files.go +++ b/fs/session/files.go @@ -367,14 +367,11 @@ func (h *agentHelper) fileSpec(name string, mode os.FileMode) FileSpec { if base == "" { base = h.ag.State() } - h.log.Debug("statewait: begin base=%q ag=%q", base, h.ag.Name()) v, ok := h.ag.WaitChange(ctx, agent.WatchState, base) if !ok { s := h.ag.State() - h.log.Debug("statewait: !ok returning state=%q", s) return []byte(s + "\n"), s, nil } - h.log.Debug("statewait: ok returning state=%q", v) return []byte(v + "\n"), v, nil } }