happier icon indicating copy to clipboard operation
happier copied to clipboard

Windows: inherited PowerShell 7 module path breaks protected MCP configuration before Claude startup

Open RogueKostas opened this issue 1 month ago • 1 comments

Happier CLI 0.2.16 on Windows can exit before Claude starts while preparing MCP servers. The visible error is "Windows protected ACL verification returned invalid JSON". A queued user message remains undelivered because no session runner survives startup.

Confirmed mechanism

The protected-state helper launches Windows PowerShell 5.1 while inheriting PSModulePath. When that environment includes PowerShell 7's distribution modules before the Windows PowerShell modules, importing Microsoft.PowerShell.Security fails with duplicate extended type-data members. Get-Acl therefore produces no snapshot. The helper's inspection script can still exit with status zero, leaving empty standard output that is reported as invalid JSON. The ACL application script is exposed to the same module-loading problem.

An isolated comparison on the affected host reproduced the module-import failure with the inherited environment and succeeded with the native Windows PowerShell module directory selected. No ACL relaxation was required.

Synthetic reproduction

  1. Use Windows with Windows PowerShell 5.1 and PowerShell 7 installed.
  2. Launch Happier from an environment whose PSModulePath gives PowerShell 7 distribution modules precedence.
  3. Configure a disposable Claude session with a harmless stdio MCP server requiring a protected runtime configuration.
  4. Start or resume that session and send a synthetic message.
  5. Observe failure during MCP preparation, before the Claude provider loop starts.
  6. Compare the protected-state PowerShell command with a child-specific module search path that selects Windows PowerShell's own Security module.

Expected behavior

Happier should resolve the native module appropriate to the PowerShell executable it launches and should not depend on a caller's incompatible module search order. Both application and inspection scripts should fail explicitly on command errors and preserve useful sanitized diagnostics. A failed permission check must remain fail-closed; disabling verification or weakening ACLs is not a fix.

Verified workaround and limits

Supplying a corrected PSModulePath only to the resumed session allowed MCP preparation and provider startup to complete. All original conversation bytes were backed up and retained, the same native conversation was used, and the daemon was not restarted. A separate transcript-repair failure was diagnosed and recovered independently before fresh Opus activity was verified. This report concerns the reproducible startup blocker, not automatic account failover.

No project data, paths, host names, account identifiers, session identifiers, session text, raw logs or screenshots are included. Reproduction uses synthetic data only.

RogueKostas avatar Oct 21 '26 22:10 RogueKostas

Thanks for tracking this down—the inherited module-path comparison identified the relevant startup boundary.

We confirmed that the shared ACL helper launched Windows PowerShell 5.1 while inheriting the caller’s module path, matching Microsoft’s documented compatibility problem.

The correction selects native modules only for the ACL child processes, makes both scripts stop explicitly on errors, and preserves bounded diagnostics. ACL requirements remain unchanged. Your diagnosis is credited in the commit.

Host regressions and typechecks pass in both development lines. Native Windows tests were added but could not run here; release availability is not yet verified. Once the correction reaches stable, please retry the original startup flow and share the exact CLI version if it still fails.

Posted on behalf of @leeroybrun.

happier-bot avatar Oct 22 '26 07:10 happier-bot