Skip to content

fix(describe): report a missing Vega VVD instead of an empty tree - #1352

Closed
latekvo wants to merge 9 commits into
mainfrom
fix/vega-describe-no-vvd
Closed

latekvo wants to merge 9 commits into
mainfrom
fix/vega-describe-no-vvd

Conversation

@latekvo

@latekvo latekvo commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Closes #1337

With no VVD running, Vega describe succeeded with an empty tree and a "relaunch the app" hint, because every page-source fetch error except the multi-VVD one became that hint. It now rethrows VEGA_DEVICE_NOT_FOUND and VEGA_DEVICE_NOT_REGISTERED (VVD running but not on adb), the same errors tv-remote and screenshot already give. The flow launch gate (waitForVegaAutomation) still polls these to its deadline, but reports the last one instead of generic relaunch advice.

No docs update needed.

Verification

No mocks: a scratch vitest in packages/tool-server/test/ builds a Registry with describe + await-ui-element, then sends requests through the real createHttpApp. It uses the real ps probe (no VVD running on the host) and the real adb dependency check. The request is POST /tools/describe {udid:"amazon-0000bogus"}.

Before:

DESCRIBE 200 {"data":{"description":"Source: vega-automation\nMode: nested ...   (empty tree + relaunch hint)
AWAIT 200 {... "note":"could not confirm the element is hidden — ... (No UI tree from the Vega automation toolkit ... relaunch the foreground app ...)","cause":"unreadable"}

After:

DESCRIBE 500 {"error":"[Tool:describe] No running Vega Virtual Device found. Start one with `boot-device {vvdImage:...}` (or `vega virtual-device start`) and retry.","error_code":"VEGA_DEVICE_NOT_FOUND","error_kind":"not_found"}
AWAIT 200 {... "note":"last tree fetch failed: No running Vega Virtual Device found. ...","cause":"unreadable"}

flow-execute with no VVD still fails at restart-app first (real HTTP, unchanged). flow-vega-launch-gate.test.ts pins the gate: the error still standing at the deadline lands on the launch step, and a hint-only timeout keeps the relaunch advice. It fails on the previous head, and so do the reset and first-error-only mutants.

Checks:

  • npx tsc --build: exit 0.
  • tsc -p tsconfig.test.json --noEmit: exit 0.
  • vega-describe.test.ts pins both rethrows (fail on main).
  • vitest over every vega / describe / await-ui / flow-run / flow-vega test file in tool-server: 36 files, 405 tests passed.
  • test/flows (3 shards): 2309 passed, plus e2e-tool-aliases, which fails locally on main too.
  • prettier and eslint on changed files: clean.

describeVega turned every page-source fetch error except the multi-VVD
ambiguity into an empty tree plus a "relaunch the app" hint, so describe
succeeded with an empty screen when no VVD was running. Rethrow the
VEGA_DEVICE_NOT_FOUND failure like tv-remote and screenshot surface it.

Closes #1337
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: software-mansion/argent/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2276a5e2-9f1b-4f7f-9f53-9950ebdf7ebf
📥 Commits

Reviewing files that changed from the base of the PR and between 204483a and a23d715.

📒 Files selected for processing (2)
  • packages/tool-server/src/tools/describe/platforms/vega.ts
  • packages/tool-server/test/vega-describe.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

Walkthrough

Vega describe now rethrows VEGA_DEVICE_NOT_FOUND and VEGA_DEVICE_NOT_REGISTERED errors. It continues to rethrow multiple-device errors and return an empty tree for other fetch failures. Tests verify that both discovery failure codes are preserved.

Changes: Vega discovery error handling

Layer / File(s) Summary
Classify and test Vega discovery failures
packages/tool-server/src/tools/describe/platforms/vega.ts, packages/tool-server/test/vega-describe.test.ts
Vega describe rethrows errors tagged with either device discovery failure code. Tests assert that each error’s failure signal retains its code.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to a23d7

Missing-VVD errors are reported directly by describe, while affected flows retain their retry behavior. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed Issue #1337 requires describe to report the missing Vega device instead of returning an empty tree with the relaunch hint. packages/tool-server/src/tools/describe/platforms/vega.ts now rethrows `V…
Out of Scope Changes check Passed The changes are limited to Vega describe failure handling and focused tests. The additional VEGA_DEVICE_NOT_REGISTERED case is a related VVD discovery failure and uses the same user-facing correct…
Title check Passed The title clearly and concisely describes the main change: reporting a missing Vega VVD instead of returning an empty tree.
Description check Passed The description states the PR closes issue #1337 and explains the change: with no Vega Virtual Device running, describe returned an empty tree with a relaunch hint. It now rethrows VEGA_DEVICE_NOT_FOU…
Full details: Linked Issues check

Explanation

Issue #1337 requires describe to report the missing Vega device instead of returning an empty tree with the relaunch hint. packages/tool-server/src/tools/describe/platforms/vega.ts now rethrows VEGA_DEVICE_NOT_FOUND. It also rethrows VEGA_DEVICE_NOT_REGISTERED and preserves MultipleVegaDevicesError. packages/tool-server/test/vega-describe.test.ts covers both required failure codes. The reported type checks and test suite results provide additional verification.

Full details: Out of Scope Changes check

Explanation

The changes are limited to Vega describe failure handling and focused tests. The additional VEGA_DEVICE_NOT_REGISTERED case is a related VVD discovery failure and uses the same user-facing correction. No unrelated production behavior, documentation, or unrelated files are changed.

Full details: Description check

Explanation

The description states the PR closes issue #1337 and explains the change: with no Vega Virtual Device running, describe returned an empty tree with a relaunch hint. It now rethrows VEGA_DEVICE_NOT_FOUND and VEGA_DEVICE_NOT_REGISTERED, and the flow launch gate reports the last error. It also lists the verification steps. This is specific and directly matches the changeset in vega.ts and the vega-describe test.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/tool-server/src/tools/describe/platforms/vega.ts

Parsing error: Unable to parse the specified 'tsconfig' file. Ensure it's correct and has valid syntax.

packages/docs/tsconfig.json(2,14): error TS6053: File '@docusaurus/tsconfig' not found.

packages/tool-server/test/vega-describe.test.ts

Parsing error: Unable to parse the specified 'tsconfig' file. Ensure it's correct and has valid syntax.

packages/docs/tsconfig.json(2,14): error TS6053: File '@docusaurus/tsconfig' not found.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@latekvo
latekvo marked this pull request as ready for review October 12, 2026 18:48
…the allowlist

Fold VEGA_MULTIPLE_DEVICES into DISCOVERY_FAILURES instead of a separate instanceof check, and add a case showing a typed non-discovery failure (adb forward) still degrades to the relaunch hint.

@latekvo latekvo left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[Diplomat, Opus 5.5]: Ran a 5-dimension review (claims vs code, nearest twin, non-happy paths, real-HTTP E2E against main's vega.ts, mutation) over this head merged with current main. No high or medium findings. Two low ones are inline.

waitForVegaAutomation swallowed every describeVega throw, so a VVD that
went missing after restart-app ended as generic relaunch advice. Return the
error still standing at the deadline, as androidDevtoolsReady does.
…appear

Only VEGA_DEVICE_NOT_REGISTERED clears up while polling; a missing or
ambiguous VVD now ends the gate on the first read. The reason names the
VVD rather than the toolkit, since discovery is what failed.
A ps probe timing out under load also reads as VEGA_DEVICE_NOT_FOUND, so
failing fast on it would abort a launch the old loop recovered from. Poll
every throw to the deadline and report the last one, under a prefix that
does not repeat the error's own subject.
@latekvo

latekvo commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Folded into #1753 as 722cea7, to review together with the other capture fixes.

@latekvo latekvo closed this Nov 4, 2026
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.

Vega describe returns an empty tree and a 'relaunch the app' hint when no VVD is running

1 participant