iOS shell typing lag
Answer me with artifact · 2026-10-30 21:30

iOS shell typing lag

Each batch of keys waited on two Clerk sign-in token fetches before it left the phone. The fix uses the cached token. It is installed on iPhone (4). Typing speed on the phone is not measured yet.

A

Where the time went

removedremovedPOSTrelay socketecho over SSEKey pressClerk token 1Clerk token 2cloud-api relayYour computerScreen
B

What changed

table
Area | Before | NowSign-in token | New Clerk fetch on each API call | SDK cache, refreshed before expiryShell input on a relayed computer | Two Clerk fetches per batch | No Clerk fetch while the token is validBot pane keys | One separate task per key, so keys could change order | Sent in order, in batches
C

What remains

Each key still crosses the relay

The relay trip stays. Cloud-api /health took 160–215 ms over a reused connection from the Mac. The phone may differ. If typing is still slow, the next fix is one open relayed socket for /terminal/*. That needs a new runtime route and a runtime publish.

D

State

PR
#2010, open and not merged
Phone
iPhone (4), built on commit 3a81a34f3 plus the fix
Build
Release device build succeeded
Not checked
typing speed, and which route your phone used
Check
Open Code, open Shell, type a long command