From 22faba9eca3ea088e08ca0ab9d74e3dbb4cd29cc Mon Sep 17 00:00:00 2001 From: JoeyWu-tech Date: Sun, 25 Oct 2026 11:38:23 -0700 Subject: [PATCH] agent: the Reasonix fixtures build without a VCS stamp (#3641) TestReasonixCLIRequiresSupportedNativeVersion and TestReasonixCLIRecoversAfterProbeTimeout build a fake reasonix with go build inside t.TempDir(). go build stamps VCS info by default: it looks for a folder named .git above the fixture's module and runs git there, and when that .git is no repository git will open (empty, as here, or unreadable), git exits 128 and the build fails ("error obtaining VCS status: exit status 128"). On this box /tmp/.git is an empty folder owned by nobody, and git there says "not a git repository", so both were red in every full run here that got that far. Both builds now pass -buildvcs=false. reasonixCLI reads only the build info's package path (info.Path, reasonix/cmd/reasonix), which the flag doesn't touch. With no .git above, as on CI, the fixture is byte for byte the same with and without the flag. No other test builds a package with go: goose_test.go builds a single file, which go doesn't stamp, and gui's `go mod download` builds nothing. The same /tmp/.git turns gateway's TestPluginToldWhereTheAgentWorks red another way, through provider.GitOnDisk (#3675), which this doesn't change. What was run (tree 9ef1c9ee, on origin/main 01468003, go1.26.8): - TMPDIR under an empty .git (mode 0700, mine), under a .git with mode 000, and TMPDIR=/tmp (the box's /tmp/.git), -count=3 each: on 01468003 both red at their build every time ("error obtaining VCS status: exit status 128"); with the change ok, 3 of 3 each. With no .git above, ok on both. - TestGooseDetectSkipsGoGoose under the empty .git: ok, 3 of 3, its build run, not skipped. - The fixture built in a folder with no .git above, with and without the flag: `go version -m` prints the same (path reasonix/cmd/reasonix, no vcs lines), and cmp finds the two binaries identical. - gofmt -l . clean; GOOS=linux, windows and darwin go vet -tags nogui ./... and GOOS=windows go vet ./... without the tag: exit 0 each. go build not run: the change is in a _test.go file. - Full suite outside graftcp (systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout 45m, log kept): 65 ok, 6 red, the Reasonix pair not among them: - provider: #3632's fatal error, which 01468003 has. - agent TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI, TestCopilotFolderFromAnIDEPluginIsNotTheCLI, TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir and TestZedAppPath: #3141. - edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this box's umask 077, #3640. - gateway TestPluginToldWhereTheAgentWorks: the same /tmp/.git, through provider.GitOnDisk, which takes any .git for a repository: #3675. - gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie: #3649. Not tried: Windows and macOS, where the flag does the same; and a .git that is another user's repository (git's "dubious ownership"), which needs a second user here. Landed by yetone in a batch of Coffemon's patches from the issues. What was run, go1.26.8, on origin/main cc81ad4ea, then again at 70a0c387c (gofmt, the three vets, the changed tests, umask 077): - mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask 077; agent, provider, library and gateway with an empty .git above TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the changed tests in agent, provider, gateway and gui; the timing tests -count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok. TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js 1,312,975 of 1,315,316, no budget raised. - Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink at umask 077 and two Reasonix tests under an empty .git; on Linux (wsl-run) TestProgram at umask 077 with the old program.go. With each fix's code taken back to main's, the Gemini imageConfig tests, TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced, TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto, plugin-github-hooks, plugins-more-discover, plugin-namesake were red. Broken by hand: claudeKeyed always true (both OwnEndpointNeverAsked tests red), claudeAsk a no-op (TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder (the three TestGitOnDisk tests red). - GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n, gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on Linux (wsl-run). 11 files had reds (click-scroll, panel-fold, plugin-card-update, plugin-github, plugin-move*, segs-glide, tray-totals, update-*), and run again side by side they fail the same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27 there). They are click-scroll guards ("the click must not scroll the page"), varying by language from run to run (#4385). copilot-ghe's route-after-close red is #1949, seen on main 244d80e23 too. In Chromium on mote, Chromium segfaulted partway through files (#4125): context-map, context-scroll-end and context-tune fail the same on origin/main 0911a65e7, so the batch's own files (plugin-namesake, update-auto, plugins-more-discover, plugin-github-hooks) ran in Chromium on Linux: 62 of 62. - Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote) at 472a0608f (on 70a0c387c): every package ok but internal/gateway, whose five reds were #4362's (Antigravity turned-away and TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After the rebase on 244d80e23 the five pass, and gofmt, the three vets and the targeted runs above were run again: ok. In Linux the sign-in, copilot, plugin-github*, plugins-more-discover, plugin-namesake, plugin-gateway, update-auto, quota-refresh-order and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe #1949, plugin-github's click scroll, both red on main too). - Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of gui, gateway, provider and plugin, TestCoreScriptBudget (core 1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini, GitOnDisk and plugin tests, and in Linux both engines i18n-keys, update-mirror, plugin-namesake, plugins-more-discover, plugin-github-hooks and update-auto (138 of 138): ok. Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its Chromium segfaulted, #4125); macOS WebKit; the real app's window. --- internal/agent/reasonix_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/agent/reasonix_test.go b/internal/agent/reasonix_test.go index 0b4ecc0d1..223e1eaf4 100644 --- a/internal/agent/reasonix_test.go +++ b/internal/agent/reasonix_test.go @@ -169,7 +169,10 @@ func TestReasonixCLIRequiresSupportedNativeVersion(t *testing.T) { }{{"1.18.0", false}, {"1.39.4", true}, {"2.24.0", true}} { source := "package main\nimport \"fmt\"\nfunc main() { fmt.Println(\"reasonix v" + tc.version + "\") }\n" os.WriteFile(filepath.Join(dir, "cmd", "reasonix", "main.go"), []byte(source), 0o600) - cmd := proc.Command("go", "build", "-o", bin, "./cmd/reasonix") + // no VCS stamp: go build asks git about any .git folder above + // the temp folder and fails when that is no repository (an + // empty /tmp/.git); the fixture needs none (#3641) + cmd := proc.Command("go", "build", "-buildvcs=false", "-o", bin, "./cmd/reasonix") cmd.Dir = dir cmd.Env = append(os.Environ(), "GOWORK=off") if b, err := cmd.CombinedOutput(); err != nil { @@ -217,7 +220,8 @@ func main() { } } bin := filepath.Join(dir, "reasonix.exe") - cmd := proc.Command("go", "build", "-o", bin, "./cmd/reasonix") + // no VCS stamp, as above (#3641) + cmd := proc.Command("go", "build", "-buildvcs=false", "-o", bin, "./cmd/reasonix") cmd.Dir, cmd.Env = dir, append(os.Environ(), "GOWORK=off") if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("build native probe: %v %s", err, out)