Skip to content

Error: 'gh pr view' is disabled in your shell. Instead, use your builtin git_view_pr command. - #7

Closed
jkelleyrtp wants to merge 3 commits into
mainfrom
devin/1787275698-async-adb
Closed

Error: 'gh pr view' is disabled in your shell. Instead, use your builtin git_view_pr command.#7
jkelleyrtp wants to merge 3 commits into
mainfrom
devin/1787275698-async-adb

Conversation

@jkelleyrtp

Copy link
Copy Markdown
Member

Summary

Every one-shot ADB invocation in AdbClient used blocking std::process::Command::output() with no timeout, so each ADB-backed discovery/orientation/button/accessibility call parked a thread until adb exited (and hung forever if it never did). This replaces that with a single async runner on tokio::process::Command and propagates async through the Android callers.

The core change is one runner that owns stdio, child cleanup, and the timeout:

pub const DEFAULT_ADB_TIMEOUT: Duration = Duration::from_secs(30);

async fn run(&self, kind: &str, mut cmd: Command) -> Result<Output> {
    cmd.stdin(null()).stdout(piped()).stderr(piped()).kill_on_drop(true);
    let child = cmd.spawn().with_context(|| /* "ADB binary not found at '{path}'..." */)?;
    timeout(self.timeout, child.wait_with_output()).await
        .map_err(|_| anyhow!("adb {kind} command timed out after {}s (adb path: '{}')", ..))?
        ...
}

kill_on_drop(true) means a timed-out adb is terminated rather than leaked. The timeout is configurable per client via AdbClient::with_timeout(Duration); connected_devices still runs adb devices without -s <serial>.

All one-shot methods (shell, shell_raw, exec_out, command, check_connection, connected_devices, resolved_serial, get_screen_size, screenshot, tap, swipe, key_event, input_text, dump_ui*, launch_app, stop_app, get_current_activity) are now async, and the UI-dump retry backoff uses tokio::time::sleep.

Propagation, driven by the above:

  • AccessibilityReader::capture_screen becomes future-returning (Android capture calls ADB); macOS/Windows/X11/iOS-Simulator impls just wrap their existing synchronous native capture, and TargetedAccessibility::capture_screen gets an async dispatch macro.
  • AndroidAccessibility::new / with_adb_path / refresh_screen_size, set_device_orientation (orientation polling now uses tokio::time::sleep), spawn_input_worker, spawn_ax_worker, and EmulatorSession::{start, set_orientation, send_input} are async; the workers keep their dedicated-thread + current-thread-runtime architecture.
  • Emulator discovery file/dir reads use tokio::fs; CLI screenshot writes use tokio::fs::write.

Deliberately unchanged: screenrecord/video workers (long-lived children whose stdout is pumped by dedicated threads), macOS/iOS xcrun calls behind synchronous native APIs, and ListenerHandle::stop_blocking.

New tests cover the timeout path (fake adb = /bin/sleep, asserting the call returns fast with a "timed out" error) and the missing-binary context.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/d88fc07ea8064b38a4b4e5a7481ffebc
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/d88fc07ea8064b38a4b4e5a7481ffebc?variant=devin-insiders
Requested by: @jkelleyrtp

@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration staging-devin-ai-integration Bot changed the title Make Android ADB operations async with timeouts Error: 'gh pr view' is disabled in your shell. Instead, use your builtin git_view_pr command. Aug 21, 2026
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

Folded into #8, which now contains these commits and targets main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant