fix(agentic): harden preflight launch and fixture setup#31011
Conversation
The TS preflight installed the DerivedData .app the moment the build log
printed "Build Succeeded", racing xcodebuild's CodeSign phase. The result was
an unsigned bundle, which iOS 26+ simulators refuse to launch ("denied by
service delegate (SBMainWorkspace)"), so the app never started and CDP never
connected.
- ios.ts: ensureSigned() verifies the .app signature before install, waits
briefly for codesign to finish, and ad-hoc signs as a fallback.
- preflight.ts: restore tsconfig.json / Podfile.lock in a finally (plus
SIGINT/SIGTERM) so a run that fails before the end no longer leaves a
polluted tsconfig.json that bricks the next ts-node run (TS5098).
|
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #31011 +/- ##
==========================================
- Coverage 82.84% 82.84% -0.01%
==========================================
Files 5574 5574
Lines 143873 143873
Branches 33409 33409
==========================================
- Hits 119187 119185 -2
- Misses 16693 16695 +2
Partials 7993 7993 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f1945a3. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
No production app code was modified. No E2E test selectors, page objects, or test flows were changed. No controllers, Engine, navigation, or UI components were touched. The changes are purely developer tooling improvements for the agentic/perps development workflow. Since the AgenticService changes improve fixture setup reliability (fixing interrupted vault state), they could actually make existing E2E tests MORE reliable, but don't require specific test tags to validate - the unit tests in AgenticService.test.ts cover the new logic. Performance Test Selection: |
geositta
left a comment
There was a problem hiding this comment.
Approving. The branch addresses the preflight/cache and fixture race paths with focused changes and adds targeted coverage for the cache reinstall behavior.

Description
Fixes regressions in the TypeScript agentic preflight flow after #30988 where
yarn a:ioscould reuse a broken Metro process, fail to keep the iOS app launched, or stall during wallet fixture import.The preflight now uses a dedicated ts-node config, preserves the root
tsconfig.json, requires Metro/statusto reportpackager-status:running, retries stale Metro launches, wipes/reinstalls cached apps before fixture setup, and fails immediately when launch/setup subprocesses fail instead of drifting into CDP timeouts.The wallet fixture path was also hardened so HD fixture accounts are created through deterministic batched multichain account groups instead of the all-provider account creation path.
Changelog
CHANGELOG entry: null
Related issues
Fixes: N/A - dev-only agentic tooling regression from #30988.
Manual testing steps
Validation evidence:
yarn a:iospassed end to endWalletView, platformios, selected accountdev1tsconfig.json: no diffyarn tsc --noEmit --project scripts/perps/agentic/preflight/tsconfig.jsonyarn tsc --noEmit --pretty false --skipLibCheckbash -n scripts/perps/agentic/start-metro.sh scripts/perps/agentic/preflight.sh scripts/perps/agentic/setup-wallet.shyarn prettier --checkon touched app/preflight filesyarn jest --runTestsByPath app/core/AgenticService/AgenticService.test.ts -t "setupWallet"Screenshots/Recordings
Before
N/A - internal CLI tooling, no UI surface.
After
N/A - internal CLI tooling, no UI surface.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Changes touch vault unlock fallbacks and multichain account creation in DEV AgenticService, but they are confined to agentic tooling and test harness paths, not production user flows.
Overview
This PR hardens dev-only agentic preflight and wallet fixture flows after regressions from the TypeScript preflight migration.
Preflight / Metro / install:
yarn a:*now runs preflight through a dedicatedtsconfig.jsonsoexpo run:iosrewriting the repo-roottsconfigno longer breaksts-node. Preflight snapshots and restores roottsconfig.jsonon exit (including signals). Metro health checks requirepackager-status:runningon/status, with retries whenstart-metro.shfails or the bundler is bound but hung. iOS installs wait for codesign (with ad-hoc fallback) and treat stale Expo/Metro port holders more gracefully than hard-failing. With--wallet-setup, a fingerprint cache hit uninstalls and reinstalls from the cached artifact so app data is wiped instead of skipping native work.Wallet fixtures (
AgenticService+setup-wallet.sh): Fixture apply addsunlockFixtureVault(realAuthentication.unlockWallet, then keyring + onboarding Redux recovery when auth leaves the vault locked). Missing HD accounts are created in onecreateMultichainAccountGroupsbatch (not per-account loops), with timeouts and polling until accounts exist. CDP setup can validate wallet state after eval timeouts instead of failing immediately on slow large fixtures.Tests / scripts: New unit coverage for vault recovery and batched HD groups; shell tests updated for the preflight tsconfig and wallet-setup cache wipe path.
Reviewed by Cursor Bugbot for commit 8d06d45. Bugbot is set up for automated code reviews on this repo. Configure here.