Skip to content

perf: avoid redundant physical iOS runner health check - #2215

Merged
thymikee merged 2 commits into
mainfrom
perf/ios-first-boot-no-redundant-health
Sep 1, 2026
Merged

perf: avoid redundant physical iOS runner health check#2215
thymikee merged 2 commits into
mainfrom
perf/ios-first-boot-no-redundant-health

Conversation

@thymikee

@thymikee thymikee commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

Normal physical-iOS first open used its opportunistic runner prewarm to issue an uptime readiness command while the first snapshot was establishing the same runner. This keeps session startup best-effort but lets the first snapshot prove readiness, removing that redundant command only for an unawaited first open. Relaunch, simulator, explicitly awaited prewarm, explicit prepare, and other Apple targets remain unchanged.

On iphone (iOS 26.6.1), randomized 8+8 first-boot runs with stable LAN Metro and a task-owned external signed xctestrun (buildMs: 0) changed outer-wall open + first semantic snapshot from median/reported-p95 13.44s / 28.08s to 12.29s / 17.53s. Internal daemon timing changed from 11.19s / 26.25s to 10.38s / 15.34s. Open-time uptime was present in 8/8 baseline runs and 0/8 candidate runs; all 16 runs reached the healthy tree-backed Catalog screen.

The work-count result and median improvement are causal. With eight samples, nearest-rank p95 is the single worst run, so the tail change is directional evidence rather than a stable percentile estimate. PR #2200 relaunch results are excluded.

Validation

  • Planted-red proof observed before the runtime fix for the new option and first-open ordering invariant.
  • CI-planted architecture red reproduced locally: the prewarm test grew a pinned 1,325-line file to 1,338 lines.
  • Extracted the prewarm family to runner-client-prewarm.test.ts, lowered the old file's pin to 1,280 lines, and added an awaited-prewarm health-check fence.
  • Focused lifecycle, runner prewarm/retry, and size-ratchet tests: 51/51 passed.
  • pnpm check:affected --run passed format, lint, typecheck, layering, DI seams, fallow, build, package, and Node integration before the full related-test selection hit unrelated host-load-sensitive 5-second timeouts. The scoped tests remained green; exact-head CI is authoritative for the hardening-only follow-up commit.
  • Physical-device A/B campaign and final sanity flow: open, two snapshots, first interaction, and post-interaction semantic readiness all passed.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.55 MB 2.55 MB -1.1 kB
JS gzip 857.4 kB 857.1 kB -249 B
npm tarball 981.9 kB 981.3 kB -612 B
npm unpacked 3.39 MB 3.39 MB -1.1 kB

npm unpacked components

Component Base Current Diff
JS / dist source 2.71 MB 2.70 MB -1.1 kB
Apple runner source/project 581.2 kB 581.2 kB 0 B
macOS helper source 54.8 kB 54.8 kB 0 B
Android helper artifacts 0 B 0 B 0 B
Other package files 45.7 kB 45.7 kB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 32.7 ms 36.0 ms +3.3 ms
CLI --help 80.4 ms 85.2 ms +4.8 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/interaction.js +30.7 kB +9.4 kB
dist/src/session-store.js +7.9 kB +2.1 kB
dist/src/app-inventory-contract.js -4.5 kB -1.3 kB
dist/src/runtime.js -3.6 kB -1.3 kB
dist/src/runtime4.js +221 B +47 B

Top changed packed files

Packed file Base Current Diff
dist/src/interaction2.js 30.9 kB 0 B -30.9 kB
dist/src/interaction.js 7.9 kB 30.7 kB +22.7 kB
dist/src/parameterized-recorded-fill.js 8.4 kB 0 B -8.4 kB
dist/src/session-store.js 40.6 kB 48.5 kB +7.9 kB
dist/src/snapshot-chrome.js 0 B 4.6 kB +4.6 kB
dist/src/app-inventory-contract.js 51.7 kB 47.2 kB -4.5 kB
dist/src/interaction-runtime.js 0 B 3.9 kB +3.9 kB
dist/src/react-native-overlay2.js 0 B 3.7 kB +3.7 kB
dist/src/runtime.js 68.4 kB 64.8 kB -3.6 kB
dist/src/interaction-common.js 0 B 2.3 kB +2.3 kB

@thymikee

thymikee commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Reviewed exact head 8580c8b307a45feada01e20c73b9d206dba33455: no code findings. The lifecycle owner selects healthCheck: false only for unawaited physical-iOS first open, while the local runner owner starts the keyed session without issuing redundant uptime; awaited/relaunch and other target paths preserve readiness behavior. Focused regression tests prove both selection and zero-command execution, and the 8+8 physical-device evidence plus final interaction flow is credible. READY for human code review; exact-head CI and iOS Smoke are still running, so this is not yet merge-ready.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 1, 2026
@thymikee
thymikee merged commit 7646a73 into main Sep 1, 2026
17 of 18 checks passed
@thymikee
thymikee deleted the perf/ios-first-boot-no-redundant-health branch September 1, 2026 13:30
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-01 13:30 UTC

@thymikee

thymikee commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Post-merge finding on exact head 8580c8b307a45feada01e20c73b9d206dba33455: the optimization is broader than the stated first-open invariant. isUnawaitedPhysicalIosOpen() selects healthCheck: false for every physical-iOS non-relaunch, non-explicit-prewarm open, but does not require !input.hasExistingSession. An ordinary open inside an existing daemon session therefore also skips the cached-runner readiness proof, although the body and planted regression cover only a fresh first open. Please fix this at the lifecycle selection owner by adding the existing-session boundary and an adversarial existing-session/non-relaunch test that preserves the default health check, while retaining the fresh-session zero-command test. The exact-head iOS Smoke failure is simulator-only and source-disjoint from this physical-device branch, but the required lane was red at merge time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant