Skip to content

Increase test coverage across AgentLab - #10

Open
devin-ai-integration[bot] wants to merge 5 commits into
mainfrom
devin/1774528859-increase-test-coverage
Open

devin-ai-integration[bot] wants to merge 5 commits into
mainfrom
devin/1774528859-increase-test-coverage

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Mar 26, 2026 •

Copy link
Copy Markdown

Summary

Adds pytest-cov to 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-missing so coverage is measured on every run.

New test files (11):

  • tests/agents/test_most_basic_agent.py — custom _CheatMiniWoBLLM_HTML that 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_benchmark
  • tests/agents/test_tool_use_agent.py — Block.make() cloning, StructuredDiscussion, MsgGroup
  • tests/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_indicator
  • tests/analyze/test_episode_to_html.py — HTML escaping and formatting helpers
  • tests/analyze/test_archive_studies.py — StudyInfo dataclass
  • tests/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, DataclassJSONEncoder
  • tests/benchmarks/test_abstract_env.py — timing decorator, AbstractBenchmark defaults
  • tests/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/load
  • test_reproducibility_util.py — uncommented and rewrote test_save_reproducibility_info to use current API (get_reproducibility_info + assert_compatible)
  • test_llm_utils.py — replaced commented-out rate limit tests with two new tests matching current retry() signature
  • test_study.py — changed test_launch_parallel_study from @pytest.mark.skip to @pytest.mark.pricy
  • test_generic_prompt.py — added 5 new tests for use_screenshot, use_som, enable_chat, use_thinking, use_action_history (previously marked TODO)

Updates since last revision

  • test_most_basic_agent.py: Replaced CheatMiniWoBLLMArgs with a custom _CheatMiniWoBLLM_HTML that parses bid="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 than cum_reward=1.0, since the first bid in HTML may not be the target button. Added max_steps=2 to prevent the test from running for 16+ minutes.
  • test_visual_agent.py: Removed the broken e2e test entirely. VisualAgent's Observation._prompt doesn'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 with pyproject.toml (includes pytest-cov).
  • Pre-existing CI failure: test_agent.py::test_llm_error_no_success fails on main as well — not introduced by this PR.

Review & Testing Checklist for Human

  • test_most_basic_agent.py custom cheat LLM — the _CheatMiniWoBLLM_HTML regex bid="(\w+)"[^>]*>.*?button finds the first bid near "button" text in HTML. If MiniWoB's click-test HTML 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 — calls Study.save(exp_root=...) and Study.load(result.dir). Verify these APIs exist and behave as expected; a mismatch will cause CI failure.
  • uv.lock diff — the lock file was regenerated with uv lock. The diff is large due to upload-time metadata being added to all entries. Verify no unintended dependency version changes were introduced.
  • test_llm_utils.py rate limit tests — both test_rate_limit_raises_on_persistent_error and test_rate_limit_propagates_immediately verify that RateLimitError propagates immediately from retry(). These are somewhat redundant. Consider if one should test generic_call_api_with_retries instead.
  • Pre-existing test_llm_error_no_success failure — this test fails on main and is unrelated to this PR. The agentlab CI check is not marked as required, so the PR is mergeable. Confirm this is acceptable.
  • Recommended test plan: Run 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-existing test_llm_error_no_success. Check the coverage report for meaningful improvement.

Notes

  • Several tests use 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.py TODO replacements: the use_thinking test disables both use_thinking and use_think_history; the use_action_history test also disables use_concrete_example and use_abstract_example. These test flag combinations rather than isolating individual flags. Verify this matches the intended coverage goals.
  • All new tests were verified locally (122 passed, 19 skipped for missing optional deps / MINIWOB_URL).

Link to Devin session: https://app.devin.ai/sessions/7a709614138c45958dc785b6c24f7249
Requested by: @lburgers


Open with Devin

- 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>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration Bot and others added 3 commits March 26, 2026 12:56
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>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

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>
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