Skip to content

fix(android): fail doctor when adb is the Windows binary on a POSIX host - #3157

Merged
thymikee merged 3 commits into
callstack:mainfrom
okwasniewski:oskar/android-wsl-windows-adb
Oct 3, 2026
Merged

thymikee merged 3 commits into
callstack:mainfrom
okwasniewski:oskar/android-wsl-windows-adb

Conversation

@okwasniewski

@okwasniewski okwasniewski commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

From e2e feedback: under WSL with a Windows adb.exe on PATH (e.g. ANDROID_HOME under /mnt/c), adb version succeeds, so doctor passed, but recordings, pulls, and installs failed because adb resolves host paths as Windows paths.

agent-device doctor now reads adb's Installed as line and fails the Android toolchain check with reason android_adb_windows_binary_on_posix_host (plus adbPath evidence and a Linux platform-tools hint) when a non-Windows host gets a drive-letter or UNC path. The host platform is injected from the root composition, keeping platform-android free of ambient process authority. Known-limitations docs gain a WSL note.

5 files touched.

Validation

Tested commit: dbc01611fa4da0fa776f2ed4a48dda0b1b7fd1ae (on upstream/main 9a245d0).

  • pnpm vitest run packages/platform-android/src/__tests__/doctor.test.ts: 7 passed (Windows adb on linux fails with typed reason; Linux adb under WSL passes; Windows adb on win32 passes)
  • pnpm check:affected --run --base upstream/main: all runnable checks passed (370 files / 2402 related tests). First run caught a layering violation (process.platform in platform-android), fixed by injecting the platform.

Risks: no WSL host available, so validation is unit-level only. This adds the diagnosis; recording with a Windows adb is still unsupported.

Review in cubic

Under WSL, Windows adb.exe passes adb version but resolves host paths as
Windows paths, so recording/pull/install break. Read adb's Installed as
line and fail the toolchain check with reason
android_adb_windows_binary_on_posix_host plus a Linux platform-tools hint.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The environment-specific WSL behavior has unit coverage but lacks validation on an actual WSL host.

Review effort: Balanced
Findings: None

What changed in this PR

Adds detection for Windows adb.exe binaries running on POSIX hosts, preventing misleading Android doctor passes under WSL.

Changes:

  • Parses full adb version output and reports a typed failure for Windows paths on POSIX hosts.
  • Injects the host platform and adds regression coverage.
  • Documents the WSL platform-tools limitation.
File Description
website/​docs/​docs/​known-limitations.md Documents required Linux platform-tools under WSL.
src/​platform-runtime-host-diagnostics.ts Supplies the host platform to Android diagnostics.
packages/​provision-kit/​src/​toolchain-probe.ts Adds successful command stdout retrieval.
packages/​platform-android/​src/​doctor.ts Detects and reports incompatible Windows adb binaries.
packages/​platform-android/​src/​__tests__/​doctor.test.ts Covers Windows and Linux adb combinations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/platform-android/src/__tests__/doctor.test.ts
Comment thread packages/platform-android/src/doctor.ts Outdated
Comment thread packages/platform-android/src/doctor.ts Outdated
@thymikee

thymikee commented Oct 3, 2026

Copy link
Copy Markdown
Member

This PR is ready at dbc0161. Not blocking, and you can take or leave these: the hint at https://github.com/callstack/agent-device/blob/dbc0161/packages/platform-android/src/doctor.ts#L204 says "Under WSL" but fires for every non-win32 host, so it could name the invariant (adb must be a native binary for this host) and mention WSL as the common case. Also, when the "Installed as" line is missing (older adb), https://github.com/callstack/agent-device/blob/dbc0161/packages/platform-android/src/doctor.ts#L41 returns undefined and the check passes as before. You could optionally treat a "Running on Windows" line on a non-win32 host as the same signal.

On the open review threads, the P3 thread about the WSL-specific hint still applies (#3157 (comment)). Two P2 threads do not apply, so please resolve them. The "#!/bin/sh" fixtures match sibling tests in the package, and no CI job runs on Windows (#3157 (comment)). The missing "Installed as" case is fail-open with no false failure, and the fallback is covered in the note above (#3157 (comment)).

The failing check is the iOS simulator Smoke Tests job, where an open request timed out after 90s on a deep-link. It looks unrelated, because this PR does not touch the iOS open or deep-link route. The build step and the other smoke tests passed. I did not re-run that job. I had no WSL host or real Windows adb.exe output, so the "Installed as" format was not checked against a live binary. The fixtures follow adb 1.0.41 output. I also did not confirm which adb version added that line. Nothing else stands in the way of merging, so re-run or confirm the unrelated Smoke Tests failure before merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 3, 2026
…ut Installed as

The hint fired on every non-win32 host but only advised WSL users; state the
invariant that adb must be a native binary for this host and keep WSL as the
example. Treat a "Running on Windows" banner as the same signal so builds that
omit "Installed as" fail closed instead of passing green, and key the check on
detectedVia.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 14:27
@thymikee

thymikee commented Oct 3, 2026

Copy link
Copy Markdown
Member

Both non-blocking points are in 90193ef:

  • The hint states the invariant first — adb must be a native binary for this host — with host-neutral remediation, and keeps WSL (plus /mnt/<drive>) as the trailing example.
  • A Running on Windows banner now triggers the same check when Installed as is missing, keyed by evidence.detectedVia: "running-on-line" with adbPath: null, so pre-1.0.36 and third-party builds fail closed instead of passing green. Closest negative pair added: a Linux build that also omits Installed as still passes.

All three review threads are resolved. The iOS Smoke Tests lane is untouched by this change; re-running it before merge as noted.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread website/docs/docs/known-limitations.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused implementation is correctly wired, documented, and covered by representative regression tests.

Review effort: Balanced
Findings: None

@thymikee

thymikee commented Oct 3, 2026

Copy link
Copy Markdown
Member

Reviewed 90193ef: the code is ready for human review. The earlier notes from dbc0161 are fixed, and the new Running on Windows check only matches a line that starts with that text, so native Linux or macOS adb still passes.

Not blocking: the open Cubic thread on known-limitations.md still holds. A mounted volume alone cannot run adb.exe on macOS or Linux. Could you say "through WSL interop or Wine" there, and drop the same phrase from the doc comment on windowsAdbOnPosixHostCheck?

Smoke Tests were still running at review time. This change only touches the Android doctor probe, so I do not expect it to affect them. There are no conflicts. I did not run the tests or a live WSL adb.

Copilot AI balanced review requested due to automatic review settings October 3, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The detection logic is narrowly scoped, production wiring is complete, and positive and negative scenarios are covered.

Review effort: Balanced
Findings: None

@thymikee

thymikee commented Oct 3, 2026

Copy link
Copy Markdown
Member

I checked d40fd85. The only new commit changes one doc comment in doctor.ts and one sentence in known-limitations.md, so the earlier clean review of 90193ef still holds. No code changed.

Not blocking: the doc sentence now says a Windows adb.exe is reached "from macOS or Linux through WSL interop or Wine". WSL interop exists only on a Windows host, so should that read "from WSL through interop, or from macOS or Linux through Wine"?

@thymikee
thymikee merged commit d504e9a into callstack:main Oct 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants