Repository navigation
Increase test coverage across AgentLab - #10
Open
devin-ai-integration[bot] wants to merge 5 commits into
Open
devin-ai-integration[bot] wants to merge 5 commits into
devin-ai-integration[bot] wants to merge 5 commits into
Conversation
- Add pytest-cov to dev dependencies and CI workflow - Add tests for untested agents: MostBasicAgent, DebugAgent, ToolUseAgent, VisualAgent - Add tests for analysis modules: episode_to_html, archive_studies, agent_xray - Add tests for utility modules: agent_utils, loop unit tests - Add tests for benchmark modules: abstract_env, multitool_gym - Add tests for experiment configs (test_exp_configs.py) - Fix commented-out tests in test_reproducibility_util.py (updated to current API) - Fix commented-out rate limit tests in test_llm_utils.py (updated to current API) - Change test_launch_parallel_study from @Skip to @pricy - Fill TODO gaps in test_generic_prompt.py (screenshot, SOM, chat, thinking, action_history) Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
CheatMiniWoBLLM searches for AXTree-style bids ([N] button) but MostBasicAgent uses pruned_html and VisualAgent may format prompts differently. Changed assertions to verify the experiment loop completes gracefully rather than expecting cum_reward=1.0. Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
…agent tests - MostBasicAgent uses pruned_html (bid="X" attributes), not AXTree format. Created _CheatMiniWoBLLM_HTML that finds bids in HTML and returns code blocks. - VisualAgent's Observation doesn't render AXTree in prompt text, so removed the broken e2e test and kept unit tests for instantiation, make_agent, reset. Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
The cheat LLM may click the wrong element since the first bid in HTML isn't guaranteed to be the target button. Only assert the experiment completes without stack_trace. Also set max_steps=2 to avoid 16-min timeout in CI. Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
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
Adds
pytest-covto CI and significantly expands test coverage across AgentLab by creating 11 new test files, filling TODO gaps in existing tests, and re-enabling commented-out tests updated to the current API.CI change: The pytest command now includes
--cov=src/agentlab --cov-report=term-missingso coverage is measured on every run.New test files (11):
tests/agents/test_most_basic_agent.py— custom_CheatMiniWoBLLM_HTMLthat finds bids in pruned HTML (bid="X"attributes); e2e test verifies experiment completes without crash (requires MINIWOB_URL)tests/agents/test_debug_agent.py— instantiation, get_action with mocked input, set_benchmarktests/agents/test_tool_use_agent.py— Block.make() cloning, StructuredDiscussion, MsgGrouptests/agents/test_visual_agent.py— unit tests for instantiation, make_agent, reset (no e2e test; VisualAgent's Observation class doesn't render AXTree text in the prompt, so CheatMiniWoBLLM cannot locate bids)tests/agents/test_agent_utils.py— draw_mouse_pointer, draw_click_indicatortests/analyze/test_episode_to_html.py— HTML escaping and formatting helperstests/analyze/test_archive_studies.py— StudyInfo dataclasstests/analyze/test_agent_xray.py— column cleaning, display_table, dataclass defaults (skips if langchain missing)tests/experiments/test_loop_unit.py— EnvArgs, StepInfo, StepTimestamps, ExpResult, _flatten_dict, DataclassJSONEncodertests/benchmarks/test_abstract_env.py— timing decorator, AbstractBenchmark defaultstests/benchmarks/test_multitool_gym.py— MultiToolGym (skips if tapeagents missing)Modified test files (5):
test_exp_configs.py— was empty (1 import line); now has 6 tests for make_study, override_max_steps, save/loadtest_reproducibility_util.py— uncommented and rewrotetest_save_reproducibility_infoto use current API (get_reproducibility_info+assert_compatible)test_llm_utils.py— replaced commented-out rate limit tests with two new tests matching currentretry()signaturetest_study.py— changedtest_launch_parallel_studyfrom@pytest.mark.skipto@pytest.mark.pricytest_generic_prompt.py— added 5 new tests foruse_screenshot,use_som,enable_chat,use_thinking,use_action_history(previously marked TODO)Updates since last revision
test_most_basic_agent.py: ReplacedCheatMiniWoBLLMArgswith a custom_CheatMiniWoBLLM_HTMLthat parsesbid="X"attributes in pruned HTML and returns responses in triple-tick code blocks (matching MostBasicAgent's parser). Relaxed assertions to verify no crash (err_msg=None,stack_trace=None) rather thancum_reward=1.0, since the first bid in HTML may not be the target button. Addedmax_steps=2to prevent the test from running for 16+ minutes.test_visual_agent.py: Removed the broken e2e test entirely. VisualAgent'sObservation._promptdoesn't include AXTree text, so no cheat LLM can reliably find bids. Kept unit tests for instantiation, make_agent, and reset.uv.lock: Now committed and in sync withpyproject.toml(includespytest-cov).test_agent.py::test_llm_error_no_successfails onmainas well — not introduced by this PR.Review & Testing Checklist for Human
test_most_basic_agent.pycustom cheat LLM — the_CheatMiniWoBLLM_HTMLregexbid="(\w+)"[^>]*>.*?buttonfinds the first bid near "button" text in HTML. If MiniWoB'sclick-testHTML changes structure, this could start matching the wrong element or failing. Verify the relaxed assertions (no crash, not reward=1.0) are acceptable coverage.test_exp_configs.py:test_study_save_and_load— callsStudy.save(exp_root=...)andStudy.load(result.dir). Verify these APIs exist and behave as expected; a mismatch will cause CI failure.uv.lockdiff — the lock file was regenerated withuv lock. The diff is large due toupload-timemetadata being added to all entries. Verify no unintended dependency version changes were introduced.test_llm_utils.pyrate limit tests — bothtest_rate_limit_raises_on_persistent_errorandtest_rate_limit_propagates_immediatelyverify thatRateLimitErrorpropagates immediately fromretry(). These are somewhat redundant. Consider if one should testgeneric_call_api_with_retriesinstead.test_llm_error_no_successfailure — this test fails onmainand is unrelated to this PR. TheagentlabCI check is not marked as required, so the PR is mergeable. Confirm this is acceptable.uv run pytest -n 5 --durations=10 -m 'not pricy' -v --cov=src/agentlab --cov-report=term-missing tests/in CI (with MINIWOB_URL set) and verify that the only failures are the pre-existingtest_llm_error_no_success. Check the coverage report for meaningful improvement.Notes
pytest.importorskip(langchain, tapeagents) and will be silently skipped if those optional deps aren't installed. Verify the skip count is acceptable.test_generic_prompt.pyTODO replacements: theuse_thinkingtest disables bothuse_thinkinganduse_think_history; theuse_action_historytest also disablesuse_concrete_exampleanduse_abstract_example. These test flag combinations rather than isolating individual flags. Verify this matches the intended coverage goals.Link to Devin session: https://app.devin.ai/sessions/7a709614138c45958dc785b6c24f7249
Requested by: @lburgers