Repository navigation
fix(serve-sim): recover capture after framebuffer loss - #207
Conversation
🦋 Changeset detectedLatest commit: 4823a7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f65bf60 to
7bd5409
Compare
|
Shortened the changeset and amended the existing commit to replace the Claude co-author trailer with Codex, at Gabe’s request. — Codex |
7bd5409 to
07623e7
Compare
|
Codex contribution on 07623e7: removed or shortened redundant implementation and test comments. Executable lines are unchanged; the existing commit was amended at Gabe’s request. — Codex |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
07623e7 to
98c04b2
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
14797e9 to
9654892
Compare
|
Codex follow-up in Both new native regressions failed on Codex ran:
Build, typecheck, isolated tests, native tests, and the iPhone reboot suite were rerun after rebasing. Device runs used the rebuilt local CLI and the pinned-device Gabe-approved LLP follow-up in At Gabe’s request, the three PR commits are now one commit, 2026-10-08 reviewer follow-upCodex implemented szdziedzic's live-read rate-limit request, added regressions, and updated LLP 0001. Gabe approved this direction after reviewing the earlier Published head: Live reads now have an independent one-second cadence. Surface-change callbacks use their supplied cached surface immediately, even when a live read is overdue. Callback bursts cannot reset the deadline or repeatedly query the getter; wiring a new descriptor set performs one bootstrap live read. Cached nil between live observations cannot advance the recovery timer. The comment now describes these paths directly. Before the production fix, getter-count and pixel regressions failed on the rebased pre-follow-up source: callback bursts made 26 reads instead of 1, and nil-cache bursts made 51 instead of 1. A separate overdue-callback regression then reproduced stale/dropped replacement pixels before that boundary was fixed. The final tests use a controlled clock for deadlines and check pixels, equal seeds, getter counts, and recovery counts. Codex ran on the published head, with Bun 1.3.14:
Local device validation used only simulators created for this review: # From packages/serve-sim, with pinned Bun 1.3.14 on PATH:
SERVE_SIM_TEST_UDID=07564F82-291A-496C-9B4A-40094C544482 \
bash packages/serve-sim/scripts/test/e2e.sh \
packages/serve-sim/src/__tests__/capture-reboot-recovery.e2e.test.ts \
packages/serve-sim/src/__tests__/hardware-keyboard-shift.e2e.test.ts \
-t 'preconditions for capture recovery|captures again after the device reboots|tap, drag, and scroll still reach UIKit'
# iPhone 17 Pro, iOS 26.4 / Xcode 26.4: 3 pass, 10 filtered out, 0 fail.
DEVELOPER_DIR=/Applications/Xcode-27.1.0-Beta.app/Contents/Developer \
SERVE_SIM_TEST_UDID=BB26150B-17C3-4641-BC64-CF7454D8C4EF \
SERVE_SIM_DUO_REBOOT_E2E=1 \
bash packages/serve-sim/scripts/test/e2e.sh \
packages/serve-sim/src/__tests__/capture-reboot-recovery.e2e.test.ts \
packages/serve-sim/src/__tests__/duo-reboot-recovery.e2e.test.ts
# iPhone Duo, iOS 27.1 / Xcode 27.1 beta: 4 pass, 0 fail.Those runs check fresh delivered pixels after reboot; Duo also checks capture and HID recovery in the same server PID after preview and network-capture reboots. The unaffected iPhone input test observes tap, drag, and scroll reaching UIKit. These are local Simulator checks. Duo timing sample: four fold/unfold switches per build on the same owned device, with ~3 seconds per interval and an MJPEG viewer. Across the switch intervals, Previous-head CI diagnosis: the Android byte-cap failure also occurred on main and is left separate. EAS passed the reboot test on both attempts but timed out starting mitmproxy. This rebase includes the already-merged mitmproxy quarantine fix. Exact-head CI results are recorded below. 2026-10-08 hosted EAS validationCodex downloaded the successful EAS workflow's artifact for exact head eas simulator:start --platform ios --type web-preview-only \
--non-interactive --json --device 'iPhone Duo' \
--name 'PR207 framebuffer recovery validation 20261008' \
--tag pr207-validation --max-duration-minutes 30 \
--package-version <signed exact-head artifact URL>EAS CLI 24.12.0; iPhone Duo / iOS 27.1; remote UDID
Boundary: this hosted reboot command closes Codex stopped this session explicitly after validation. No PR source files changed during the hosted run. Exact-head CI: EAS serve-sim tests, — Codex |
c690ec5 to
f5f10e8
Compare
Retry display wiring once a second before the first frame and when a surface stays missing after capture has started. Read each descriptor's live unmasked or masked surface on revalidation, and invalidate stale seeds and canvas geometry when the surface changes. Sample recovery timing before capture work so a slow healthy poll does not trigger a rewire. Publish resize notifications from successful capture rather than preassigning dimensions during wiring. Add loss logs and surfaceLosses, surfaceLostMs, and rewires to capture stats. Cover policy decisions, real IOSurface swaps, masked-only frames, failed rewires, slow capture, resized recovery, and fresh pixels after reboot. Declare sips for knip and document recovery in LLP 0001 with one @ref. Co-Authored-By: Codex <[email protected]>
f5f10e8 to
4823a7e
Compare
What
Recover capture after framebuffer loss, with retries, loss logs, and capture stats. Read live surfaces once per second independently of callback-driven picks; callbacks use their supplied surfaces immediately. Clear stale seeds and canvas geometry when surfaces change.
Why
A preview stopped producing frames. The customer's exact trigger remains unknown. Rebooting a simulator exposed the missing recovery path: wiring was retried only before the first frame. Independent live-read timing also avoids repeated private API calls during compositor swaps.
Authorship and LLM use
f5f10e81and approved this follow-up's direction. Codex ran the checks below.Evidence
Codex checked
4823a7eb, one commit on maindcc46a59:bun run checkstill fails on knip findings unchanged from the pre-follow-up baseline.bun run buildpassed.bun run test: 2,097 pass, 158 skip, 0 fail; Bun 1.3.14.--package-versionon iPhone Duo / iOS 27.1. Fresh WebRTC pixels and UIKit input passed; static-screen and eight fold switches across 2D and fixed-panel 3D feeds reported zero surface losses or rewires. Managed reboot recovered video/input; that path restarts capture, so direct capture self-heal remains covered by the local and CI regressions.bun run llp:check: 10 docs, 20 refs, 0 errors. Commands, device IDs, timing samples, hosted evidence, and CI diagnosis. Exact-head EAS tests andcheckpassed. Android gRPC duration CI failed before recording validation because Hub's selected port was already in use; its test/CLI paths are unchanged by this PR.Rollback
Plain revert.
— Codex