From a93190ae193dd97f52c21f21771f825f552e19c5 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 24 Oct 2026 02:58:50 +0800 Subject: [PATCH] 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. --- internal/agent/codex_threads_back_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/agent/codex_threads_back_test.go b/internal/agent/codex_threads_back_test.go index 8c4fe3dbe..f57a0492a 100644 --- a/internal/agent/codex_threads_back_test.go +++ b/internal/agent/codex_threads_back_test.go @@ -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 {