From 5ef2aba27b4bdc4686279270d566063fbc3eb4d4 Mon Sep 17 00:00:00 2001 From: Snider Date: Tue, 14 Apr 2026 14:13:02 +0100 Subject: [PATCH] fix(agent): workspace prep falls back to GOWORK search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runWorkspaceLanguagePrep now appends `GOWORK=` (empty) to the env passed to `go work sync` so inherited `GOWORK=off` from a test runner or CI environment doesn't short-circuit the workspace lookup. The extracted workspace template includes a go.work referencing ./repo; without this override the sync fails even though the file is right there. Converged pass — no new features found this sample. Co-Authored-By: Virgil --- pkg/agentic/prep.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/agentic/prep.go b/pkg/agentic/prep.go index 6c7efb3..83bc576 100644 --- a/pkg/agentic/prep.go +++ b/pkg/agentic/prep.go @@ -1116,7 +1116,13 @@ func (s *PrepSubsystem) runWorkspaceLanguagePrep(ctx context.Context, workspaceD } if fs.IsFile(core.JoinPath(repoDir, "go.mod")) && (fs.IsFile(core.JoinPath(workspaceDir, "go.work")) || fs.IsFile(core.JoinPath(repoDir, "go.work"))) { - if result := process.RunWithEnv(ctx, repoDir, goEnv, "go", "work", "sync"); !result.OK { + // `go work sync` needs the workspace's own go.work — clear any + // inherited GOWORK=off (set by parent shells / tests) so the workspace + // file under repoDir/.. is honoured. The append order means GOWORK= here + // overrides any parent value passed through. + workEnv := append([]string{}, goEnv...) + workEnv = append(workEnv, "GOWORK=") + if result := process.RunWithEnv(ctx, repoDir, workEnv, "go", "work", "sync"); !result.OK { return core.E("prepWorkspace", "go work sync failed", nil) } }