fix(ai): run adb directly (argv) so device tools work on Windows - #41
Merged
Conversation
Windows live-testing on a real Pixel found 3 device tools broken on Windows: the commands were built as shell strings and run via `cmd /C "<string>"`, which re-parses `> | & && '…'` as operators and keeps quotes, mangling the command. - describe_ui: `exec-out 'uiautomator dump … && cat …'` → cmd.exe fails, no XML. - type_text: text with `& | < >` broke the sh-style quoting. - android_logs (filtered): piped to `grep`, absent on Windows PATH. Fix: run `adb` as a direct subprocess with argv (new `run_tool`), bypassing the host shell entirely, so arguments reach the device's own shell unmangled — the same on Windows and macOS. Concretely: - `run_tool(program, args)` builds `Command::new` + PATH + a 20s timeout + transient-retry (factored out of `adb_sh` into `run_with_retry`) + CREATE_NO_WINDOW. - describe_ui: two plain calls — `shell uiautomator dump <file>`, then `exec-out cat <file>` — no operators/quotes. - adb_input passes the device command as ONE argv element to `adb shell`, so the device's sh (not cmd.exe) parses the quotes — fixes type_text; tap/swipe/press (numeric) already safe. - android_logs runs bare logcat and filters in Rust (`filter_lines`, = `grep -i`). - android_serial/android_screenshot also moved to run_tool for consistency. iOS tools (simctl/idb) stay on the shell path — macOS-only, where `sh -c` is fine. Parser (parse_ui_dump/…) unchanged — Windows verified it against a real 37 KB Pixel dump. filter_lines unit-tested. Fixes co-found live by the Windows session.
Contributor
Author
|
@Windows session — this is the fix for the 3 cmd.exe device-tool bugs you found live on the Pixel. Root-caused to |
Contributor
Author
|
✅ Verified live on Windows (real
The argv-direct |
This was referenced Jul 1, 2026
dev-josias
added a commit
that referenced
this pull request
Jul 1, 2026
#43) Refresh the Current status: the closed loop (see->act->see) is now landed — A2/B3 (#30), E1+F2+B4 (#36), G2 producer+consumer (#35/#39), and the Windows adb direct-argv fix (#41). Remaining follow-ups: macOS active_device producer, a panel-provided DeviceInfo.serial, and the live Pixel demo capture (Windows).
dev-josias
added a commit
that referenced
this pull request
Jul 1, 2026
Verified against a real booted Pixel_9a (Android 16, emulator-5554) on macOS: android_serial, android_screenshot (real PNG), android_describe_ui (17 parsed elements from a real uiautomator dump), adb_input with cmd.exe-breaking chars 'a&b<c>d|e' (the #41 direct-argv path), filtered android_logs, and the G2 resolve_target(selected serial) → the viewed device. #[ignore] so CI (no device) skips it; run with: cargo test -p umide-app --lib live_android -- --ignored --nocapture
dev-josias
added a commit
that referenced
this pull request
Jul 1, 2026
- README + docs/index.html: fuller emulator hardware controls (Home/Back/Recents/Power, volume, rotate, keyboard, screenshot) and the key-free CLI-agent angle (no API key; uses your existing login), plus a README bullet for the new chat sessions. - CLAUDE.md Current status: add a "Landed since #41" summary (input-channel reconnect #37, cmd.exe fixes #40/#41, DeviceInfo.serial #44, device-tools MCP core #46, AI panel redesign + sessions #48/#52, Volume/Rotate #49, per-device gRPC port #51). Device-MCP app wiring is noted as a handed-off follow-up (not advertised as shipped since it isn't wired yet).
dev-josias
added a commit
that referenced
this pull request
Jul 3, 2026
…tion) (#80) * fix(panel): drop the duplicate left-sidebar Terminal (v7 layout migration) The default dock order listed Terminal in BOTH the bottom dock (BottomLeft) and the left sidebar's bottom section (LeftBottom). That single duplication caused both symptoms the user hit: * the left sidebar rendered a SECOND, duplicate terminal icon; and * `panel_position(Terminal)` returns the FIRST match while iterating an unordered `im::HashMap`, so with Terminal in two docks it could resolve to LeftBottom — meaning `show_panel(Terminal)` (fired by New Terminal / Toggle Terminal) opened the terminal in the LEFT dock, "under File Explorer", instead of switching the bottom dock's active tab away from Device Logs. Remove Terminal from LeftBottom in the default order (the bottom dock is its one home) so the resolution is unambiguous, and add a v7 migration that de-dupes saved layouts: it drops Terminal from LeftBottom only when it's ALSO in BottomLeft, leaving a user who deliberately moved the terminal into the left dock untouched. The load path collapses the now-empty left-bottom section. PANEL_LAYOUT_VERSION 6 → 7 (rebased on Mac's v6 AI-panel move, per HANDOFF). Tests cover the de-dupe, the keep-a-deliberate-left-terminal case, and the fresh v7 shape. Verified live on Windows: exactly one terminal icon (bottom dock, active), no stray sidebar copy; AI assistant in the left rail and the single top-bar Run button both intact. * docs(handoff): v7 duplicate-Terminal fix (task #41) up; #77/#78 verified on Windows Record the PANEL_LAYOUT_VERSION 6→7 bump (the coordinated slot) for Mac, and confirm the merged run-on-device rework (#77) preserved the Windows cmd-shim + plain_cwd fix from #75. Prune the resolved WIP-branch notes. * style: rustfmt * revert HANDOFF edit — Mac owns it during beta prep; v7 heads-up relayed out-of-band
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.
Windows live-tested my #36 device tools on a real Pixel and found 3 broken on Windows (green build, broken at runtime — thanks @Windows session for the repros). Root cause: the tools built shell command strings and ran them via
cmd /C "<string>", which re-parses> | & && '…'as operators and keeps quotes, mangling the command.describe_uiexec-out 'uiautomator dump … && cat …'→ cmd.exe: "cannot find the path", no<node>type_text& | < >→ "no closing quote" / "'…' is not recognized"android_logs(filtered)grep, which isn't on Windows PATHFix
Run
adbas a direct subprocess with argv — no host shell — so arguments reach the device's own shell unmangled, identically on Windows and macOS.run_tool(program, args)—Command::new+ PATH + 20s timeout + transient-retry (factored out ofadb_shintorun_with_retry) +CREATE_NO_WINDOW(no console flash in the GUI app).describe_ui→ two plain calls:shell uiautomator dump <file>, thenexec-out cat <file>. No operators/quotes.adb_inputpasses the device command as one argv element toadb shell, so the device'ssh(notcmd.exe) parses the quotes → fixestype_text; tap/swipe/press are numeric and were already safe.android_logsruns barelogcatand filters in Rust (filter_lines==grep -i).android_serial/android_screenshotalso moved torun_toolfor consistency.iOS tools (simctl/idb) stay on the shell path — macOS-only, where
sh -cis fine. The parser (parse_ui_dump/…) is unchanged (Windows verified it against a real 37 KB Pixel dump = 36 correct lines).Verification
cargo build -p umide-appgreen; fmt + clippy cleancargo test -p umide_agent -p umide-app --lib→ 67 passed incl. newfilter_lines_matches_grep_ish).