Skip to content

AGENT_BROWSER_ARGS="--ozone-platform=wayland" is not respected for headed operation #132

Description

@jasalt

Browser extra argument environment variables for agent-browser setting Wayland as display backend are not respected for headed usage. Extension initiates headed browser with X11 backend while manually running !agent-browser --headed in same Pi session behaves correctly and opens headed browser using Wayland display backend.

Noticed in Lima (Qemu) VM running on Linux host with Wayland using waypipe for tunneling the display from guest to host.

Rough repro:

  1. Both host and quest are Fedora 44 with waypipe via dnf install waypipe. Guest also has chromium installed.
  2. Host connecting wayland display to quest VM waypipe --compress lz4 ssh -F /home/user/.lima/default/ssh.config lima-default
  3. Environment variables set in guest VM shell session for agent-browser before starting Pi:
export AGENT_BROWSER_ARGS="--ozone-platform=wayland"
export AGENT_BROWSER_HEADED=true
  1. When instructing Pi to open example.com in headed browser the extension's agent_browser tool call doesn't seem to pick up the setting but tries to open browser with missing X11 which fails:
agent_browser                                                                   
                                                                                 
 {                                                                               
   "args": [                                                                     
     "open",                                                                     
     "http://example.com",                                       
     "--headless=new"                                                            
   ],                                                                            
   "sessionMode": "fresh"                                                        
 }                                                                               
 Chrome exited early (exit code: 1) without writing DevToolsActivePort           
 (also tried parsing stderr) Chrome exited before providing DevTools URL         
 Chrome stderr:                                                                  
                                                                                 
 [89738:89738:0815/130135.635842:ERROR:ui/ozone/platform/x11/ozone_platform_x11. 
 cc:257] Missing X server or $DISPLAY                                            
   [89738:89738:0815/130135.635900:ERROR:ui/aura/env.cc:246] The platform failed 
 to initialize.  Exiting. 

Managed session outcome: Fresh launch became current, but this tool call failed 
 after launch.                                                                   
 Recovery:                                                                       
 - Continue with sessionMode "auto" on the current session, or inspect           
 failureCategory / qaPreset to fix the post-launch failure.                      
 - Run doctor only if later browser commands also fail.                          
 - Full session names and transition details remain in                           
 details.managedSessionOutcome.                                                  
 Cleanup warning: Automatic close of the previous wrapper-managed session        
 failed, so it remains wrapper-owned. Use details.managedSessionOutcome for its  
 exact identity and close it explicitly when safe.                               
                                                                                 
 Result category: failure; failureCategory: upstream-error; Pi tool isError:     
 true.       
  1. Running ! agent-browser open --headed example.com manually works as expected opening browser Wayland window on host.

Workaround in this scenario is disabling the extension and using the agent-browser CLI directly.

Might apply to MacOS host also if using https://github.com/J-x-Z/cocoa-way or https://github.com/J-x-Z/waypipe-darwin.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions