The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): mobile:install --session works on pooled devices (#36447)
Julius Marminge committed
Nov 13, 2026 at 15:57 UTC
a6d91409729be6ba854b3f16adedc08847e3b24c
2 files changed
+37
-17
.agents/skills/test-t3-mobile/SKILL.md
+9
-4
@@ -43,10 +43,15 @@ prints one JSON line; on failure it names the next command. Mobile verification
43
includes that step unless the user prohibits it.
44
45
For a device you opened in an agent-device session elsewhere (a device pool,
46
-cloud, or remote host), run `vp run mobile:install <ios|android> --session <s>`
47
-from the directory you opened the session in. It installs the cached build into
48
-that session (`--abi arm64-v8a` for an ARM Android device; `--metro <url>` also
49
-opens it against Metro) and never builds.
46
+cloud, or remote host), run `vp run mobile:install <ios|android> --session <s>
47
+--config <file>` from the directory you opened the session in, passing the
48
+`--config` file from `device_open`'s `targetArgs`. Without it, a device pool's
49
+gateway refuses the install, wrongly saying agent-device is too old. It installs
50
+the cached build into that session (`--abi arm64-v8a` for an ARM Android device;
51
+pool Android emulators are x86_64, the default; `--metro <url>` also opens it
52
+against Metro). Without a cached build for this checkout it builds first, which can
53
+outlast the lease, so run `vp run mobile:install <ios|android> --prepare` (with
54
+the same `--abi`) before you open the device.
55
56
Start `vp run dev:client` from `apps/mobile`, or reuse a healthy Metro belonging
57
to this checkout. Open its printed development-client URL with AgentDevice
scripts/mobile-native-client.ts
+28
-13
@@ -175,9 +175,14 @@ const command = Effect.fn("nativeClient.command")(function* (
175
args: string[],
176
inherit = false,
177
cwd?: string,
178
+ withoutEnvironment: ReadonlyArray<string> = [],
179
) {
180
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
180
- const environment = yield* HostProcess.Environment;
181
+ const environment = Object.fromEntries(
182
+ Object.entries(yield* HostProcess.Environment).filter(
183
+ ([name]) => !withoutEnvironment.includes(name),
184
+ ),
185
+ );
186
const log = inherit ? yield* BuildLog : null;
187
const spawn = yield* resolveSpawnCommand(program === "adb" ? yield* resolveAdb : program, args);
188
const child = yield* spawner.spawn(
@@ -1098,6 +1103,7 @@ const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function
1103
session: string,
1104
abi: string,
1105
metro: string | undefined,
1106
+ config: string | undefined,
1107
) {
1108
const started = yield* Clock.currentTimeMillis;
1109
const path = yield* Path.Path;
@@ -1108,6 +1114,13 @@ const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function
1114
);
1115
// agent-device scopes session ownership to the workspace (working directory) it runs in.
1116
const workspace = yield* HostProcess.WorkingDirectory;
1117
+ // A session behind a gateway (a device pool) is reachable only with the config that opened it.
1118
+ const target = ["--session", session, ...(config ? ["--config", config] : [])];
1119
+ // Daemon variables in the shell (a device-pool login) override the config and authenticate
1120
+ // as someone who does not hold this lease; T3 Code's own launcher drops them the same way.
1121
+ const agentDeviceEnvironment = config
1122
+ ? ["AGENT_DEVICE_DAEMON_BASE_URL", "AGENT_DEVICE_DAEMON_AUTH_TOKEN", "AGENT_DEVICE_CONFIG"]
1123
+ : [];
1124
const deviceAbi = platform === "android" ? abi : null;
1125
const task = deviceAbi ? `native-client:android-${deviceAbi}` : `native-client:${platform}`;
1126
const current = yield* fingerprint(platform);
@@ -1118,17 +1131,10 @@ const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function
1131
const downloadOnDevice = source
1132
? command(
1133
node,
1121
- [
1122
- agentDevice,
1123
- "install-from-source",
1124
- source.url,
1125
- "--header",
1126
- source.header,
1127
- "--session",
1128
- session,
1129
- ],
1134
+ [agentDevice, "install-from-source", source.url, "--header", source.header, ...target],
1135
true,
1136
workspace,
1137
+ agentDeviceEnvironment,
1138
).pipe(
1139
Effect.as(true),
1140
Effect.catch((error) =>
@@ -1150,9 +1156,10 @@ const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function
1156
yield* Console.error(`Installing into agent-device session ${session}...`);
1157
yield* command(
1158
node,
1153
- [agentDevice, "install", bundleId, local.file, "--session", session],
1159
+ [agentDevice, "install", bundleId, local.file, ...target],
1160
true,
1161
workspace,
1162
+ agentDeviceEnvironment,
1163
);
1164
return local;
1165
});
@@ -1165,11 +1172,11 @@ const installIntoSession = Effect.fn("nativeClient.installIntoSession")(function
1172
"open",
1173
bundleId,
1174
`t3code-dev://expo-development-client/?url=${url}&disableOnboarding=1&disableFab=1&disableAutoLaunch=1`,
1168
- "--session",
1169
- session,
1175
+ ...target,
1176
],
1177
true,
1178
workspace,
1179
+ agentDeviceEnvironment,
1180
);
1181
}
1182
yield* reportTelemetry(
@@ -1213,6 +1220,12 @@ const main = Command.make(
1220
Flag.withDescription("With --session, open the dev client against this Metro URL."),
1221
Flag.optional,
1222
),
1223
+ config: Flag.String("config").pipe(
1224
+ Flag.withDescription(
1225
+ "With --session, the agent-device config the session was opened with (T3 Code's device_open returns it in targetArgs). Needed for a device pool behind a gateway.",
1226
+ ),
1227
+ Flag.optional,
1228
+ ),
1229
prepare: Flag.Boolean("prepare").pipe(
1230
Flag.withDescription(
1231
"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.",
@@ -1233,6 +1246,7 @@ const main = Command.make(
1246
session,
1247
abi: sessionAbi,
1248
metro,
1249
+ config,
1250
prepare,
1251
expectFingerprint,
1252
}) {
@@ -1280,6 +1294,7 @@ const main = Command.make(
1294
session.value,
1295
sessionAbi,
1296
Option.getOrUndefined(metro),
1297
+ Option.getOrUndefined(config),
1298
);
1299
}
1300
const target = yield* resolveDevice(platform, Option.getOrUndefined(requested));