agent tests: the sandbox home holds XDG_DATA_HOME and XDG_STATE_HOME too, so Grok App's drift test passes on Linux (#1668)

codexHome, the helper TestDriftUnwiredEveryAgent and others start from,
pointed HOME, XDG_CONFIG_HOME and XDG_CACHE_HOME at the test's home but
left XDG_DATA_HOME at testenv's. On Linux grokAppDir (ee7a9b24a) reads
$XDG_DATA_HOME/grok-app, so the App's config was written outside the
home the test walks, its base_url never swapped, and no drift showed:
"applied_test.go:219: unwired: <nil>" on ubuntu CI (run 38162553532).

Run: with grokAppOS forced to "linux" in a throwaway file, the test fails
exactly so without this and passes with it. go test ./internal/agent/
ok on macOS; gofmt clean; GOOS=linux and GOOS=windows go vet ok.
This commit is contained in:
yetone
2026-10-12 02:35:18 +08:00
parent 054bdb8bbe
commit f38f65030c
+3
View File
@@ -16,6 +16,9 @@ func codexHome(t *testing.T, auth, config string) (home string, read func() stri
t.Setenv("USERPROFILE", home)
t.Setenv("XDG_CONFIG_HOME", filepath.Join(home, ".config"))
t.Setenv("XDG_CACHE_HOME", filepath.Join(home, ".cache"))
// an app's data on Linux (Grok App's, #1668)
t.Setenv("XDG_DATA_HOME", filepath.Join(home, ".local", "share"))
t.Setenv("XDG_STATE_HOME", filepath.Join(home, ".local", "state"))
t.Setenv("CODEX_HOME", "")
t.Setenv("HANA_HOME", "")
// folders an agent's own variable moves out of the sandbox home