Skip to content

feat(computer): a driver may run beside the device it drives, over adb on Android (FD-6950) - #922

Draft
michaelzheng67 wants to merge 1 commit into
mainfrom
feat/computer-driver-read-files
Draft

michaelzheng67 wants to merge 1 commit into
mainfrom
feat/computer-driver-read-files

Conversation

@michaelzheng67

@michaelzheng67 michaelzheng67 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

this patch looks to provide initial support for an android environment by 1. allowing for drivers to run beside the device as android driver will reach its device emulator through adb and 2. allow for read / write of files on android through adb commands

note: since we don't run in-device, things such as probes are replaced with ops through the dataplane instead of python logic, etc

How it was tested

unit tests pass, adb commands confirmed with emulator run

RetriggerView in GreptileConfidence Score: 4/5

Fix the program lookup in _adb.py before merging so commands honor the caller's PATH.

Fix All in CursorFindings

  1. P1 Custom program paths fail ▶
Fix with agent prompt
### Issue 1
packages/agentenv-protocol/src/agentenv_protocol/computer/_adb.py:39-42
`run_in_session` checks `command -v` before applying `env`. A caller that supplies a custom `PATH` to run a program in `/data/local/tmp`, for example, gets `InvalidArgument` even though that program exists in the requested environment. Check for the program using the supplied environment too.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds groundwork for drivers that run beside a device and reach Android through adb.

  • Computer drivers can declare that they sit beside an Android device.
  • Beside drivers run commands and move files through adb.
  • Data requests can return Android files and driver recordings together.
  • Android artifact loads default to the Download folder.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Caller --> Driver[Computer driver beside device]
  Driver -->|commands and file transfers| ADB[adb]
  ADB --> Device[Android device]
  Driver -->|keeps recordings| Home[Driver home]
  Device -->|device files| Export[data/get]
  Home -->|recording files| Export
Loading

Reviews (5) · Last reviewed commit: "feat(computer): a driver may run beside ..." · Reviewed by Greptile

@michaelzheng67

Copy link
Copy Markdown
Collaborator Author

@greptileai

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P1 Failed exports look successful packages/agentenv-protocol/src/agentenv_protocol/computer/_android.py:63 ▶

    read_files treats every failed adb shell test -e as a missing path. If the device is offline or the connection fails, data/get can report success with no files, or omit part of an export. Distinguish a missing path from an adb failure and raise an error for the latter.

  • P1 Command output can exhaust memory packages/agentenv-protocol/src/agentenv_protocol/computer/_android.py:37 ▶

    run_in_session reads all command output into memory before applying output_bytes. A command such as cat on a large file, or a noisy long-running command, can exhaust the driver's memory despite the advertised output cap. Drain both streams while keeping only the capped bytes, as _linux.run_in_session does.

@michaelzheng67
michaelzheng67 force-pushed the feat/computer-driver-read-files branch from faa769a to a4bd660 Compare November 25, 2026 16:15
@michaelzheng67

Copy link
Copy Markdown
Collaborator Author

@greptileai

@michaelzheng67
michaelzheng67 force-pushed the feat/computer-driver-read-files branch from a4bd660 to d7e5caa Compare November 25, 2026 16:23
@michaelzheng67

Copy link
Copy Markdown
Collaborator Author

@greptileai

@michaelzheng67
michaelzheng67 force-pushed the feat/computer-driver-read-files branch from d7e5caa to ca6bdcc Compare November 25, 2026 16:38
@michaelzheng67

Copy link
Copy Markdown
Collaborator Author

@greptileai

@michaelzheng67
michaelzheng67 force-pushed the feat/computer-driver-read-files branch from ca6bdcc to 2b4ed92 Compare November 25, 2026 16:52
@michaelzheng67

Copy link
Copy Markdown
Collaborator Author

@greptileai

Comment on lines +39 to +42
assignments = "".join(f"{shlex.quote(f'{name}={value}')} " for name, value in (env or {}).items())
command = (f"cd {folder} 2>/dev/null || {{ echo '{CANNOT_RUN} no such folder' >&2; exit 127; }}; "
f"command -v {program} >/dev/null 2>&1 || {{ echo '{CANNOT_RUN} not found' >&2; exit 127; }}; "
f"exec {'env ' + assignments if assignments else ''}{shlex.join(argv)}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Custom program paths fail

run_in_session checks command -v before applying env. A caller that supplies a custom PATH to run a program in /data/local/tmp, for example, gets InvalidArgument even though that program exists in the requested environment. Check for the program using the supplied environment too.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/agentenv-protocol/src/agentenv_protocol/computer/_adb.py
Line: 39-42

Comment:
**Custom program paths fail**

`run_in_session` checks `command -v` before applying `env`. A caller that supplies a custom `PATH` to run a program in `/data/local/tmp`, for example, gets `InvalidArgument` even though that program exists in the requested environment. Check for the program using the supplied environment too.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Cursor Fix in Claude Code Fix in Codex

This branch has not been deployed

No deployments
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