From cb77f3d3f2cfce5acc4553dae4b0a0638f2a37b5 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sun, 1 Mar 2026 00:15:18 +0100 Subject: [PATCH] Fix supervisor task assignment: only assign when session CWD is exactly or under task mountpoint --- internal/supervisor/supervisor.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/supervisor/supervisor.go b/internal/supervisor/supervisor.go index 1b3ce55..c95b7e1 100644 --- a/internal/supervisor/supervisor.go +++ b/internal/supervisor/supervisor.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "path/filepath" + "strings" "time" "anvillm/internal/eventbus" @@ -71,15 +72,14 @@ func (s *Supervisor) assignWork() { } botCwd := sess.Metadata().Cwd - // Find a claimable task in this bot's project (matching cwd or subdirectory) + // Only assign if session CWD is exactly or under task mountpoint for _, bead := range claimable { taskCwd, ok := bead["cwd"].(string) if !ok { continue } - rel, err := filepath.Rel(taskCwd, botCwd) - if err != nil || (rel != "." && filepath.IsAbs(rel)) { + if botCwd != taskCwd && !strings.HasPrefix(botCwd, taskCwd+"/") { continue }