{
  "arm_summary": {
    "control": {
      "completed_episodes": 4,
      "episodes": 4,
      "error_episodes": 0,
      "mean_evaluator_reward": 1.0,
      "mean_latency_s": 101.198336,
      "mean_llm_calls": 8.5,
      "mean_llm_latency_s": 62.453747,
      "mean_steps": 4.75,
      "mean_total_tokens": 139439.5,
      "success_rate": 1.0,
      "successes": 4,
      "total_input_tokens": 549928,
      "total_output_tokens": 7830,
      "total_tokens": 557758
    },
    "treatment": {
      "completed_episodes": 4,
      "episodes": 4,
      "error_episodes": 0,
      "mean_evaluator_reward": 1.0,
      "mean_latency_s": 99.184035,
      "mean_llm_calls": 8.5,
      "mean_llm_latency_s": 59.748216,
      "mean_steps": 4.75,
      "mean_total_tokens": 70557.5,
      "success_rate": 1.0,
      "successes": 4,
      "total_input_tokens": 274067,
      "total_output_tokens": 8163,
      "total_tokens": 282230
    }
  },
  "baseline": {
    "agent": "t3a_claude4_sonnet",
    "provenance": "historical bundled report; not generated by this runner",
    "reported_success_rate_approx": 0.88,
    "run_date": "2025-07-02",
    "source": "t3a_summary.md and t3a_failed_analysis.md",
    "tasks": 116,
    "trials_per_task": 1
  },
  "command": [
    "run_controlled_experiment.py",
    "--mode",
    "paired",
    "--hypothesis",
    "H5C",
    "--source-phase1-evidence",
    "validation/paired_wifi_api35_20260729/evidence.json",
    "--source-phase2-evidence",
    "validation/paired_h5_a11y_api35_20260729/evidence.json",
    "--tasks",
    "SystemWifiTurnOff,SystemWifiTurnOffVerify,SystemWifiTurnOn,SystemWifiTurnOnVerify",
    "--trials",
    "1",
    "--seed",
    "42",
    "--model-seed",
    "42",
    "--max-steps",
    "10",
    "--transition-pause",
    "0.5",
    "--skip-device-time",
    "--output-dir",
    "validation/paired_h5c_compact_api35_20260729"
  ],
  "credentials_persisted": false,
  "decision": {
    "completed_pairs": 4,
    "deployment_approved": false,
    "guardrails": {
      "maximum_latency_ratio": 1.5,
      "maximum_token_ratio": 0.75,
      "objective": "success_noninferiority_and_token_reduction",
      "passed": true,
      "require_all_treatment_pairs_successful": true
    },
    "mean_latency_ratio_treatment_over_control": 0.980096,
    "mean_llm_call_ratio_treatment_over_control": 1.0,
    "mean_token_ratio_treatment_over_control": 0.506008,
    "net_success_delta": 0,
    "outcome": "promote_efficient_candidate_to_full_suite_rerun",
    "paired_regressions": 0,
    "promote_to_full_suite_candidate": true,
    "reason": "Treatment preserved paired success with no regression and passed the latency/token efficiency guardrails. This is a candidate decision only.",
    "required_treatment_successes": 4,
    "scope_recommendation": "full_suite_candidate_only",
    "success_preservation_passed": true,
    "treatment_successes": 4
  },
  "diagnosis": {
    "findings": [
      "The historical run evaluated 116 tasks once each and reports approximately 88% overall success.",
      "Wi-Fi is a concentrated failure cluster: three of the four SystemWifiTurn* rows failed in the bundled per-task table.",
      "The capability matrix links the cluster to weak complex_ui_understanding, information_retrieval, and requires_setup behavior.",
      "The failed traces show navigation/state-verification loops; increasing the step cap alone would treat a symptom rather than the cause."
    ],
    "layered_hypotheses": [
      {
        "id": "H1",
        "idea": "Add Wi-Fi Settings navigation and final-state verification guidance.",
        "layer": "surface",
        "status": "tested in source phase 1",
        "target": "At least one net paired success across the four Wi-Fi tasks, with no regression.",
        "verification": "Paired upstream-prompt versus task-guideline ablation with matched seeds."
      },
      {
        "id": "H2",
        "idea": "Add application-specific recognition rules for the non-standard Tasks UI.",
        "layer": "surface",
        "status": "not tested",
        "target": "Improve at least two of the six historical Tasks failures with no regression.",
        "verification": "Paired Tasks-only prompt/tool-description ablation after app provisioning."
      },
      {
        "id": "H3",
        "idea": "Repair and validate the multimodal input path for transcription tasks.",
        "layer": "middle",
        "status": "not tested",
        "target": "Raise transcription success above the historical 0% while bounding added tokens and latency.",
        "verification": "Paired screenshot-disabled versus screenshot-enabled transcription run."
      },
      {
        "id": "H4",
        "idea": "Conditionally enable deeper thinking for counting tasks.",
        "layer": "middle",
        "status": "not tested",
        "target": "Improve math/counting success without applying the cost to unrelated tasks.",
        "verification": "Paired tag-routed thinking-mode ablation with latency and token guardrails."
      },
      {
        "id": "H5",
        "idea": "Replace the API-35-incompatible gRPC accessibility feed with upstream's UIAutomator observation path.",
        "layer": "middle",
        "status": "tested in source phase 2",
        "target": "At least one net paired Wi-Fi success with no regression and at most 1.5x latency/tokens.",
        "verification": "Paired a11y-forwarder versus UIAutomator run with the same upstream T3A prompt and matched seeds."
      },
      {
        "id": "H5C",
        "idea": "Filter non-semantic UIAutomator container nodes after H5 exposed excessive prompt-token cost.",
        "layer": "middle",
        "status": "tested in this run",
        "target": "Preserve H5 paired success with no regression while using at most 0.75x raw-UIAutomator tokens and 1.5x latency.",
        "verification": "Paired raw-UIAutomator versus compact-UIAutomator run with matched tasks, seeds, prompt, and evaluator."
      },
      {
        "id": "H6",
        "idea": "Combine screenshots with the structured UI tree and compare stronger vision-capable models.",
        "layer": "deep",
        "status": "not tested",
        "target": "Improve complex-UI success enough to justify multimodal latency and token cost.",
        "verification": "Factorial UI-tree/screenshot/model ablation on the full tagged slice."
      }
    ]
  },
  "environment": {
    "a11y_method": "varies_by_arm:uiautomator_vs_uiautomator_compact",
    "android_world_checkout": "/Users/boj/book/ai-agent-book/chapter6/android_world",
    "android_world_checkout_clean": true,
    "android_world_commit": "0e95d641e244504c22087cc29b013f3b2428a261",
    "api_level": 35,
    "avd_name": "Pixel_9_Pro_API_35",
    "device_model": "sdk_gphone64_arm64",
    "device_serial": "emulator-5554",
    "grpc_port": 8554,
    "perform_emulator_setup": false,
    "physical_size": "Physical size: 1280x2856",
    "protobuf_bootstrap": {
      "generated_protobufs_in_temporary_directory": true,
      "temporary_directory_persisted": false
    },
    "skip_device_time": true,
    "upstream_tested_api_level": 33,
    "upstream_tested_device": "Pixel 6"
  },
  "environment_boundaries": [
    "The available AVD is API 35, while upstream is tested on Pixel 6 / API 33. Results are real but not reference-environment comparable.",
    "The full third-party AndroidWorld app bundle was not provisioned. This run is restricted to system Settings tasks.",
    "UIAutomator is an upstream AndroidWorld observation option selected by the companion runner; it preserves real UI actions/evaluators but is a compatibility path, not the upstream API-33 reference configuration.",
    "Compact UIAutomator removes only non-semantic container nodes; observations, coordinates, Android actions, and AndroidWorld evaluators remain real.",
    "Per-task device-time setting was skipped because the non-root API-35 AVD rejects `adb shell date`; Wi-Fi evaluators do not depend on time."
  ],
  "episodes": [
    {
      "agent_declared_done": true,
      "arm": "control",
      "elapsed_s": 105.382271,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi off.",
      "initial_evaluator_reward": 0.0,
      "llm": {
        "calls": 9,
        "input_tokens": 132349,
        "latency_s": 64.872256,
        "output_tokens": 2008,
        "reasoning_tokens": 1488,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator",
      "order_position": 1,
      "pair_id": "SystemWifiTurnOff:trial-1:seed-42",
      "pair_seed": 42,
      "params": {
        "on_or_off": "off"
      },
      "status": "completed",
      "steps": 5,
      "success": true,
      "task": "SystemWifiTurnOff",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 22.742624,
          "goal_status": null,
          "reason": "To turn off Wi-Fi, the first step is to open the Settings app. On the current home screen, UI element 26 is the \"Settings\" app, which is clickable. Clicking it will open the Settings menu where Wi-Fi settings can be accessed.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 21.091666,
          "goal_status": null,
          "reason": "The current screen shows an error dialog \"com.google.androidenv.accessibilityforwarder keeps stopping\" which is blocking access to the Settings menu. To proceed with turning off Wi-Fi, I need to dismiss this dialog by closing the problematic app. The \"Close app\" button (index 11) is visible and clickable, so clicking it will remove the dialog and allow me to continue navigating to Wi-Fi settings.",
          "step": 2
        },
        {
          "action_type": "input_text",
          "done": false,
          "elapsed_s": 24.93577,
          "goal_status": null,
          "reason": "To proceed with turning off Wi-Fi, I need to locate the Wi-Fi settings. Since the current screen is the settings search screen, the most efficient way is to search for \"Wi-Fi\" using the search bar. The search bar (UI element 15) is an editable text field and is focused, making it suitable for input.",
          "step": 3
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 25.397996,
          "goal_status": null,
          "reason": "The current screen shows the Wi-Fi settings with a checked (on) switch at index 32. To turn off Wi-Fi, I need to click this switch to toggle it to the off position.",
          "step": 4
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 8.938998,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch (index 32) is now unchecked (is_checked=False), indicating that Wi-Fi has been turned off. The user's goal of turning Wi-Fi off has been successfully achieved.",
          "step": 5
        }
      ],
      "trial": 1
    },
    {
      "agent_declared_done": true,
      "arm": "treatment",
      "elapsed_s": 103.549168,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi off.",
      "initial_evaluator_reward": 0.0,
      "llm": {
        "calls": 9,
        "input_tokens": 75681,
        "latency_s": 65.635331,
        "output_tokens": 2101,
        "reasoning_tokens": 1568,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator_compact",
      "order_position": 2,
      "pair_id": "SystemWifiTurnOff:trial-1:seed-42",
      "pair_seed": 42,
      "params": {
        "on_or_off": "off"
      },
      "status": "completed",
      "steps": 5,
      "success": true,
      "task": "SystemWifiTurnOff",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 20.105315,
          "goal_status": null,
          "reason": "To turn off Wi-Fi, the first step is to open the Settings app. On the current home screen, UI element 12 is the \"Settings\" app, which is visible and clickable. Clicking it will open the Settings menu where Wi-Fi settings can be accessed.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 23.230104,
          "goal_status": null,
          "reason": "To turn off Wi-Fi, I need to access the Wi-Fi settings. The \"Network & internet\" option (UI element 6) is visible and clickable, and its summary mentions \"Wi‑Fi\", indicating it contains Wi-Fi settings. Clicking this will lead to the next screen where Wi-Fi can be toggled off.",
          "step": 2
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 21.825863,
          "goal_status": null,
          "reason": "To access the Wi-Fi settings and turn it off, I need to click on the \"Internet\" option, which is part of the clickable linear layout (UI element 3) on the Network & internet settings page.",
          "step": 3
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 27.327625,
          "goal_status": null,
          "reason": "The current screen shows the Internet settings where the Wi-Fi switch is visible. The Wi-Fi option is contained in UI element 9 (a LinearLayout), which is clickable. This element includes the \"Wi-Fi\" text (UI element 10) and the switch (UI element 11) that is currently on (is_checked=True). Clicking this LinearLayout will toggle the Wi-Fi switch off.",
          "step": 4
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 8.69858,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch is now off (is_checked=False as per UI element 11), so the task of turning Wi-Fi off has been successfully completed.",
          "step": 5
        }
      ],
      "trial": 1
    },
    {
      "agent_declared_done": true,
      "arm": "treatment",
      "elapsed_s": 102.209211,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi off.",
      "initial_evaluator_reward": 1.0,
      "llm": {
        "calls": 9,
        "input_tokens": 64462,
        "latency_s": 62.502274,
        "output_tokens": 2130,
        "reasoning_tokens": 1620,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator_compact",
      "order_position": 1,
      "pair_id": "SystemWifiTurnOffVerify:trial-1:seed-1051",
      "pair_seed": 1051,
      "params": {
        "on_or_off": "off"
      },
      "status": "completed",
      "steps": 5,
      "success": true,
      "task": "SystemWifiTurnOffVerify",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 20.831033,
          "goal_status": null,
          "reason": "The current screen shows an error message pop-up that is blocking access to the main interface. To proceed with turning off Wi-Fi, I need to close this pop-up first. The \"Close app\" button (UI element 2) is visible and clickable, so clicking it will dismiss the pop-up.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 23.270511,
          "goal_status": null,
          "reason": "To turn off Wi-Fi, the next step is to open the Settings app, as Wi-Fi settings are typically located there. The \"Settings\" app is visible on the home screen (UI element 12), which is clickable. Clicking it will allow access to the settings menu where Wi-Fi can be managed.",
          "step": 2
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 23.028096,
          "goal_status": null,
          "reason": "To turn off Wi-Fi, I need to access the network settings. The \"Network & internet\" option (UI element 6, which is a clickable LinearLayout containing the \"Network & internet\" title and summary) is the appropriate next step to navigate to Wi-Fi controls.",
          "step": 3
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 20.913882,
          "goal_status": null,
          "reason": "To access the Wi-Fi controls, I need to navigate to the \"Internet\" settings. The \"Internet\" option is contained within the clickable LinearLayout (UI element 3), which is visible and interactive on the current \"Network & internet\" screen. Clicking this element will likely lead to the page where Wi-Fi can be toggled off.",
          "step": 4
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 11.76325,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch (UI element 11) is already in the off position (is_checked=False), so the goal of turning Wi-Fi off has been achieved.",
          "step": 5
        }
      ],
      "trial": 1
    },
    {
      "agent_declared_done": true,
      "arm": "control",
      "elapsed_s": 112.724126,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi off.",
      "initial_evaluator_reward": 1.0,
      "llm": {
        "calls": 9,
        "input_tokens": 150834,
        "latency_s": 67.904524,
        "output_tokens": 2205,
        "reasoning_tokens": 1649,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator",
      "order_position": 2,
      "pair_id": "SystemWifiTurnOffVerify:trial-1:seed-1051",
      "pair_seed": 1051,
      "params": {
        "on_or_off": "off"
      },
      "status": "completed",
      "steps": 5,
      "success": true,
      "task": "SystemWifiTurnOffVerify",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 18.772365,
          "goal_status": null,
          "reason": "To turn off Wi-Fi, the first step is to open the Settings app. On the home screen, UI element 26 is the \"Settings\" app, which is clickable. Clicking it will open the Settings menu where Wi-Fi settings can be accessed.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 25.71773,
          "goal_status": null,
          "reason": "To turn off Wi-Fi, I need to access the Wi-Fi settings. The \"Network & internet\" option (UI element 24) in the Settings menu is the appropriate entry point as it mentions \"Wi‑Fi\" in its summary. The parent LinearLayout (UI element 20) is clickable, so I will tap on it to proceed to the Network & internet settings page.",
          "step": 2
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 24.548097,
          "goal_status": null,
          "reason": "The goal is to turn off Wi-Fi. Currently, on the Settings home screen, the \"Network & internet\" section (UI element 20) is visible, which is the correct path to access Wi-Fi settings. Since the previous attempt to click this element didn't result in a screen change (possibly due to a delay), retrying the click on UI element 20 is necessary to navigate to the Network & internet settings where Wi-Fi can be toggled off.",
          "step": 3
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 26.737918,
          "goal_status": null,
          "reason": "To access the Wi-Fi settings, I need to navigate into the \"Internet\" section under \"Network & internet\". The \"Internet\" option (UI element 15) is clickable and likely contains Wi-Fi controls, so clicking it will allow me to proceed toward turning off Wi-Fi.",
          "step": 4
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 13.895503,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch (UI element 31) is already in the off position (is_checked=False), so the task of turning Wi-Fi off has been completed.",
          "step": 5
        }
      ],
      "trial": 1
    },
    {
      "agent_declared_done": true,
      "arm": "control",
      "elapsed_s": 100.007401,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi on.",
      "initial_evaluator_reward": 0.0,
      "llm": {
        "calls": 9,
        "input_tokens": 146625,
        "latency_s": 60.454149,
        "output_tokens": 1997,
        "reasoning_tokens": 1484,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator",
      "order_position": 1,
      "pair_id": "SystemWifiTurnOn:trial-1:seed-2060",
      "pair_seed": 2060,
      "params": {
        "on_or_off": "on"
      },
      "status": "completed",
      "steps": 5,
      "success": true,
      "task": "SystemWifiTurnOn",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 21.700473,
          "goal_status": null,
          "reason": "To turn on Wi-Fi, the first step is to open the Settings app. On the current home screen, UI element 26 is the \"Settings\" app, which is clickable. Clicking it will allow access to the settings menu where Wi-Fi can be enabled.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 20.450628,
          "goal_status": null,
          "reason": "To proceed towards enabling Wi-Fi, I need to access the \"Network & internet\" settings, which is the logical next step as it contains Wi-Fi options. The \"Network & internet\" element (index 24) is visible and clickable on the current screen.",
          "step": 2
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 22.812015,
          "goal_status": null,
          "reason": "To proceed towards enabling Wi-Fi, I need to access the Internet settings which typically include Wi-Fi options. The \"Internet\" option (contained in the clickable LinearLayout at index 15) is visible on the screen and is the logical next step to find the Wi-Fi toggle.",
          "step": 3
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 21.686302,
          "goal_status": null,
          "reason": "The current screen shows the Internet settings page where the Wi-Fi option is present. The Wi-Fi switch (UI element 31) is currently unchecked (is_checked=False), indicating Wi-Fi is off. To turn Wi-Fi on, I need to click this switch to toggle it to the on position.",
          "step": 4
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 10.361169,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch (UI element 35) is now checked, indicating Wi-Fi is enabled. The screen also shows \"AndroidWifi\" as connected, confirming the task of turning Wi-Fi on has been successfully completed.",
          "step": 5
        }
      ],
      "trial": 1
    },
    {
      "agent_declared_done": true,
      "arm": "treatment",
      "elapsed_s": 106.717192,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi on.",
      "initial_evaluator_reward": 0.0,
      "llm": {
        "calls": 9,
        "input_tokens": 74268,
        "latency_s": 60.267918,
        "output_tokens": 2150,
        "reasoning_tokens": 1681,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator_compact",
      "order_position": 2,
      "pair_id": "SystemWifiTurnOn:trial-1:seed-2060",
      "pair_seed": 2060,
      "params": {
        "on_or_off": "on"
      },
      "status": "completed",
      "steps": 5,
      "success": true,
      "task": "SystemWifiTurnOn",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "open_app",
          "done": false,
          "elapsed_s": 23.770885,
          "goal_status": null,
          "reason": "To turn on Wi-Fi, the first step is to open the Settings app where network settings are located. The current screen shows a \"Settings\" app icon (UI element 12), and using the `open_app` action is the most direct way to launch the app.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 27.515651,
          "goal_status": null,
          "reason": "To proceed to the Wi-Fi settings, I need to access the \"Network & internet\" section. The UI element 6 is a clickable LinearLayout that contains the \"Network & internet\" text (elements 7 and 8), making it the appropriate element to interact with.",
          "step": 2
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 22.324583,
          "goal_status": null,
          "reason": "To access the Wi-Fi settings, I need to navigate into the \"Internet\" section, which is likely to contain Wi-Fi controls. The \"Internet\" option is part of the clickable LinearLayout (UI element 3) on the current screen.",
          "step": 3
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 19.494808,
          "goal_status": null,
          "reason": "The Wi-Fi switch (UI element 11) is currently off (is_checked=False). To turn Wi-Fi on, I need to click this switch to toggle it to the on position.",
          "step": 4
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 11.27913,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch (UI element 11) is now checked (is_checked=True), indicating Wi-Fi is turned on. Additionally, \"AndroidWifi\" is shown as connected (UI element 12), confirming the task is completed.",
          "step": 5
        }
      ],
      "trial": 1
    },
    {
      "agent_declared_done": true,
      "arm": "treatment",
      "elapsed_s": 84.26057,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi on.",
      "initial_evaluator_reward": 1.0,
      "llm": {
        "calls": 7,
        "input_tokens": 59656,
        "latency_s": 50.587342,
        "output_tokens": 1782,
        "reasoning_tokens": 1390,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator_compact",
      "order_position": 1,
      "pair_id": "SystemWifiTurnOnVerify:trial-1:seed-3069",
      "pair_seed": 3069,
      "params": {
        "on_or_off": "on"
      },
      "status": "completed",
      "steps": 4,
      "success": true,
      "task": "SystemWifiTurnOnVerify",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 20.295946,
          "goal_status": null,
          "reason": "To turn on Wi-Fi, the first step is to open the Settings app. On the current home screen, UI element 12 is the \"Settings\" app, which is visible and clickable. Clicking on it will allow access to the settings menu where Wi-Fi can be enabled.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 26.66904,
          "goal_status": null,
          "reason": "To proceed with turning on Wi-Fi, I need to access the \"Network & internet\" settings, as it contains Wi-Fi options. The \"Network & internet\" section is represented by the clickable LinearLayout (UI element 6) on the current screen. Clicking this will navigate to the relevant submenu where Wi-Fi can be enabled.",
          "step": 2
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 26.764651,
          "goal_status": null,
          "reason": "To proceed with turning on Wi-Fi, I need to access the Wi-Fi settings. The \"Internet\" section (contained in UI element 3, a clickable LinearLayout) is the logical next step, as it likely leads to Wi-Fi configuration options.",
          "step": 3
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 8.154307,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch (UI element 11) is already checked (is_checked=True), indicating that Wi-Fi is enabled. The user's goal of turning Wi-Fi on has been achieved.",
          "step": 4
        }
      ],
      "trial": 1
    },
    {
      "agent_declared_done": true,
      "arm": "control",
      "elapsed_s": 86.679544,
      "error": null,
      "evaluator_reward": 1.0,
      "goal": "Turn wifi on.",
      "initial_evaluator_reward": 1.0,
      "llm": {
        "calls": 7,
        "input_tokens": 120120,
        "latency_s": 56.58406,
        "output_tokens": 1620,
        "reasoning_tokens": 1195,
        "system_fingerprints": []
      },
      "observation_method": "uiautomator",
      "order_position": 2,
      "pair_id": "SystemWifiTurnOnVerify:trial-1:seed-3069",
      "pair_seed": 3069,
      "params": {
        "on_or_off": "on"
      },
      "status": "completed",
      "steps": 4,
      "success": true,
      "task": "SystemWifiTurnOnVerify",
      "task_guidelines_applied": false,
      "trace": [
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 21.802337,
          "goal_status": null,
          "reason": "To turn on Wi-Fi, the first step is to open the Settings app. On the home screen, UI element 26 is the \"Settings\" app, which is clickable. Clicking it will allow access to the settings menu where Wi-Fi can be enabled.",
          "step": 1
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 24.619676,
          "goal_status": null,
          "reason": "To proceed with enabling Wi-Fi, I need to access the \"Network & internet\" settings, as it contains Wi-Fi options. The \"Network & internet\" section is a clickable element (UI element 20) on the current Settings screen. Clicking this will navigate to the relevant submenu where Wi-Fi can be toggled on.",
          "step": 2
        },
        {
          "action_type": "click",
          "done": false,
          "elapsed_s": 26.561039,
          "goal_status": null,
          "reason": "To proceed with enabling Wi-Fi, I need to access the Wi-Fi settings. The \"Internet\" option (UI element 19) with \"AndroidWifi\" as the summary (UI element 20) is likely the entry point to Wi-Fi settings. The parent linear layout (UI element 15) is clickable, so clicking it will navigate to the Wi-Fi settings screen where the toggle can be accessed.",
          "step": 3
        },
        {
          "action_type": "status",
          "done": true,
          "elapsed_s": 11.348688,
          "goal_status": "complete",
          "reason": "The Wi-Fi switch (UI element 35) is already in the checked state, indicating that Wi-Fi is turned on. The user's goal of turning Wi-Fi on has been achieved.",
          "step": 4
        }
      ],
      "trial": 1
    }
  ],
  "experiment": "6-10",
  "experiment_complete": false,
  "generated_at_utc": "2026-07-29T14:12:27Z",
  "hypothesis": {
    "change": "Use the real upstream UIAutomator hierarchy but retain only visible text, descriptions, and actionable/scrollable elements.",
    "expected_result": "Preserve H5 paired success with no regression while using at most 0.75x raw-UIAutomator tokens and 1.5x latency.",
    "guardrails": "Same model, seed, task parameters, emulator, checkout, and step budget; require at least four completed pairs, every compact-UIAutomator treatment pair successful, no paired regression, at most 1.5x mean latency, and at most 0.75x raw-UIAutomator mean tokens. Passing a paired gate permits only a full-suite candidate rerun; it is not deployment approval, and a subset must never be reported as full-suite success.",
    "guideline_sha256": null,
    "guidelines": [],
    "id": "H5C",
    "layer": "middle",
    "verification": "Paired raw-UIAutomator versus compact-UIAutomator run with matched tasks, seeds, prompt, and evaluator."
  },
  "llm_analysis": {
    "cost_benefit_interpretation": "The treatment provides significant token efficiency (mean token ratio 0.506) with preserved success and marginal latency improvement (mean latency ratio 0.980) in the tested 4-task subset. However, interpretation is bounded by the API/app environment: results are from an API 35 AVD (not upstream API 33 reference), restricted to system Settings tasks (no full third-party app bundle), and use UIAutomator as a compatibility path (not upstream reference configuration), limiting generalizability beyond the tested scope.",
    "llm": {
      "calls": 1,
      "input_tokens": 3257,
      "latency_s": 34.44844,
      "output_tokens": 1101,
      "reasoning_tokens": 647,
      "system_fingerprints": []
    },
    "next_hypothesis": {
      "id": "H5C-full",
      "idea": "Evaluate compact UIAutomator (semantic-filtered elements) across the full AndroidWorld task suite to verify token efficiency and success preservation beyond the 4-task Settings subset.",
      "layer": "middle",
      "target": "Full task suite (all 116 tasks) with upstream reference environment (Pixel 6 / API 33) and provisioned full third-party AndroidWorld app bundle.",
      "verification": "Paired run comparing compact UIAutomator (treatment) vs raw UIAutomator (control) across all tasks, ensuring guardrails (mean token ratio ≤0.75, mean latency ratio ≤1.5, success non-inferiority) hold in the reference environment."
    },
    "observed_failure_pattern": [],
    "source": "real configured LLM over aggregate direct evidence",
    "status": "completed",
    "summary": "A paired experiment comparing raw UIAutomator (control) and compact UIAutomator (treatment) on 4 system Settings tasks (SystemWifiTurnOff, SystemWifiTurnOffVerify, SystemWifiTurnOn, SystemWifiTurnOnVerify) in an API 35 AVD environment. Both arms completed 4 episodes with 100% success rate, identical mean steps (4.75) and LLM calls (8.5). Treatment showed lower mean total tokens (50.6% of control) and slightly lower mean latency (98.0% of control). The decision was to promote the treatment as a full-suite candidate rerun, as it preserved success, passed latency/token guardrails, but remains a subset with environment limitations."
  },
  "model": {
    "base_url": "https://ark.cn-beijing.volces.com/api/v3",
    "max_tokens": 1024,
    "model": "doubao-seed-1-6-250615",
    "provider": "ark",
    "seed": 42,
    "temperature": 0
  },
  "paired_comparison": [
    {
      "control_latency_s": 105.382271,
      "control_reward": 1.0,
      "control_steps": 5,
      "control_success": true,
      "pair_id": "SystemWifiTurnOff:trial-1:seed-42",
      "reward_delta": 0.0,
      "success_delta": 0,
      "task": "SystemWifiTurnOff",
      "treatment_latency_s": 103.549168,
      "treatment_reward": 1.0,
      "treatment_steps": 5,
      "treatment_success": true,
      "trial": 1
    },
    {
      "control_latency_s": 112.724126,
      "control_reward": 1.0,
      "control_steps": 5,
      "control_success": true,
      "pair_id": "SystemWifiTurnOffVerify:trial-1:seed-1051",
      "reward_delta": 0.0,
      "success_delta": 0,
      "task": "SystemWifiTurnOffVerify",
      "treatment_latency_s": 102.209211,
      "treatment_reward": 1.0,
      "treatment_steps": 5,
      "treatment_success": true,
      "trial": 1
    },
    {
      "control_latency_s": 100.007401,
      "control_reward": 1.0,
      "control_steps": 5,
      "control_success": true,
      "pair_id": "SystemWifiTurnOn:trial-1:seed-2060",
      "reward_delta": 0.0,
      "success_delta": 0,
      "task": "SystemWifiTurnOn",
      "treatment_latency_s": 106.717192,
      "treatment_reward": 1.0,
      "treatment_steps": 5,
      "treatment_success": true,
      "trial": 1
    },
    {
      "control_latency_s": 86.679544,
      "control_reward": 1.0,
      "control_steps": 4,
      "control_success": true,
      "pair_id": "SystemWifiTurnOnVerify:trial-1:seed-3069",
      "reward_delta": 0.0,
      "success_delta": 0,
      "task": "SystemWifiTurnOnVerify",
      "treatment_latency_s": 84.26057,
      "treatment_reward": 1.0,
      "treatment_steps": 4,
      "treatment_success": true,
      "trial": 1
    }
  ],
  "phase": {
    "description": "middle-layer input-pipeline cost refinement after the H5 success/cost result",
    "id": "phase_2_cost_refinement",
    "independent_variable": "raw versus semantic-filtered UIAutomator element list",
    "source_phase1_decision": {
      "completed_pairs": 4,
      "mean_latency_ratio_treatment_over_control": 0.672411,
      "net_success_delta": 0,
      "outcome": "inconclusive_no_success_gain",
      "paired_regressions": 0,
      "promote_to_full_suite_candidate": false,
      "reason": "Treatment produced no paired success gain; keep the upstream control prompt."
    },
    "source_phase1_evidence": "/Users/boj/book/ai-agent-book/chapter6/android-world/validation/paired_wifi_api35_20260729/evidence.json",
    "source_phase1_run_id": "exp6-10-20260729T114648Z",
    "source_phase2_decision": {
      "completed_pairs": 4,
      "deployment_approved": false,
      "guardrails": {
        "maximum_latency_ratio": 1.5,
        "maximum_token_ratio": 1.5,
        "passed": false
      },
      "mean_latency_ratio_treatment_over_control": 0.788177,
      "mean_llm_call_ratio_treatment_over_control": 0.785714,
      "mean_token_ratio_treatment_over_control": 2.498496,
      "net_success_delta": 3,
      "outcome": "restrict_candidate_due_to_cost",
      "paired_regressions": 0,
      "promote_to_full_suite_candidate": false,
      "reason": "Treatment improved paired success without regressions, but exceeded the latency/token guardrails (1.50x / 1.50x). Restrict it to targeted follow-up; do not promote it to the full suite yet.",
      "scope_recommendation": "do_not_deploy"
    },
    "source_phase2_evidence": "/Users/boj/book/ai-agent-book/chapter6/android-world/validation/paired_h5_a11y_api35_20260729/evidence.json",
    "source_phase2_run_id": "exp6-10-20260729T122904Z"
  },
  "resume_commands": [
    [
      "run_controlled_experiment.py",
      "--mode",
      "paired",
      "--hypothesis",
      "H5C",
      "--source-phase1-evidence",
      "validation/paired_wifi_api35_20260729/evidence.json",
      "--source-phase2-evidence",
      "validation/paired_h5_a11y_api35_20260729/evidence.json",
      "--tasks",
      "SystemWifiTurnOff,SystemWifiTurnOffVerify,SystemWifiTurnOn,SystemWifiTurnOnVerify",
      "--trials",
      "1",
      "--seed",
      "42",
      "--model-seed",
      "42",
      "--max-steps",
      "10",
      "--transition-pause",
      "0.5",
      "--skip-device-time",
      "--output-dir",
      "validation/paired_h5c_compact_api35_20260729",
      "--resume"
    ]
  ],
  "run_id": "exp6-10-20260729T131911Z",
  "schema_version": 1,
  "scope": {
    "base_pair_seed": 42,
    "completed_episodes": 8,
    "direct_episode_gate_completed": false,
    "error_episodes": 0,
    "full_suite_completed": false,
    "manuscript_five_seed_gate_completed": false,
    "max_steps": 10,
    "mode": "paired",
    "tasks": [
      "SystemWifiTurnOff",
      "SystemWifiTurnOffVerify",
      "SystemWifiTurnOn",
      "SystemWifiTurnOnVerify"
    ],
    "transition_pause_s": 0.5,
    "trials_per_task": 1
  }
}
