Skip to content

Fix/patrol cli windows hang bundle#3094

Draft
zoskar wants to merge 1 commit into
masterfrom
fix/patrol-cli-windows-hang-bundle
Draft

Fix/patrol cli windows hang bundle#3094
zoskar wants to merge 1 commit into
masterfrom
fix/patrol-cli-windows-hang-bundle

Conversation

@zoskar

@zoskar zoskar commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two Windows-specific fixes in patrol_cli's shared Android build path (affects patrol test, patrol build, patrol develop, and MCP run):

  • Hang at gradlew :app:dependenciesdetectOrchestratorVersion listened only to stdout, so gradle's stderr filled the OS pipe buffer and the process blocked forever. Now drains stderr too. Fixes Can't launch test, stuck on gradlew dependencies #2565.
  • Garbled generated test_bundle.dart_normalizeTestPath used a literal prefix strip that broke when the test target used forward slashes (patrol develop/MCP) or a .\ prefix (PowerShell tab-completion), leaking an absolute-path import. Now resolves the path with path.relative. Fixes Generated test bundle is broken on Patrol 2.0 on Windows #1428.

@github-actions github-actions Bot added the package: patrol_cli Related to the patrol_cli package label Jun 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several fixes for Windows compatibility in patrol_cli and patrol_mcp, including avoiding SIGTERM listeners on Windows to prevent SignalException crashes, draining the Gradle stderr stream to prevent hanging, and improving test path normalization. Feedback was provided regarding a potential runtime crash in test_bundler.dart if _projectRoot is a relative directory, suggesting the use of _projectRoot.absolute.path to ensure both paths are absolute.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +310 to +312
final fileAbs = _fs.path.isAbsolute(testFilePath)
? _fs.path.normalize(testFilePath)
: _fs.path.normalize(_fs.path.join(_projectRoot.path, testFilePath));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If _projectRoot is a relative directory (e.g., Directory('.')), _projectRoot.path will be relative. In this case, fileAbs will also be resolved as a relative path. Since testDirAbs is always absolute (using .absolute.path), passing a relative fileAbs and an absolute testDirAbs to _fs.path.relative will throw an ArgumentError at runtime (as the path package requires both paths to be either relative or absolute).

To prevent this potential runtime crash, use _projectRoot.absolute.path to ensure fileAbs is always resolved as an absolute path.

Suggested change
final fileAbs = _fs.path.isAbsolute(testFilePath)
? _fs.path.normalize(testFilePath)
: _fs.path.normalize(_fs.path.join(_projectRoot.path, testFilePath));
final fileAbs = _fs.path.isAbsolute(testFilePath)
? _fs.path.normalize(testFilePath)
: _fs.path.normalize(_fs.path.join(_projectRoot.absolute.path, testFilePath));

@zoskar zoskar force-pushed the fix/patrol-cli-windows-hang-bundle branch from 05e789f to b4ca14c Compare June 4, 2026 13:00
- Drain gradle stderr in detectOrchestratorVersion to avoid the pipe deadlock (#2565)
- Resolve the test path with path.relative in _normalizeTestPath so forward-slash / `.\` targets bundle correctly (#1428)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@zoskar zoskar force-pushed the fix/patrol-cli-windows-hang-bundle branch from b4ca14c to aee0c7b Compare June 4, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: patrol_cli Related to the patrol_cli package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't launch test, stuck on gradlew dependencies Generated test bundle is broken on Patrol 2.0 on Windows

1 participant