fix(agentic): match RN 0.81 Bridgeless inspector targets#29895
Conversation
The agentic CDP target discovery (`scripts/perps/agentic/lib/target-discovery.js`) filtered Metro `/json/list` results by `t.title` matching `/react|hermes/i`. With React Native 0.81 + Hermes Bridgeless, the inspector titles are bundle-id-only (e.g. `io.metamask.MetaMask (mm-5)`) and the runtime kind moved into `description` (e.g. `React Native Bridgeless [C++ connection]`). The old filter excluded every Bridgeless target → `discoverAllTargets()` returned `[]` → `cdp-bridge.js status` returned empty → `yarn a:ios` preflight CDP wait timed out even when `__AGENTIC__` was actually exposed and reachable. Relax the candidate filter in both `discoverTarget` and `discoverAllTargets` to also accept targets whose `description` contains `bridgeless` or `hermes`. Behavior on pre-0.81 builds is unchanged (the legacy title-based clause still matches first).
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29895 +/- ##
=======================================
Coverage 81.50% 81.51%
=======================================
Files 5328 5328
Lines 141146 141146
Branches 32157 32157
=======================================
+ Hits 115046 115054 +8
+ Misses 18239 18231 -8
Partials 7861 7861 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|



Description
yarn a:ioswas failing at the CDP-wait step on RN 0.81+ builds withStill waiting... app may still be loading JS bundlefollowed by a timeout, even when the simulator was booted, the app was running, and__AGENTIC__was actually exposed and reachable on Metro's inspector port.Root cause:
scripts/perps/agentic/lib/target-discovery.jsfilters Metro/json/listresults byt.titlematching/react|hermes/i. With RN 0.81 + Hermes Bridgeless the inspector titles are bundle-id-only (e.g.io.metamask.MetaMask (mm-5)) and the runtime kind moved intodescription(React Native Bridgeless [C++ connection]). The old filter excluded every Bridgeless target —discoverAllTargets()returned[],cdp-bridge.js statusreturned empty, the preflight loop timed out.Verified on a freshly built RN 0.81.5 simulator session before the patch:
curl http://localhost:<port>/json/listreturned a Bridgeless target whoseappIdwasio.metamask.MetaMaskanddescriptionwasReact Native Bridgeless [C++ connection].Runtime.evaluate("typeof __AGENTIC__")returnedobject(the bridge was there the whole time).node scripts/perps/agentic/cdp-bridge.js statusreturned[](empty), confirming the agentic discovery filter dropped the target.After the patch,
cdp-bridge.js statuson the same session returns:The fix relaxes the candidate filter in both
discoverTargetanddiscoverAllTargetsto also accept targets whosedescriptioncontainsbridgelessorhermes. Pre-0.81 behavior is unchanged because the legacy title-based clause still matches first; the new branch only fires when the title doesn't match. No behavior change on Android or older RN builds.Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
N/A — agentic CDP-wait failure mode is text-only:
After
N/A — same path now succeeds without timing out (
yarn a:iosproceeds to the wallet setup step).Pre-merge author checklist
Performance checks (if applicable)
Pre-merge reviewer checklist
Note
Low Risk
Low risk: narrow change to debug-target discovery heuristics, only broadening candidate matching to include RN 0.81+ Bridgeless targets; primary risk is accidentally matching an extra non-RN CDP target in unusual Metro setups.
Overview
Fixes Agentic CDP target discovery on RN 0.81+ Bridgeless by widening the Metro
/json/listcandidate filter to accept targets identified viadescription(e.g., containingbridgeless/hermes) whentitleno longer contains "React Native"/"Hermes".This update is applied consistently in both
discoverTarget()anddiscoverAllTargets(), preserving the legacy title-based matching for pre-0.81 builds while allowing Bridgeless sessions to be selected and probed for__AGENTIC__.Reviewed by Cursor Bugbot for commit 3fcd99a. Bugbot is set up for automated code reviews on this repo. Configure here.