From 39255b1766ba748600902999c80accd3dfdcf544 Mon Sep 17 00:00:00 2001 From: Snider Date: Sun, 22 Mar 2026 15:34:43 +0000 Subject: [PATCH] fix(queue): scan new workspace layout for concurrency counting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit countRunningByAgent only scanned one level deep (*/status.json) but new workspaces are at */*/*/status.json. Concurrency limits weren't enforced — all agents dispatched as running instead of queuing. Now scans both old and new layouts. Co-Authored-By: Virgil --- pkg/agentic/queue.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pkg/agentic/queue.go b/pkg/agentic/queue.go index fafbf62..7bd7275 100644 --- a/pkg/agentic/queue.go +++ b/pkg/agentic/queue.go @@ -116,22 +116,18 @@ func (s *PrepSubsystem) delayForAgent(agent string) time.Duration { } // countRunningByAgent counts running workspaces for a specific agent type. +// Scans both old (*/status.json) and new (*/*/*/status.json) workspace layouts. func (s *PrepSubsystem) countRunningByAgent(agent string) int { wsRoot := WorkspaceRoot() - r := fs.List(wsRoot) - if !r.OK { - return 0 - } - entries := r.Value.([]os.DirEntry) + // Scan both old and new workspace layouts + old := core.PathGlob(core.JoinPath(wsRoot, "*", "status.json")) + new := core.PathGlob(core.JoinPath(wsRoot, "*", "*", "*", "status.json")) + paths := append(old, new...) count := 0 - for _, entry := range entries { - if !entry.IsDir() { - continue - } - - st, err := readStatus(core.JoinPath(wsRoot, entry.Name())) + for _, statusPath := range paths { + st, err := readStatus(core.PathDir(statusPath)) if err != nil || st.Status != "running" { continue }