Skip to content

test: unit tests for agent_utils, most_basic, debug, visual and visualwebarena agents - #56

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/unit-tests-small-agents
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/unit-tests-small-agents

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Summary

Adds hermetic unit tests (123 tests, 5 new files, test-only — no src/ changes) for the small agents and agent helpers that had little or no coverage. The LLM is replaced by a fake BaseModelArgs dataclass whose make_model() returns a scripted callable, so retry/cost_tracker_decorator/asdict(chat_model_args) run for real. No network, browser, or API keys are used.

File Tests Covers
tests/agents/test_agent_utils.py 16 fns (+params) draw_mouse_pointer / draw_click_indicator (pixel-level: changes stay inside the expected box, center gap untouched, input not mutated), draw_arrowhead geometry, zoom_webpage with a MagicMock page (incl. <= 0 → ValueError)
tests/agents/test_most_basic_agent.py 10 args → agent wiring, prompt contents, CoT toggle, retry on a missing code block, ParseError after 3 tries, experiment_config
tests/agents/test_debug_agent.py 9 AgentArgs base defaults (set_benchmark no-op, set_reproducibility_mode → NotImplementedError), DebugAgentArgs.set_benchmark html toggle, obs_preprocessor (patched browsergym flatteners, deepcopy), get_action via patched input
tests/agents/test_visual_agent.py 37 make_instructions (goal/chat/extra instructions; multi-user-message warning), History, Observation (tabs/error visibility, screenshot vs SoM selection + detail), MainPrompt examples + _parse_answer, VisualAgent.get_action (n_retry inference, busted-retry path, history carry-over), agent_configs, tmlr_config (get_vision_agent/get_som_agent don't mutate BASE_FLAGS)
tests/agents/test_visualwebarena_agent_unit.py 24 image_data_to_uri (ndarray/bytes, alpha drop, bad format), parser, args naming + set_benchmark deepcopy, few-shot building for all 3 observation types (incl. embedded PNGs and the bad-format ValueError), get_action message layout, tab string, PREVIOUS ACTION, SoM overlay

Coverage (target modules)

Module Before (main, full suite) After (these files only)
agents/agent_utils.py 0% 100%
agents/most_basic_agent/most_basic_agent.py 0% 100%
agents/debug_agent.py 0% 95% (lines 21-22 are the except AttributeError around an f-string assignment, which can't raise)
agents/visual_agent/visual_agent.py 0% 100%
agents/visual_agent/visual_agent_prompts.py 0% 100%
agents/visualwebarena/agent.py 44% 100%
agents/agent_args.py 71% 100%
agents/generic_agent/tmlr_config.py 50% 100%

Bugs / xfails

I didn't find any source bugs, so nothing is marked xfail. Some behavior is pinned as-is:

  • draw_* helpers always return an RGBA image, even when given RGB.
  • DebugAgentArgs.set_benchmark only ever turns use_html on. It never turns it off.
  • retry appends the assistant reply to the message list in place, so AgentInfo.chat_messages (and MostBasicAgent's prompt_length stat) include the answer and any retry turns.

Run

uv run pytest tests/agents/test_agent_utils.py tests/agents/test_most_basic_agent.py tests/agents/test_debug_agent.py tests/agents/test_visual_agent.py tests/agents/test_visualwebarena_agent_unit.py -p no:cacheprovider -q        # 123 passed, ~4s
# also passes with -n 4 and with pytest-randomly (seeds 1-3)
uv run --with pytest-cov pytest <same files> -p no:cacheprovider -q --cov=src/agentlab/agents --cov-report=term-missing

Coverage used a path-based --cov=src/agentlab/agents. With module-name --cov=agentlab.agents.… flags, pytest-cov imports torch/numpy twice in this env and collection crashes.

Devin-Org: engineering

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/aa5b999c334747bca5b49bbc615e638f
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/aa5b999c334747bca5b49bbc615e638f?variant=devin
Requested by: @danigrim


Devin Review

Status Commit
⚪ Not started —

Run Devin Review

Devin Review (Staging)

… and visualwebarena agents

Co-Authored-By: Daniella Grimberg <daniella@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@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 bugs or issues to report.

Devin Review

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