Fix Power Pages generator installation error detection on restricted networks (UsGov systems)#1339
Fix Power Pages generator installation error detection on restricted networks (UsGov systems)#1339
Conversation
- Commands now register even if generator installation fails - Added proper exit code checking for npm install - Added retry mechanism with user-friendly error messages - Added test coverage for command registration behavior - Improved error handling and telemetry logging Co-authored-by: amitjoshi438 <54068463+amitjoshi438@users.noreply.github.com>
|
@copilot we don't want to register command if generator installation fails, generator is required for commands to work |
Per feedback, commands should NOT register if generator installation fails. Reverted CreateCommandWrapper.ts to original behavior where commands only register when generator is successfully installed. Kept the improved error detection in GeneratorAcquisition.ts which properly checks npm exit codes (child.status !== 0) in addition to child.error. This ensures installation failures are properly detected and reported on restricted networks like UsGov systems. Co-authored-by: amitjoshi438 <54068463+amitjoshi438@users.noreply.github.com>
You're absolutely right. I've reverted the command registration changes. Commands will NOT be registered if generator installation fails, as the generator is required for them to work. The fix now only improves error detection in Changes in commit: |
Problem
On restricted network environments such as UsGov systems, Power Pages generator installation was failing silently. Users would see "Installing Power Pages generator..." message but npm would fail without proper error detection or user feedback, leaving the generator uninstalled and commands unavailable.
Root Cause
The
GeneratorAcquisition.ensureInstalled()method only checkedchild.errorfromspawnSync, but on restricted networks npm could fail with a non-zero exit code without setting the error object. This caused:yoCommandPathnull)Solution
Enhanced Error Detection (
GeneratorAcquisition.ts)Now checks both
child.errorANDchild.statusfor npm install failures:This ensures:
Impact
✅ Better error detection: Properly detects npm failures on restricted networks
✅ Better diagnostics: Exit codes logged in telemetry for troubleshooting
✅ Clear user feedback: Users see error messages when installation fails
✅ Backwards compatible: No changes to command registration logic
✅ Works on restricted networks: Properly handles npm failures on UsGov systems
Behavior
Fixes #1338
Original prompt
Fixes #1338
💡 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.