cmd/codeaf: TestHostedWelcomeCarriesUnreadProfileKeysToSurface fails under load — the conversation writes into its temp folder after the host closes
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- go
- Bereich
- backend, testing-qa
Rechercherichtung
Start with cmd/codeaf/chatv3_host_test.go and TestHostedWelcomeCarriesUnreadProfileKeysToSurface, then inspect v3TrackedAgent and remote.Loopback close behavior. Run the deterministic probe and the loaded -count=200 command. Done means no LATE writes, the stress loop passes three times, and every v3TrackedAgent use has a matching close.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
What happened
cmd/codeaf TestHostedWelcomeCarriesUnreadProfileKeysToSurface fails under load because the conversation it opens keeps writing into its temp folder after the test has closed it:
--- FAIL: TestHostedWelcomeCarriesUnreadProfileKeysToSurface (0.00s)
testing.go:1464: TempDir RemoveAll cleanup: unlinkat /tmp/TestHostedWelcomeCarriesUnreadProfileKeysToSurface3740933646/002/574f9f6350df202f: directory not empty
It was seen once in a make pr-ready run for #1410 (santos/dev2 at 19a5a77c5, 2026-09-24). It passed 200 of 200 runs alone and passed a full go test -count=1 ./cmd/codeaf rerun. The late write reproduces on the untouched santos/dev2 head 008363c98, so the merge that surfaced it did not cause it.
The test builds its agent with v3TrackedAgent(t, workspace), serves it through remote.Loopback and closes the loop in t.Cleanup, but it never closes the agent itself. A probe (below) found a write into the agent's place directory (002/<hash>) about 50 µs after loop.Close() returned. On a quiet box that write finishes before t.TempDir's RemoveAll. On a loaded box it lands during the removal.
Replication
Deterministic (no model). Drop this probe into cmd/codeaf as zz_hostprobe_test.go and run go test -count=1 -run TestProbeHostedWelcomeLateWrites -v ./cmd/codeaf. It prints LATE <path> <duration> after end for every file written after the close. There should be none, and today there is at least one under the place directory.
package main
import (
"io/fs"
"path/filepath"
"testing"
"time"
"github.com/Agent-Field/codeaf/internal/remote"
)
func TestProbeHostedWelcomeLateWrites(t *testing.T) {
workspace := t.TempDir()
agent := v3TrackedAgent(t, workspace)
loop, err := remote.Loopback(remote.Hello{Version: remote.Version, Workspace: workspace}, remote.Options{
Boot: func(remote.Hello) (*remote.Engine, error) {
return &remote.Engine{Agent: agent, Workspace: workspace, UnreadProfileKeys: []string{"models"}}, nil
},
})
if err != nil {
t.Fatal(err)
}
_, _ = hostOptions(onePipeFleet("devbox", loop.Client), loop.Client.Welcome(), false)
_ = loop.Close()
end := time.Now()
time.Sleep(3 * time.Second)
_ = filepath.WalkDir(filepath.Dir(workspace), func(p string, d fs.DirEntry, err error) error {
if err != nil {
return nil
}
if info, _ := d.Info(); info != nil && info.ModTime().After(end) {
t.Logf("LATE %s %v after end", p, info.ModTime().Sub(end))
}
return nil
})
}
The probe shows the late write on every run. The failure itself needs load, and how often it fails under load has not been measured. The recipe: with one busy loop per core (for i in $(seq "$(nproc)"); do yes >/dev/null & done), run GOMAXPROCS=2 go test -count=200 -run '^TestHostedWelcomeCarriesUnreadProfileKeysToSurface$' ./cmd/codeaf.
Field. Not needed. No model is involved.
Where
cmd/codeaf/chatv3_host_test.go,TestHostedWelcomeCarriesUnreadProfileKeysToSurface: noagent.Close()in its cleanup.v3TrackedAgent(the test helper), and whatever the agent orremote.Loopback's engine still writes into the place directory after the loop closes. That is the product half: a closed host should not write.
The fix
Closing the loopback host leaves nothing writing under the agent's place, or the host's Close waits for those writes. The test closes the agent it opened, before its temp folders are removed. Fixing only the test would hide the product half, so both are wanted.
Acceptance
- Unit: the probe above prints no
LATEline. - Unit (under load): the
-count=200loop above is green with one busy loop per core, three times in a row. - Sibling tests that build an agent with
v3TrackedAgentclose it; a grep forv3TrackedAgent(incmd/codeafshows a matching close for each one.
- Vorherrschende Sprache
- Go
- Sterne
- 115
- Forks
- 14
- Ø Merge
- 16 Std. 59 Min.
- Gemergte PRs (30 T.)
- 223
Entwicklungsumgebung
Die Einrichtungsdateien dieses Projekts haben wir noch nicht geprüft. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Agent-Field/CodeAF
-
area:chat bug sev:papercut
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Agent-Field/CodeAF#1805 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:session bug sev:papercut
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Agent-Field/CodeAF#1779 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:session bug sev:papercut
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Agent-Field/CodeAF#1768 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:chat bug sev:papercut
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Agent-Field/CodeAF#1742 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:build bug sev:papercut
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Agent-Field/CodeAF#1679 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in Agent-Field/CodeAF
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 91/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
praetorianer777/Dynamo#53 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
kind/engineering pulumi/pulumi-terraform Task Workflow Failure
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
pulumi/pulumi-terraform#1261 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Controllers integration tests fail when port 8080 is in useEvtl. vergeben @noahnut hat das heute übernommen. Offenarea/cluster-autoscaler kind/bug needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
kubernetes-sigs/cluster-autoscaler#236 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag