agent: the Codex threads test names what its HOME still holds after removal (#3422)

TestCodexThreadsComeBackOffMagpie/disconnect went red once on macOS CI
(27a8255fd, run 40004148936) with "TempDir RemoveAll cleanup: directory
not empty", its own checks passing. It doesn't reproduce here: 40 runs
alone and three full internal/agent runs with a probe for late writes
were all ok, nothing written after the test. A cleanup registered before
the TempDir's now runs after its removal and logs each entry left, so
the next red names the writer.

Run: go vet ./internal/agent, gofmt; go test ./internal/agent -run
TestCodexThreadsComeBackOffMagpie -count=3 ok. Test-only.
This commit is contained in:
yetone
2026-10-24 02:58:50 +08:00
parent ea9454d2d8
commit a93190ae19
+11 -1
View File
@@ -69,7 +69,17 @@ func TestCodexThreadsComeBackOffMagpie(t *testing.T) {
before = "019a0000-0000-7000-8000-0000000000a3"
)
t.Run("disconnect", func(t *testing.T) {
home, _ := codexHome(t, "", "model = \"gpt-5.4\"\n")
// run after the TempDir's removal: what it couldn't remove (#3422)
var home string
t.Cleanup(func() {
filepath.Walk(home, func(p string, fi os.FileInfo, err error) error {
if err == nil && p != home {
t.Logf("left after the test: %s (%v)", p, fi.ModTime())
}
return nil
})
})
home, _ = codexHome(t, "", "model = \"gpt-5.4\"\n")
dir := filepath.Join(home, ".codex")
cx := codex(home)
if err := cx.Fields[0].Set("fake/m1"); err != nil {