CI flakes seen on #1463 (activity attribution wait, profile index timing, telemetry race, scope latency)
These tests failed CI on PR #1463 at head 0edf3da and passed when rerun. None of them is related to that PR's change. They were all seen on slow or shared runners.
- [ ]
TestActivityAttribution_InternalToolCallReadsSessionResolution(internal/server/activity_attribution_sources_test.go:155), Windows: the 5 srequire.Eventuallywaiting for the asynchronous activity record expires. Sibling tests on the same runner took up to 43 s. Widen the wait in the activity-attribution tests, or wait on a deterministic signal instead. - [ ]
TestRetrieveTools_ProfileWidenedByRawApplyIsSearchableImmediately(internal/server/retrieve_tools_profile_index_reload_test.go:126), shuffle lane: this one returned nil hits once, after 9.6 s. It didn't reproduce with the CI seed or under load, so it is likely timing. - [ ] Shuffle lane: a telemetry DATA RACE in
TestPayloadV13_PassesScanWithCommonUsernameBlocked. - [ ] FR-011 merge-base regression:
TestScopeLatency_ReadCache_ScopedVsAdmin, where the scoped read_cache p95 gap was 29.6 ms against a 20 ms budget on a shared runner.
I'd like to take item 2 (TestRetrieveTools_ProfileWidenedByRawApplyIsSearchableImmediately). I tracked it down and it's not just the test.
cleanupOrphanedIndexEntries reads GetAllServerNames() first and GetAllIndexedServerNames() second. The startup backgroundToolIndexing goroutine runs it, so on a slow runner it can take the active list before the fixture's LoadConfiguredServers registers a and b, then read the indexed list after the fixture has seeded their tools. It then deletes b:beta_tool as an orphan, the profile rebuild finds nothing for b, and the search returns nil. I caught it with a stack trace on the delete:
DeleteServerTools("b") <- cleanupOrphanedIndexEntries <- backgroundToolIndexing <- backgroundInitialization
The CI seed alone doesn't reproduce it (same order as CI, still passes), it needs load. Running 16 copies in parallel with the CPU saturated fails about 2% of runs. Reading the indexed names first and the active names second fixes it, since a server is registered before its tools get indexed: 0 failures in 200 runs under the same load. I'll open a PR with that and a test that hits the ordering directly instead of relying on load.
On item 3, I couldn't find the telemetry race anywhere. The failed jobs on 0edf3da were the Windows run (item 1), the shuffle run (item 2, TestPayloadV13 passed there) and FR-011 (item 4), and 400 local -race -shuffle=on runs of the telemetry package were clean. Do you remember which run it came from?
Triage of #1465 against origin/main (f4b3c9298). All four items look addressed, so I'm not opening a PR.
-
Windows activity-attribution wait: fixed by #1515. internal/server/activity_attribution_sources_test.go defines
attributionWait = 60 * time.Second(line 22) and uses it for the record-persistence waits (lines 40, 167, 202), including TestActivityAttribution_InternalToolCallReadsSessionResolution. -
TestRetrieveTools_ProfileWidenedByRawApplyIsSearchableImmediately: fixed by #1492 (thanks @Sriram-PR for the root cause).
findOrphanedIndexServersin internal/runtime/lifecycle.go:2721 now reads the indexed servers first and the active servers second. A server is registered before its tools are indexed, so a freshly added server can no longer be deleted as an orphan. internal/runtime/orphan_cleanup_test.go covers the ordering directly. -
Telemetry DATA RACE in TestPayloadV13_PassesScanWithCommonUsernameBlocked: not reproducible.
go test -race -shuffle=on -count=50 -timeout 40m ./internal/telemetry/passed with 0 race reports. @Sriram-PR also saw nothing in 400 local runs. If it shows up again, please attach the race report. -
FR-011 TestScopeLatency_ReadCache_ScopedVsAdmin: addressed by #1517, which interleaves the scoped and admin measurement arms (
measureInterleaved, internal/server/scope_latency_test.go:176). Burst noise on a shared runner no longer lands on only one arm. The 20ms budget is unchanged, so a rare flake is still possible on a very noisy runner.
Suggest closing as fixed, and reopening or filing a new issue with logs if any of these recurs.