Repository navigation
Conversation
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused device-host bug fix that refreshes Android SDK/JDK discovery when commands run, with regression tests for post-startup installation and cross-platform JDK lookup. The SSH adjustment and documentation are similarly scoped, with no API, schema, deployment, or security-sensitive changes. You can add or adjust custom eligibility rules. Learn more. |
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
🤖 Claude Opus 5.5 on behalf of Oliver
Who this affects
Anyone who installs the Android SDK while T3 Code is already running. That's the normal first-time flow: open the Device panel, see "Android SDK was not found", install Android Studio, come back.
The device command failed (exit code 127). Nothing lists or opens until the server restarts.systemdlaunches)[android-utils] Failed to run avdmanager list avd. The hub returns no devices, including ones already running.Found on a Linux machine where the SDK went into
~/Android/Sdkabout two hours after the server started.Why it broke
LocalDeviceHostlooked for the SDK once, at server start, and built the hub's environment from that result. The availability check looks again on every call, so the panel showed "ready" while the hub andemulator -list-avdsstill ran without an SDK:emulatorran as a bare command and failed to start.runreports any spawn failure as exit 127.ANDROID_HOME, so expo-device-hub fell back to its macOS default,~/Library/Android/sdk, even on Linux.Even with the SDK found, the hub lists AVDs with
avdmanager, which is a Java program. When that fails, the hub returns an empty list, so listing byemulator -list-avdsalone isn't enough.Change
run). This matches how command lookup already works inpackages/shared/src/shell.ts, which deliberately doesn't cache misses so newly installed binaries are found.JAVA_HOME, thenjavaon PATH, then Android Studio's bundled JBR. These are the same candidatessshDeviceScript.tsalready uses, plus/usr/local/android-studioand the snap install, added to both hosts. The result goes to the hub asJAVA_HOME.docs/user/devices.mdlists the Java requirement.SSH device hosts already re-ran their setup on every command, so they never had the startup bug. Only their JBR list changed. No contract or client change: the reason travels in the existing
DevicePlatformAvailability.reason.Not covered: a hub that is already running keeps the environment it started with. In practice that's a Mac whose hub started for iOS before the Android SDK was installed. The docs already say to restart after installing dependencies.
Related: #21425 changes which SDK root is chosen and notes the startup snapshot as a known limitation. This PR removes that snapshot. The two edit neighbouring code, so whichever lands second needs a small rebase.
Validation
vp test run apps/server/src/device: 103 tests pass. New cases cover an SDK and JDK installed after the host is created (the regression), the Java lookup order on Linux and Windows, and the no-Java message.LocalDeviceHostagainst a real SDK and an AVD on Linux, using copies of the pinned device tools and a temp state directory:{"available":false,"reason":"Android SDK Command-line Tools need Java 17 or later, which was not found. …"}JAVA_HOMEset: the hub listedT3_Pixelwith"errors":[]. Booting it through the hub returnedemulator-5554,booted: true.macOS and Windows were not run end to end.
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.