Skip to content

extract_broadcast_data: split on the protocol marker only, not inside the payload - #388

Open
aashish254 wants to merge 1 commit into
google-research:mainfrom
aashish254:fix/broadcast-data-truncation
Open

aashish254 wants to merge 1 commit into
google-research:mainfrom
aashish254:fix/broadcast-data-truncation

Conversation

@aashish254

Copy link
Copy Markdown

What this changes

extract_broadcast_data parsed the adb broadcast output with raw_output.split('data=')[1]. When the broadcast payload itself contains data=, that is two split points, and [1] silently returns only the text up to the payload's own data=. The fix splits once, on the protocol marker only: split('data=', 1)[1].

Why

This is the parser behind get_clipboard_contents (via _extract_clipper_output) and the MiniWob _extract_data path. Clipboard content is arbitrary user text — a copied URL like https://example.com/login?redirect=data=42 is exactly the kind of string agents and task validators round-trip through the clipper app. Today it comes back truncated to https://example.com/login?redirect=, with no error raised: the task reads silently wrong data and a correct agent action can be scored as failed.

How it was verified

  • Added test_data_containing_data_marker_is_not_truncated in adb_utils_test.py (pure parsing test, no emulator, same style as the existing TestExtractBroadcastData cases).
  • Mutation check: with adb_utils.py reverted to base and only the test added, the new test fails ('https://example.com/login?redirect=' != 'https://example.com/login?redirect=data=42'); with the fix it passes.
  • pytest android_world/env/adb_utils_test.py → 18/18 passed.
  • Full suite (pytest android_world --ignore=task_evals/miniwob, the same invocation CI runs) → 506 passed. Two failures (interface_test::test_ui_stability_false_due_to_timeout, receipt_generator_test::test_create_receipt) are pre-existing on pristine main in my local macOS environment — they fail identically with and without this change, and are untouched by it.
  • Deconfliction: merged this branch cleanly (git merge-tree, exit code 0) against current heads of the four open PRs that also touch adb_utils.py (Update _input_text function to support for non-ASCII characters #340, Update _input_text function to support for non-ASCII characters #338, APK installation failures will now raise an exception #371, Fix the task ClockStopWatchRunning #358) and against main.

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