From f38f65030c557a725e841f196f6f4b56d85db1b0 Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 12 Oct 2026 02:35:18 +0800 Subject: [PATCH] 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: " 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. --- internal/agent/codex_route_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/agent/codex_route_test.go b/internal/agent/codex_route_test.go index 3aab881bc..d7657729f 100644 --- a/internal/agent/codex_route_test.go +++ b/internal/agent/codex_route_test.go @@ -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