Skip to content

e2e: repro stale launchd registration slow-boot#1297

Merged
RhysSullivan merged 1 commit into
mainfrom
rs/e2e-stale-launchd-repro
Jul 4, 2026
Merged

e2e: repro stale launchd registration slow-boot#1297
RhysSullivan merged 1 commit into
mainfrom
rs/e2e-stale-launchd-repro

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a macOS-only desktop-packaged e2e repro for the stale launchd registration slow boot.

The scenario creates the broken state in an isolated fake HOME by writing Library/LaunchAgents/sh.executor.daemon.plist without bootstrapping it. It also snapshots the real gui/<uid>/sh.executor.daemon state, boots the label out for the stale case, and restores the snapshot in finally.

Bug Story

State: the LaunchAgent plist exists on disk, but launchd does not have sh.executor.daemon loaded.

Cause: packaged desktop boot checks service status; the launchd backend reports Registered: yes from plist existence alone. Desktop then runs launchctl kickstart -k gui/<uid>/sh.executor.daemon, which fails because launchd cannot find the label. Current boot logs the failure but still waits through waitForSupervisedAttach(15_000) before falling back to managed-spawn.

Measured on this run:

  • Clean control: 1378ms to ready
  • Stale launchd registration: 16699ms to ready
  • Stale page/CDP reachable: 16350ms

What This Pins

  • The main log contains launchctl kickstart failed (exit 113) and Could not find service "sh.executor.daemon".
  • The stale case pays at least 14s before page/CDP and sidecar readiness.
  • The app eventually recovers through the managed desktop connection.
  • The clean fake HOME control with background service skipped stays under 10s.

This intentionally pins current broken behavior. When the fix lands, the stale >= 14s assertions should be inverted so stale launchd registration fast-fails to managed-spawn, close to the clean control.

Recording

Committed because it is small:

  • e2e/recordings/stale-launchd-slow-boot.mp4
  • Duration: 20.0s
  • Size: 39,879 bytes

The recording shows a blank timed wait through 15s, then the packaged app appearing at managed sidecar readiness.

Verification

  • cd e2e && E2E_DESKTOP_SKIP_BUILD=1 E2E_RECORD=1 bunx vitest run --project desktop-packaged desktop-packaged/stale-launchd-registration.test.ts
  • bun run typecheck
  • bun run format:check
  • bunx oxlint -c .oxlintrc.jsonc e2e/desktop-packaged/stale-launchd-registration.test.ts --deny-warnings

Launchd state before and after was identical: launchctl print gui/501/sh.executor.daemon returned Could not find service "sh.executor.daemon" in domain for user gui: 501.

Stack

  1. e2e: repro stale launchd registration slow-boot #1297 👈 current
  2. Desktop boot: show window immediately, self-heal stale launchd state, fix boot-path latency #1303
  3. Desktop updater: keep checking after a declined update, surface errors, fix install-on-quit leak #1305

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 4, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 13eca55 Commit Preview URL

Branch Preview URL
Jul 04 2026, 05:35 AM

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 4, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 13eca55 Jul 04 2026, 05:35 AM

@pkg-pr-new

pkg-pr-new Bot commented Jul 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1297

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1297

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1297

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1297

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1297

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1297

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1297

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1297

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1297

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1297

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1297

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1297

executor

npm i https://pkg.pr.new/executor@1297

commit: c433090

@RhysSullivan RhysSullivan force-pushed the rs/e2e-stale-launchd-repro branch from c433090 to 13eca55 Compare July 4, 2026 05:33
@RhysSullivan RhysSullivan marked this pull request as ready for review July 4, 2026 05:34
@RhysSullivan RhysSullivan merged commit 7f61805 into main Jul 4, 2026
17 of 19 checks passed
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.

1 participant