The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): mobile:install builds on a cache miss for pooled devices, iOS on EAS (#25390)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 26, 2026 at 01:49 UTC
91f47a1a27c223bf8e7a741671e052b15177263a
3 files changed
+111
-12
apps/mobile/eas.json
+7
@@ -18,6 +18,13 @@
18
"image": "macos-tahoe-26.6-xcode-27.1"
19
}
20
},
21
+ "development-simulator": {
22
+ "extends": "development",
23
+ "ios": {
24
+ "simulator": true,
25
+ "image": "macos-tahoe-26.6-xcode-27.1"
26
+ }
27
+ },
28
"preview": {
29
"corepack": true,
30
"env": {
apps/mobile/modules/t3-terminal/T3TerminalNative.podspec
+4
@@ -14,6 +14,10 @@ Pod::Spec.new do |s|
14
s.source = { :path => '.' }
15
s.source_files = 'ios/**/*.{h,m,mm,swift}'
16
s.vendored_frameworks = 'Vendor/libghostty/GhosttyKit.xcframework'
17
+ # libghostty has no x86_64 simulator slice, so a simulator build for every
18
+ # architecture (EAS's generic destination) fails to resolve GhosttyKit.
19
+ s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
20
+ s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
21
s.frameworks = 'IOSurface', 'Metal', 'MetalKit', 'QuartzCore', 'UIKit'
22
s.libraries = 'c++', 'z'
23
s.swift_version = '5.9'
scripts/mobile-native-client.ts
+100
-12
@@ -420,6 +420,11 @@ const decodeUpload = Schema.decodeUnknownEffect(
420
]),
421
);
422
const decodePart = Schema.decodeUnknownEffect(Schema.Struct({ etag: Schema.String }));
423
+const decodeEasBuilds = Schema.decodeUnknownEffect(
424
+ Schema.fromJsonString(
425
+ Schema.Array(Schema.Struct({ artifacts: Schema.Struct({ buildUrl: Schema.String }) })),
426
+ ),
427
+);
428
429
interface RemoteCache {
430
readonly url: string;
@@ -621,6 +626,57 @@ const publish = Effect.fn("nativeClient.publish")(function* (staging: string, ta
626
yield* fs.rename(staging, target);
627
});
628
629
+const easCli = "eas-cli@25.3.0";
630
+
631
+/** Xcode builds iOS locally; without it (Linux, or a Mac with no Xcode) EAS builds in the cloud. */
632
+const hasXcode = Effect.gen(function* () {
633
+ if ((yield* HostProcess.Platform) !== "darwin") return false;
634
+ return yield* command("xcrun", ["--find", "xcodebuild"]).pipe(
635
+ Effect.as(true),
636
+ Effect.orElseSucceed(() => false),
637
+ );
638
+});
639
+
640
+/** Without Xcode, EAS builds the same simulator client from this checkout. */
641
+const buildIosOnEas = Effect.fn("nativeClient.buildIosOnEas")(function* (staging: string) {
642
+ const fs = yield* FileSystem.FileSystem;
643
+ const path = yield* Path.Path;
644
+ // Fail before any work when neither builder is available.
645
+ yield* command("npx", ["-y", easCli, "whoami"]).pipe(
646
+ Effect.mapError(
647
+ () =>
648
+ new NativeClientError({
649
+ message:
650
+ "iOS builds need Xcode on macOS, or an EAS login (`npx eas-cli login`, or EXPO_TOKEN) to build in the cloud.",
651
+ }),
652
+ ),
653
+ );
654
+ yield* Console.error("No Xcode here; building the iOS simulator client on EAS (10-30 min).");
655
+ const [build] = yield* decodeEasBuilds(
656
+ yield* command("npx", [
657
+ "-y",
658
+ easCli,
659
+ "build",
660
+ "--platform",
661
+ "ios",
662
+ "--profile",
663
+ "development-simulator",
664
+ "--non-interactive",
665
+ "--wait",
666
+ "--json",
667
+ ]),
668
+ );
669
+ if (!build) return yield* new NativeClientError({ message: "EAS returned no build." });
670
+ const archive = path.join(staging, "eas-build.tar.gz");
671
+ yield* command("curl", ["-fsSL", "--retry", "3", "-o", archive, build.artifacts.buildUrl]);
672
+ yield* command("tar", ["-xzf", archive, "-C", staging]);
673
+ yield* fs.remove(archive);
674
+ const app = (yield* fs.readDirectory(staging)).find((name) => name.endsWith(".app"));
675
+ if (!app) return yield* new NativeClientError({ message: "The EAS build archive has no .app." });
676
+ if (app !== artifactNames.ios)
677
+ yield* fs.rename(path.join(staging, app), path.join(staging, artifactNames.ios));
678
+});
679
+
680
const build = Effect.fn("nativeClient.build")(function* (
681
platform: NativePlatform,
682
abi: string | null,
@@ -640,13 +696,17 @@ const build = Effect.fn("nativeClient.build")(function* (
696
["exec", "expo", "prebuild", "--clean", "--platform", platform, "--no-install"],
697
true,
698
).pipe(Effect.asVoid);
643
- yield* platform === "android" ? prebuildAndroid(mobile, prebuild) : prebuild;
699
+ const onEas = platform === "ios" && !(yield* hasXcode);
700
+ if (platform === "android") yield* prebuildAndroid(mobile, prebuild);
701
+ else if (!onEas) yield* prebuild;
702
const staging = yield* fs.makeTempDirectory({
703
directory: path.dirname(target),
704
prefix: ".build-",
705
});
706
yield* Effect.gen(function* () {
649
- if (platform === "ios") {
707
+ if (onEas) {
708
+ yield* buildIosOnEas(staging);
709
+ } else if (platform === "ios") {
710
const output = yield* fs.makeTempDirectoryScoped({ prefix: "t3-native-client-" });
711
yield* command("pod", ["install"], true, path.join(mobile, "ios"));
712
// One device-independent arm64 simulator build installs on every iPhone and iPad simulator.
@@ -738,7 +798,6 @@ export const resolveArtifact = Effect.fn("nativeClient.resolveArtifact")(functio
798
platform: NativePlatform,
799
abi: string | null,
800
fingerprint: string,
741
- allowBuild = true,
801
) {
802
const fs = yield* FileSystem.FileSystem;
803
const path = yield* Path.Path;
@@ -767,10 +826,6 @@ export const resolveArtifact = Effect.fn("nativeClient.resolveArtifact")(functio
826
return { ...artifact, source: "remote" as const, buildMs: yield* readBuildMs(directory) };
827
}
828
}
770
- if (!allowBuild)
771
- return yield* new NativeClientError({
772
- message: `No shared build of ${key} yet. Run \`vp run mobile:install ${platform}\` once on a machine with a local ${platform === "ios" ? "simulator" : "emulator"} of this checkout; it builds the client and shares it.`,
773
- });
829
const log = yield* BuildLog;
830
yield* Console.error(
831
`No cached client for ${key}. Building it once for every machine (5-15 min)${log ? `. Log: ${log}` : ""}`,
@@ -865,7 +920,8 @@ const reportTelemetry = Effect.fn("nativeClient.reportTelemetry")(
920
921
/**
922
* Install into an agent-device session the caller already opened (a device pool, a cloud
868
- * provider, or a local device), using the shared cache only; such hosts cannot build.
923
+ * provider, or a local device). A cache miss builds here, as for a local device: the device
924
+ * only runs the client.
925
*/
926
const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function* (
927
home: string,
@@ -890,8 +946,8 @@ const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function
946
const source = yield* sharedSource(home, key);
947
// The session's host downloads the client itself; uploading a 166 MB APK through a
948
// gateway from here takes minutes and can outlast the remote install timeout.
893
- const fetched = source
894
- ? yield* command(
949
+ const downloadOnDevice = source
950
+ ? command(
951
node,
952
[
953
agentDevice,
@@ -912,13 +968,16 @@ const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function
968
),
969
),
970
)
915
- : false;
971
+ : Effect.succeed(false);
972
+ const fetched = yield* downloadOnDevice;
973
const artifact = fetched
974
? { source: "remote" as const, buildMs: 0 }
975
: yield* Effect.gen(function* () {
919
- const local = yield* resolveArtifact(home, platform, deviceAbi, current, false).pipe(
976
+ const local = yield* resolveArtifact(home, platform, deviceAbi, current).pipe(
977
Effect.tapError(() => reportTelemetry(home, task, "failed", 0)),
978
);
979
+ // A build just shared the client, so the device can fetch it now too.
980
+ if (local.source === "build" && (yield* downloadOnDevice)) return local;
981
yield* Console.error(`Installing into agent-device session ${session}...`);
982
yield* command(
983
node,
@@ -985,6 +1044,11 @@ const main = Command.make(
1044
Flag.withDescription("With --session, open the dev client against this Metro URL."),
1045
Flag.optional,
1046
),
1047
+ prepare: Flag.Boolean("prepare").pipe(
1048
+ Flag.withDescription(
1049
+ "Fetch or build the client for this checkout without a device (Android: for --abi). Run it before leasing a device: a build can outlast the lease.",
1050
+ ),
1051
+ ),
1052
},
1053
Effect.fn("nativeClient.main")(function* ({
1054
mode,
@@ -993,8 +1057,32 @@ const main = Command.make(
1057
session,
1058
abi: sessionAbi,
1059
metro,
1060
+ prepare,
1061
}) {
1062
const started = yield* Clock.currentTimeMillis;
1063
+ if (prepare) {
1064
+ if (mode !== "ensure" || Option.isSome(requested) || Option.isSome(session))
1065
+ return yield* new NativeClientError({
1066
+ message: "--prepare needs no device; use it with ensure and no device id or --session.",
1067
+ });
1068
+ const environment = yield* HostProcess.Environment;
1069
+ const home = environment.HOME ?? environment.USERPROFILE;
1070
+ if (!home)
1071
+ return yield* new NativeClientError({ message: "HOME or USERPROFILE must be set." });
1072
+ const current = yield* fingerprint(platform);
1073
+ const artifact = yield* resolveArtifact(
1074
+ home,
1075
+ platform,
1076
+ platform === "android" ? sessionAbi : null,
1077
+ current,
1078
+ );
1079
+ yield* Console.error(
1080
+ `Client ready for ${platform} (${artifact.source}); lease a device and install.`,
1081
+ );
1082
+ return yield* Console.log(
1083
+ yield* encodeOutput({ status: "ready", source: artifact.source, fingerprint: current }),
1084
+ );
1085
+ }
1086
if (Option.isSome(session)) {
1087
if (mode !== "ensure" || Option.isSome(requested))
1088
return yield* new NativeClientError({