Allow concurrent runs in different workspaces
Track each active run's resolved workspace alongside its cancel function in a single runner.active struct map. A new request key is now refused only when an already-active run is changing the same resolved workspace; the refusal names the conflicting run id and advises waiting or using a different workspace. Workspace resolution is unchanged (default cwd, absolute request workspace, EvalSymlinks), so two spellings of one directory still compare equal. The conflict check and registration stay inside the existing r.mu critical section, so concurrent starts for one workspace cannot both pass. Idempotent repeats of an active request key and the restart-recovery guard are unchanged. Add concurrency_test.go covering concurrent different-workspace runs, same-workspace refusal, symlink/default-cwd equivalence, idempotent repeats, restart recovery and retry workspace scoping; strengthen the runner_test.go refusal assertion. Update docs/cli.md, docs/first-version-testing.md and the packaged operations skill reference to describe per-workspace concurrency. Assisted-by: DeepSeek V4.1 Flash
This commit is contained in:
@@ -3,6 +3,7 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -56,8 +57,8 @@ func TestRunnerRoutingPersistenceAndIdempotency(t *testing.T) {
|
||||
}
|
||||
other := request
|
||||
other.RequestKey = "other"
|
||||
if _, err := r.start(other); err == nil {
|
||||
t.Fatal("overlapping execution accepted")
|
||||
if _, err := r.start(other); err == nil || !strings.Contains(err.Error(), fmt.Sprintf("run %d is already active", run.ID)) || !strings.Contains(err.Error(), "different workspace") {
|
||||
t.Fatal("overlapping execution was not refused with the conflicting run", err)
|
||||
}
|
||||
close(release)
|
||||
r.wg.Wait()
|
||||
|
||||
Reference in New Issue
Block a user