Fix Windows build: exclude pi-coding-agent from packaged app#3727
Fix Windows build: exclude pi-coding-agent from packaged app#3727wojtekn wants to merge 4 commits into
Conversation
… path-too-long error @earendil-works/pi-coding-agent is a devDependency used only for TypeScript types (import type). Its transitive @mistralai/mistralai dep contains filenames like getchatcompletionfieldoptionscountsv1...post.js that, when nested under pi-coding-agent/node_modules/, exceed Windows' 260-char path limit and cause the Squirrel/NuGet maker to fail. galactus (DestroyerOfModules) should prune devDeps from the packaged output, but after install:bundle's standalone npm install the pruning doesn't reliably remove the nested node_modules. Adding an explicit forge ignore pattern is a reliable safety net.
📊 Performance Test ResultsComparing b4b995d vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
…Windows path limit
electron-winstaller ships nuget.exe v4.0, which predates long-path support. Long paths require nuget.exe >= 4.8 AND the LongPathsEnabled registry key. Download the latest nuget.exe at build time to satisfy both conditions. Also removes the forge ignore workarounds for pi-coding-agent, react-native and @react-native that were added to work around the old NuGet limitation.
| Write-Host "--- :windows: Enabling long path support" | ||
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` | ||
| -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | ||
| If ($LastExitCode -ne 0) { Exit $LastExitCode } |
There was a problem hiding this comment.
Interesting. The AMI already should enable long paths with these instructions:
Write-Output "Enable long path behavior"
# See:
#
# - https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation
# - https://support.atlassian.com/bamboo/kb/git-checkouts-fail-on-windows-with-filename-too-long-error-unable-to-create-file-errors/
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
git config --system core.longpaths true
I see this command adds -PropertyType DWORD -Force which maybe should be pushed upstream to the AMI, too.
However, it's hard to tell whether the issue is with the original command or with electron-winstaller below. That is, I wonder if the latest stable version of that package will work without the additional params in the long-path configuration.
|
Discovered with Claude: The The failure is in Squirrel's bundled The key frame is |
|
I researched an alternative with AI and pushed it in #3735 |
|
Closing in favor of #3735 |
Related issues
Follows up on #3707 (migrate
@mariozechner/pi-*to@earendil-works/pi-*).How AI was used in this PR
Claude Code diagnosed the root cause and wrote the fix.
Proposed Changes
After #3707 landed, the Windows Squirrel build started failing with:
Root cause:
@earendil-works/pi-coding-agentis adevDependencyofapps/studio(only needed forimport type { SessionEntry }— erased at compile time). However, afterinstall:bundlerunsnpm install --no-workspaces, galactus (electron-packager'sDestroyerOfModules) doesn't reliably prune the nestednode_modulesunderpi-coding-agent. Its transitive@mistralai/mistralaidependency contains filenames likegetchatcompletionfieldoptionscountsv1observability...post.jsthat reach 200+ chars on their own. With the Windows build agent prefix (C:\buildkite-agent\builds\ci-windows-...\automattic\studio\) the total path hits ~295 chars — 35 over the 260-char limit.The fix adds an explicit
ignorepattern toforge.config.tsso electron-forge never copiespi-coding-agentinto the packaged output, regardless of whether the devDep prune works. This is a belt-and-suspenders approach since the package should already be excluded as a devDep.Testing Instructions
pi-coding-agentwas only imported for TypeScript types, not included at runtimePre-merge Checklist