Skip to content

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

Closed

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;

Activity

  1. zoherghadyali commented on Jun 29, 2026

    @zoherghadyali
    Author

    Verified fixed in GitHub Copilot app v1.0.11 (Copilot CLI v1.0.59).

    Confirmed that __COMPAT_LAYER is no longer set in the Copilot shell environment. Ran the DevTools MCP e2e test suite with Edge (PUPPETEER_EXECUTABLE_PATH=msedge.exe) and all 18 console tests pass without any workaround needed.

    Thanks Pierce for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions