Skip to content

fix(desktop): open the launch grace window once the supervisor has spawned the app - #195

Merged
ElbertePlinio merged 1 commit into
mainfrom
fix/191-launch-grace
Sep 22, 2026
Merged

ElbertePlinio merged 1 commit into
mainfrom
fix/191-launch-grace

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Closes #191

With a containment scope the process group leader is the Node supervisor, so the 300 ms launch grace window was measured from the supervisor's own start and counted Node startup plus the cgroup join against the app. On a loaded host the group could outlive the window before the app had run, and an app that exits at once was reported as launched.

launchApp now waits, only under containment, until a second group member is visible or the group has already died, bounded by 10 s, before the grace window opens. Expiry is a failed launch that runs the existing cleanup and stops the supervisor's group; it is never assumed to be fine. Without a supervisor the leader is the app itself and nothing changes.

The env-dump fixture in isolation.test.ts writes to a .part file and renames it, so the runtime-dir assertion cannot read a half-written file. Escapee containment, no-loose-process assertions and test timeouts are unchanged.

Decision on the first checklist item: the window is measured from the observed spawn in the launcher rather than by having fixtures signal readiness, because the false-launch was a product defect, not just a test-timing problem.

Verification

  • New unit test in apps.test.ts delays the supervisor's own startup by 1 s with a builtin (no extra group member) and requires the exits-at-once app to still be rejected. It fails on the unmodified launcher ("promise resolved instead of rejecting") and passes with the fix.
  • New unit test for a supervisor that never spawns: the launch rejects, the app never ran and the supervisor's group is gone.
  • isolation.test.ts and screenshot-wait-live.test.ts unloaded: 12/12 on cgroup and on marker (PICKFORGE_CONTAINMENT=marker).
  • Under 32 busy loops on 16 CPUs with the tests niced to 15 (load average up to 51): cgroup 3/3 runs, marker 3/3 runs for every launch-grace assertion. One marker run failed desktopWait changed with timeout after the zenity window had already been found, which is the 5 s screenshot-change budget under extreme load and not the grace window; tracked in screenshot-wait-live pixel-change wait times out under heavy CPU load #193.
  • Lint, typecheck, complexity-gate and the coverage suite pass.
  • Independent Astra review: one blocking finding (the 10 s fall-through) fixed by making expiry a failure; recheck accepted.

…awned the app

With a containment scope the process group leader is the Node supervisor,
so a grace window measured from its own start counted Node startup and the
cgroup join against the app. On a loaded host the group could outlive the
300 ms window before the app had run, and an app that exits at once was
reported as launched. Wait until a second group member is visible, or the
group has already died, before the window opens; without a supervisor the
leader is the app itself and nothing changes.

The env-dump fixture in the isolation test now writes atomically so the
assertion cannot read a half-written file.

Closes #191
@ElbertePlinio
ElbertePlinio merged commit 13f6d85 into main Sep 22, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/191-launch-grace branch September 22, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop launch grace window makes containment tests flip under CPU load

1 participant