You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mobile-bridge: native requests hang until the timeout when postMessage fails #7350
In the injected mobile bridge script, post() swallows any exception from postMessage, and request() registers its pending entry anyway. When the bridge is gone (for example during a navigation), the page's promise waits the full 10 s (30 s for clipboard requests) and then fails with "native request timed out". It should fail at once.
Repro
Code path (found by reading main):
In a mobile WebView, call native.request(...) while window.ReactNativeWebView.postMessage throws, for example while the page navigates.
post() catches the exception and returns nothing.
request() has already stored the pending entry and started its timer. Nothing rejects it until the timer fires.
Cause
Line numbers are from main at 7c1353d8.
packages/mobile-bridge/src/inject.ts:63-69: post catches the error and returns nothing.
inject.ts:143-153: request creates the timer (:146-149), stores pending[id] (:150), then calls post (:151) and ignores the outcome.
Suggested fix
Make post return a boolean. In request, if post returns false, clear the timer, delete the pending entry and reject at once.
varpost=function(message){try{window.ReactNativeWebView.postMessage(JSON.stringify(message));returntrue;}catch(error){returnfalse;}};// in request():if(!post({type: "request",id: id,request: {kind: kind,payload: payload}})){clearTimeout(timer);deletepending[id];reject(newError("native bridge unavailable"));}
Verdict: REPRODUCED; high root-cause confidence. The same agent repeated the reproduction in a second clean trusted checkout.
Root cause: request/reply sends swallow synchronous transport errors, leaving their pending promises and 10/30-second deadlines active after delivery fails.
Reproduction report includes the runnable observer, failing regression, and verification evidence. Device navigation itself was not tested.
Ready fix:PR #7372 rejects failed sends immediately and clears pending state without changing the public bridge protocol. Two files, 47 changed text lines.
Verification: both regression cases fail before the fix and pass afterward; all 42 package tests, typecheck, type-aware lint, formatting, and git diff --check pass.
Activity
bb-slop-cop commentedon Nov 10, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotmobile,confirmed-repro.git diff --checkpass.Reject mobile-bridge native requests immediately when postMessage fai…