Fix supervisor task assignment: only assign when session CWD is exactly or under task mountpoint

This commit is contained in:
Levi Neely 2026-03-01 00:15:18 +01:00
parent 04d3616819
commit cb77f3d3f2
1 changed files with 3 additions and 3 deletions

View File

@ -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
}