Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

  • Investigate Windows path resolution test failure in PowerShell integration tests
  • Identify root cause: GetFullPath uses process current directory, not PowerShell location
  • Implement fix: Use GetFullPath with explicit base path parameter
  • Test fix locally - all tests pass on Linux PowerShell
  • Update version number to 2025-11-10
  • Commit and push changes
  • Wait for CI workflow approval and verify tests pass on Windows

Root Cause Analysis

The issue was that [System.IO.Path]::GetFullPath($path) uses the process's current directory ([System.Environment]::CurrentDirectory), not PowerShell's current location (Get-Location).

In Windows GitHub Actions CI:

  • PowerShell location: D:\a\copilot_here\copilot_here (checkout directory)
  • Process current directory: C:\Users\RUNNER (user home, possibly set by CI environment)

When GetFullPath was called with a relative path, it resolved relative to C:\Users\RUNNER instead of the PowerShell location, causing malformed paths like:

C:\Users\RUNNERC:\Users\runneradmin1\AppData\Local\Temp\...

Solution

Use the two-parameter overload: [System.IO.Path]::GetFullPath($path, $basePath) with explicit base path from (Get-Location).Path. This ensures relative paths are resolved relative to PowerShell's location, not the process current directory.

Changed in three functions:

  • Resolve-MountPath (line 62)
  • Save-MountToConfig (line 158)
  • Remove-MountFromConfig (line 221)

Co-authored-by: Gordon Beeming me@gordonbeeming.com

Original prompt

please help fix again
https://github.com/GordonBeeming/copilot_here/actions/runs/19237543363/job/54991388449


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 10, 2025 16:00
…ilure

Co-authored-by: GordonBeeming <5680199+GordonBeeming@users.noreply.github.com>
- Join-Path concatenates even when second path is absolute, causing path duplication on Windows
- GetFullPath correctly handles both relative and absolute paths
- Absolute paths are returned unchanged, relative paths are resolved to current directory
- Fixes Windows test failure where paths like "C:\Users\RUNNERC:\Users\..." were created
- Updated version to 2025-11-10

Co-authored-by: Gordon Beeming <me@gordonbeeming.com>

Co-authored-by: GordonBeeming <5680199+GordonBeeming@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recurring issues in the project Fix PowerShell path resolution using GetFullPath instead of Join-Path Nov 10, 2025
Copilot AI requested a review from GordonBeeming November 10, 2025 16:08
@GordonBeeming GordonBeeming marked this pull request as ready for review November 10, 2025 16:09
Copilot AI review requested due to automatic review settings November 10, 2025 16:09
@GordonBeeming
Copy link
Owner

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves path resolution safety in the PowerShell script by replacing Join-Path with [System.IO.Path]::GetFullPath() for more reliable absolute path resolution.

  • Replaces Join-Path (Get-Location).Path with GetFullPath() in three functions
  • Updates version from 2025-11-05.1 to 2025-11-10
  • Adds explanatory comments for the path resolution changes

… directory mismatch

- GetFullPath() uses process current directory, not PowerShell location
- On Windows CI, process current directory can differ from PowerShell's Get-Location
- This caused paths to be resolved relative to wrong directory (e.g., C:\Users\RUNNER instead of D:\a\copilot_here\copilot_here)
- Fix: Use two-parameter GetFullPath($path, $basePath) with explicit base from Get-Location
- Applied to all three locations: Resolve-MountPath, Save-MountToConfig, Remove-MountFromConfig

Co-authored-by: Gordon Beeming <me@gordonbeeming.com>

Co-authored-by: GordonBeeming <5680199+GordonBeeming@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 10, 2025

@copilot it looks like it's still broken https://github.com/GordonBeeming/copilot_here/actions/runs/19237870130/job/54993155692?pr=7

Fixed in commit 15b4c93. The issue was that GetFullPath() uses the process's current directory, not PowerShell's location. On Windows CI, the process current directory was C:\Users\RUNNER while PowerShell was in D:\a\copilot_here\copilot_here, causing path resolution to use the wrong base directory.

Changed to use the two-parameter overload GetFullPath($path, $basePath) with explicit base from Get-Location, ensuring paths are resolved correctly regardless of the process current directory.

@GordonBeeming GordonBeeming merged commit 68d77d3 into main Nov 10, 2025
@GordonBeeming GordonBeeming deleted the copilot/fix-again-issues branch November 10, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants