Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| if ("$AppDataDir" -ne "" -and (Test-Path $AppDataDir)) | ||
| { | ||
| Write-Warning "Removing AppDataDir '$AppDataDir'" | ||
| Remove-Item -Force -Recurse $AppDataDir |
There was a problem hiding this comment.
Bug: A race condition between Stop-Process and Remove-Item can cause the test retry logic to fail because file handles may not be released before the cleanup attempt.
Severity: MEDIUM
Suggested Fix
After calling $process | Stop-Process -Force, add a Wait-Process call (e.g., Wait-Process -Timeout 10) to ensure the process has fully terminated and released all file handles before the script attempts to remove the directory in the next iteration.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: test/Scripts.Integration.Test/run-smoke-test.ps1#L146-L149
Potential issue: A race condition exists in the test retry logic. The script terminates
a process using `Stop-Process -Force` but does not wait for it to fully exit. On the
next retry attempt, the script immediately tries to delete the application data
directory with `Remove-Item`. If the terminated process has not yet released its file
handles, `Remove-Item` will fail. Since `$ErrorActionPreference` is set to `"Stop"`,
this failure will cause an unhandled exception, terminating the entire test run and
preventing any further retries, thus defeating the purpose of the retry mechanism.
This is similar to #2527
If running the game hangs (i.e. on Linux during startup) the state has to be reset and the tests rerun.
This wraps the existing logic in a
max-try = 3and resets theAppDataDir.#skip-changelog