Skip to content

__COMPAT_LAYER=DetectorsAppHealth env var breaks Edge browser launch from Copilot shell #1227

@zoherghadyali

Description

@zoherghadyali

Summary

The Copilot desktop app sets __COMPAT_LAYER=DetectorsAppHealth in its process environment. This Windows Application Compatibility shim is inherited by all child processes (including the agent shell). When Microsoft Edge is launched from the Copilot shell (via Puppeteer, Playwright, or direct spawn), Edge's msedge.exe launcher process exits immediately with code 0, breaking all browser automation.

Chrome/Chromium's bundled exe is NOT affected.

Min Repro

From the Copilot agent shell:

# This FAILS because __COMPAT_LAYER=DetectorsAppHealth is inherited
node -e "require('puppeteer-core').launch({executablePath:'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe',headless:true}).then(b=>{console.log('OK');b.close()}).catch(e=>console.error('FAIL:',e.message.substring(0,200)))"
# Output: FAIL: Failed to launch the browser process: Code: 0

# This WORKS after clearing the env var
$env:__COMPAT_LAYER = $null
# Same command -> Output: OK

Environment

  • OS: Windows 11 Enterprise (10.0.26200)
  • Edge: 149.0.4022.80
  • Copilot CLI: 1.0.64-0
  • Node.js: v24.8.0
  • Puppeteer: 25.1.0

Root Cause

__COMPAT_LAYER=DetectorsAppHealth propagates through:
github.exe -> copilot.exe -> pwsh.exe -> node.exe -> msedge.exe

When Edge inherits this shim, its launcher process exits immediately (code 0, ~90ms) instead of staying alive. Child browser processes DO run (port is reachable), but the parent exit causes Puppeteer/Playwright to treat it as a launch failure.

Suggested Fix

  1. Don't set __COMPAT_LAYER for the shell/child processes
  2. Clear it before spawning the agent shell
  3. Or document this as a known limitation

Impact

Any agent task that needs to launch Edge (e2e tests, Puppeteer scripts, Playwright tests) fails from the Copilot shell.

Workaround

$env:__COMPAT_LAYER = $null

or in Node.js:

delete process.env.__COMPAT_LAYER;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions