fix(operator-adb): await asynchronous device actions - #1958
Open
dvd233 wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for agent-tars-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for tarko ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Summary
Closes #1952
AdbOperator.execute()awaits eachsingleActionExecutor()call, but several action branches started asynchronous ADB work without returning that promise through the call chain. This allowed the public API to report success before gestures or typing finished, detached command failures from the request, and let later actions start out of order.This change awaits every affected path:
long_press,swipe, anddragwait forhandleSwipe();scrollwaits forhandleScroll(), which now waits for its innerhandleSwipe();typewaits forhandleType();handleHotkey()waits for the ADBkeyevent()promise.The new tests use controllable ADB promises through the public
doExecute()boundary. They cover all six action types, verify that command rejections produce a failed execution result, and verify that a later action does not start until the current device command completes.Verification
pnpm --filter @gui-agent/operator-adb test -- --run: 1 suite, 7 tests pass.pnpm --filter @gui-agent/operator-adb build: ESM, CJS, and declarations build successfully.test/AdbOperator.test.ts: passes.pnpm exec prettier --check gui-agent/operator-adb/test/AdbOperator.test.ts: passes.merge-treewith the current head of fix(security): prevent shell injection in ADB operator #1883 completes without conflicts.No Android device was available for a hardware smoke test; the regression coverage uses delayed and rejecting ADB method mocks to validate ordering and failure propagation deterministically.
Checklist