Skip to content

Lab isolation escapes when the app is started outside desktop launch (e.g. flutter run) #73

Closed

Description

@ElbertePlinio

Problem

The lab is only isolated for apps started through picklab desktop launch. Any app started
next to a session — most importantly flutter run, which is how you actually develop —
still inherits WAYLAND_DISPLAY from the caller and opens on the developer's real
desktop
, even with DISPLAY=:90 set.

#16 fixed this inside launchApp by
stripping WAYLAND_DISPLAY/WAYLAND_SOCKET for the launched process. That fix is correct
but its scope is one code path. Its own "Not tested" section called out the remaining gap:

Manual end-to-end with a real Wayland-preferring GUI app (e.g. a GTK Flutter build) on a Wayland [session]

This issue is that untested case, confirmed.

Reproduction

On a Wayland session (Omarchy/Hyprland), with a real Flutter Linux desktop app:

picklab session create --type desktop --project-dir <app>   # -> display :90
cd <app> && DISPLAY=:90 flutter run -d linux
picklab desktop screenshot --session <id> --out shot.png
DISPLAY=:90 xdotool search --name .                          # no windows

Expected: the app window is on :90 and appears in the screenshot.
Actual: :90 has zero windows, the screenshot is solid black with only the X root
cursor, and the app is visible on the developer's real screen.

Workaround that fixes it:

env -u WAYLAND_DISPLAY GDK_BACKEND=x11 DISPLAY=:90 flutter run -d linux

Why this matters more than a normal env bug

The failure is silent and plausible-looking. You do not get an error — you get a black
screenshot, which reads as "app did not start yet" or "capture is broken". An agent driving
the session will keep screenshotting, reasoning about a blank frame, and never learn that
the app is alive on the user's actual desktop. Worse, synthetic input aimed at the lab can
land on the real desktop, which is exactly the boundary
#16 was written to protect.

It also directly undercuts the alpha's promise in
#64: "the agent drives your Flutter app in
an isolated lab".

Agent plan

Goal: a session's isolation cannot be escaped by starting the app outside desktop launch.

Checklist:

  • Decide the seam: session-scoped env contract (a documented, exported set) rather than
    a second copy of the strip list in another call site
  • picklab session create reports the exact env an externally started app must use
    (--json field plus a copyable shell snippet), including GDK_BACKEND=x11
  • Detect and report the escape instead of returning a black frame: if the session
    display has no windows and the capture is uniform, desktop screenshot warns with the
    likely cause and the fix
  • Regression test: a Wayland-preferring GUI app started with an inherited
    WAYLAND_DISPLAY is either corrected or loudly refused
  • Document the external-launch path (flutter run, bun run dev, any dev server) in
    the desktop-session docs

Validation:

  • bun run test plus a live Xvfb test asserting the session display owns the window
  • Manual: the reproduction above, on a real Wayland session, ending green

Current status: Planned
Next action: choose the env-contract seam

Evidence

Found during a full end-to-end run of the #64
stack (PRs #65/#68/#69/#70) on an isolated :90 session: pickforge doctor -> init --mobile-integration-alpha -> launch -> synthetic clicks -> source edit -> hot reload ->
evidence record. Every step passed after the workaround; the first launch produced the
black frame described above.

Activity

  1. added
    bug
    on Sep 1, 2026
  2. ElbertePlinio commented on Sep 1, 2026

    @ElbertePlinio
    MemberAuthor

    Tracked under the pivot epic: pickforge-platform#91 (workstream 2, lab isolation correctness). Flagged there as the highest-priority defect in the pivot, since it breaks the isolation guarantee the alpha is built on and is live in main independent of the #64 stack.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions