fix: harden apple runner recovery

Merged
TH
5mo ago
+314-54

Summary

Fixes runner recycle accounting so a failed replacement boot does not spend the per-request recycle budget; the slot is committed only after a replacement runner boots successfully.

Hardens abandoned-work handling by checking RUNNER_BUSY/RUNNER_WEDGED before the Swift main-thread fast path, coalescing duplicate command coverage, mapping RUNNER_BUSY to a retriable COMMAND_FAILED, and preserving RUNNER_WEDGED as fatal invalidation. Closes #1121. Refs #1122: the off-main tree snapshot call still needs a larger async/orchestrator redesign because the current snapshot command body already runs synchronously on the main queue.

Adds a narrow text-entry fast path for already-focused bare type when the iOS software keyboard is visible; selector/ref/coordinate fill readiness and the first-character split are unchanged.

Validation

Focused runner Vitest suite passed: runner-command-retry, runner-client, runner-session, runner-recycle-ledger (167 tests).

Ran pnpm format, pnpm check:quick, pnpm build, and pnpm build:xcuitest.

Manual Settings simulator smoke on iPhone 17 Pro: fill @e18 alpenglowxyz completed in 6.28s; already-focused type qwertyuiop completed in 0.91s; session codex-text-entry was closed.