fix(emulator): recycle iOS simulators that wedge-boot without a display framebuffer (#7065)

* fix(emulator): recycle iOS simulators that wedge-boot without a display framebuffer

CoreSimulator can report a device Booted while its display IO ports never
came up (HID alive, no com.apple.framebuffer.display port), so
ensureSimulatorBooted passes and serve-sim --detach dies with 'No
framebuffer display descriptor found'. Reconnecting hits the same Booted
early-return, so the pane could never recover without a manual
simctl shutdown/boot.

startSession now recognizes that helper failure signature, recycles the
device once (shutdown + boot), and retries; if the display still fails to
come up it surfaces an actionable erase/recreate message instead of the
raw helper log dump.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* review: harden simulator framebuffer recovery

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
This commit is contained in:
Micko Cabacungan
2026-07-02 18:13:33 -07:00
committed by GitHub
co-authored by Claude Fable 5 Jinjing
parent 11ca4955ae
commit dbd53ebb63
6 changed files with 253 additions and 8 deletions
+18
View File
@@ -73,6 +73,24 @@ describe('orca emulator CLI handlers', () => {
})
})
it('uses a wider client timeout for emulator attach recovery', async () => {
queueFixtures(
callMock,
okFixture('req_attach', {
attached: true,
info: { deviceUdid: 'device-1', streamUrl: 'http://127.0.0.1:3102/stream.mjpeg' }
})
)
await main(['emulator', 'attach', 'device-1', '--worktree', 'all'], '/repo/project')
expect(callMock).toHaveBeenCalledWith(
'emulator.attach',
{ device: 'device-1', worktree: undefined, focus: false },
{ timeoutMs: 180_000 }
)
})
it('rejects relative APK paths for remote runtimes', async () => {
remoteMock.mockReturnValue(true)
+7 -1
View File
@@ -128,7 +128,13 @@ export const EMULATOR_HANDLERS: Record<string, CommandHandler> = {
const target = await getEmulatorCommandTarget(flags, cwd, client)
const device = getOptionalStringFlag(flags, 'device')
const focus = flags.get('focus') === true
const res = await client.call('emulator.attach', { device, worktree: target.worktree, focus })
// Why: attach may cold-boot or recycle a wedged simulator (shutdown + boot +
// helper restart), which can legitimately exceed the 60s default budget.
const res = await client.call(
'emulator.attach',
{ device, worktree: target.worktree, focus },
{ timeoutMs: 180_000 }
)
printResult(res, json, (r: unknown) => {
const result = r as EmulatorAttachResult
const info = result.info ?? result