Skip to content

Desktop launch grace window makes containment tests flip under CPU load #191

Closed

Description

@ElbertePlinio

Found while attributing local failures on PR #189; present on unmodified main (3ea6214). launchApp in packages/desktop-linux/src/apps.ts rejects with "exited immediately" only when the launcher's process group dies within LAUNCH_GRACE_MS (300 ms). Under the cgroup mechanism the group leader is the Node supervisor that joins the cgroup before spawning the command, so on a loaded host the group can outlive the grace window and the launch resolves instead. Several desktop-linux tests assert one side of that window and flip under load.

Observed with 32 busy-loop processes on a 16-CPU delegated-cgroup host, three runs each: unmodified main flipped "tells the operator the escapee is still contained, not loose" (promise resolved instead of rejecting) once; the PR #189 build flipped "holds and kills a daemonising app that escaped its process group" once and, in the same run, "hands a launched app the session runtime dir, not the caller's" read an empty value. The coverage run with three workers on PR #189 hit the same "holds and kills" flip, and the unmodified full run hit the inverse in screenshot-wait-live.test.ts ("zenity exited immediately after launch"). Without load both files pass 5/5. Logs are preserved locally under ~/.pickforge/investigations/179/local-failures.

  • Decide whether the grace window should be measured from the moment the supervisor has spawned the command (cgroup mode) rather than from the supervisor's own start, or whether the daemonising fixtures should signal readiness explicitly, so the assertion does not depend on Node startup time.
  • Make "hands a launched app the session runtime dir" wait for the app's write instead of reading immediately.
  • Keep escapee containment and no-loose-process assertions strict; no retries, skips or longer timeouts to hide a real escape.
  • Run isolation.test.ts and screenshot-wait-live.test.ts under artificial CPU load and confirm stable results on both mechanisms.

Decision: the grace window is measured from the observed spawn under the supervisor (PR #195), not from fixture readiness signals, because the false launch was a product defect. Load verification: cgroup 3/3 and marker 3/3 for every launch-grace assertion; one unrelated screenshot-wait timeout under load is tracked in #193.

Activity

  1. added
    bug
    on Sep 22, 2026
  2. added a commit that references this issue on Sep 22, 2026
    a7afc1b
  3. added a commit that references this issue on Sep 22, 2026
    13f6d85
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