From b95bab0ef84cd3648683c67b21f76111f776de42 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 19 Jul 2026 19:43:19 +0200 Subject: [PATCH] fix: start FUSE mount for remote sessions Remote sessions had no local mount because WithMount9P hooks into the local execute.Server which does not exist for remote sessions. Start the mount directly and tear it down on kill/shutdown. --- session/session.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/session/session.go b/session/session.go index be472e9..d4171fe 100644 --- a/session/session.go +++ b/session/session.go @@ -39,6 +39,7 @@ type Session struct { prevPrompt []byte // last submitted prompt; overwritten on each new submission peers map[string]bool // peer session IDs (bidirectional links) remote string // SSH target for remote execution (empty = local) + mount *mountState // non-nil for remote sessions that need a local mount // Cached model list (expensive API call; refreshed every 24h). modelsMu sync.Mutex @@ -847,6 +848,9 @@ func (s *Manager) Shutdown() { if sess != nil { sess.Cancel() sess.Core.Close() + if sess.mount != nil { + teardownMount(sess.mount) + } s.cfg.Log.Info("shutdown session %s", id) } } @@ -860,6 +864,9 @@ func (s *Manager) KillSession(id string) { if sess != nil { sess.Cancel() sess.Core.Close() + if sess.mount != nil { + teardownMount(sess.mount) + } s.removePersistedSession(id) s.cfg.Log.Info("killed session %s", id) if s.cfg.OnSessionKilled != nil { @@ -1046,6 +1053,15 @@ func (s *Manager) CreateSession(args []string) (string, error) { sessPtr = sess sess.remote = remoteTarget + // For remote sessions, the mount isn't managed by a local execute.Server + // (which doesn't exist). Start it directly so $OLLIE is available for + // local prompt resolution. + if remoteTarget != "" && !s.cfg.NoMount { + ms := &mountState{envExtra: make(map[string]string)} + startMount(ms, uname) + sess.mount = ms + } + s.mu.Lock() sess.uname = uname s.sessions[sessID] = sess