🤖 This issue was created by Repo Assist, an automated AI assistant.
Two distinct test infrastructure bugs causing intermittent CI failures have been identified and fixed. The PR creation was blocked, so the patch is provided here for manual application.
Fix 1: Empty diagnostics buffer in waitForLatestDiagnostics
Root cause: waitForLatestDiagnostics uses Observable.bufferSpan to collect publishDiagnostics notifications. For error-free code, the language server sends no notifications, so the buffer emits an empty IList. The call Seq.last throws System.InvalidOperationException: The input sequence was empty.
Observed in CI (PR #1518):
InlayHint.voption.show: for custom function
System.InvalidOperationException: The input sequence was empty
at ... waitForLatestDiagnostics@301
Fix in test/FsAutoComplete.Tests.Lsp/Utils/Server.fs:
- |> Array.last
+ |> (fun arr -> if arr.Length = 0 then [||] else arr[arr.Length - 1])
More precisely, change Seq.last → Seq.tryLast |> Option.defaultValue [||].
Fix 2: Directory cleanup failures in dotnetCleanup
Root cause: On macOS + .NET 10, Directory.Delete(path, true) fails with IOException: Directory not empty because .NET SDK background processes hold locks on files in obj/Debug at cleanup time.
Observed in CI: ~15 GoTo Tests failures on macos-15 / net10.0 / TransparentCompiler.
Fix in test/FsAutoComplete.Tests.Lsp/Helpers.fs: wrap Directory.Delete in try/catch with 200ms retry.
Applying the Fix
The patch can be downloaded from workflow run 23994119498:
gh run download 23994119498 -n agent -D /tmp/agent-23994119498
git checkout -b fix/flaky-test-infrastructure main
git am --3way /tmp/agent-23994119498/aw-repo-assist-fix-flaky-diagnostics-test-20260405.patch
git push origin fix/flaky-test-infrastructure
gh pr create --title 'fix: fix flaky test infrastructure' --base main
Generated by 🌈 Repo Assist, see workflow run.
Generated by 🌈 Repo Assist, see workflow run. Learn more.
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/repo-assist.md@7ee2b60744abf71b985bead4599640f165edcd93
🤖 This issue was created by Repo Assist, an automated AI assistant.
Two distinct test infrastructure bugs causing intermittent CI failures have been identified and fixed. The PR creation was blocked, so the patch is provided here for manual application.
Fix 1: Empty diagnostics buffer in
waitForLatestDiagnosticsRoot cause:
waitForLatestDiagnosticsusesObservable.bufferSpanto collectpublishDiagnosticsnotifications. For error-free code, the language server sends no notifications, so the buffer emits an emptyIList. The callSeq.lastthrowsSystem.InvalidOperationException: The input sequence was empty.Observed in CI (PR #1518):
Fix in
test/FsAutoComplete.Tests.Lsp/Utils/Server.fs:More precisely, change
Seq.last→Seq.tryLast |> Option.defaultValue [||].Fix 2: Directory cleanup failures in
dotnetCleanupRoot cause: On macOS + .NET 10,
Directory.Delete(path, true)fails withIOException: Directory not emptybecause .NET SDK background processes hold locks on files inobj/Debugat cleanup time.Observed in CI: ~15
GoTo Testsfailures onmacos-15 / net10.0 / TransparentCompiler.Fix in
test/FsAutoComplete.Tests.Lsp/Helpers.fs: wrapDirectory.Deletein try/catch with 200ms retry.Applying the Fix
The patch can be downloaded from workflow run 23994119498:
gh run download 23994119498 -n agent -D /tmp/agent-23994119498 git checkout -b fix/flaky-test-infrastructure main git am --3way /tmp/agent-23994119498/aw-repo-assist-fix-flaky-diagnostics-test-20260405.patch git push origin fix/flaky-test-infrastructure gh pr create --title 'fix: fix flaky test infrastructure' --base main