Skip to content

feat(agents): local integration_test authoring agent - #586

Open
ayushnangia wants to merge 6 commits into
hud-evals:mainfrom
ayushnangia:fix/integration-test-agent
Open

feat(agents): local integration_test authoring agent#586
ayushnangia wants to merge 6 commits into
hud-evals:mainfrom
ayushnangia:fix/integration-test-agent

Conversation

@ayushnangia

@ayushnangia ayushnangia commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

The 01-coding-template documents hud eval <env-name> integration_test as the shipping check for every task: pre-stage the golden solution, run the graders, require Reward 1.0. Until now that agent only existed on the platform — the local CLI rejected the name (previously patched with a helpful error in #585). This PR implements the real thing locally.

What it does

  • AgentType.INTEGRATION_TEST + IntegrationTestConfig (no model, timeout_seconds bounds the staging pass).
  • IntegrationTestAgent — an Agent that makes no LLM calls: it opens the task's own MCP capabilities, replays every Task.validation tool call through them (recording ToolSteps like any other agent), and ends the trace with an empty answer so the environment's scenario graders grade the staged workspace. String-arguments steps are rejected without executing, unknown/invalid steps are skipped with warnings, and a missing-capability call surfaces as an error result.
  • Run.validationrollout attaches task.validation to the live run so the agent can consume it.
  • The authoring gate — after the rollout, the CLI enforces the documented contract: every run must grade Reward 1.0; anything lower (or a grading error) exits non-zero and names the failing reward/raw grade, so the authoring loop fails loudly instead of shipping a task whose golden doesn't pass its own hidden graders.
  • gateway_provider raises for this type (it's not a gateway shortcut — no LLM).

Validation

  • New tests: hud/agents/tests/test_integration_test.py (dispatch + ToolStep recording, empty-validation no-op, invalid-entry tolerance) and CLI tests (config accepts the name, the reward gate exits on <1.0 and on grading errors).
  • Full local suite: 392 passed (hud/tests + capabilities + patches + agents + cli).
  • ruff + ty clean.

Notes


Note

Medium Risk
Touches eval rollout, grading exit behavior, and remote command execution over MCP/SSH for golden staging; mistakes could block authoring or run unintended shell on workspaces, though scope is limited to the integration_test path.

Overview
Adds a local, no-LLM integration_test agent so hud eval <taskset> integration_test can serve as the documented shipping check: replay Task.validation through the task’s MCP or SSH capabilities, then let scenario graders score the staged workspace.

IntegrationTestAgent opens manifest MCP/ssh/2 bindings, coerces validation entries to MCPToolCall, dispatches tool calls (including bash -lc over SSH), records ToolSteps, and honors a configurable staging timeout. Invalid or unsupported validation steps are skipped with warnings; create_agent rejects this type as a gateway model shortcut.

Rollout and CLI: Run.validation is populated from task.validation during rollout. After eval, _enforce_integration_test_reward requires every run to reach reward 1.0 (or exits non-zero on grading errors), matching the authoring-loop contract.

AgentType.INTEGRATION_TEST, IntegrationTestConfig, and tests cover agent dispatch, SSH paths, config parsing, and the reward gate.

Reviewed by Cursor Bugbot for commit c9601f2. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread hud/types.py
Implements the 01-coding-template's documented authoring flow locally:
'hud eval <taskset> integration_test' now pre-stages the golden solution
by replaying every Task.validation tool call through the task's own MCP
capabilities, ends the trace, and lets the environment's scenario
graders run. The CLI enforces the authoring gate afterwards: every run
must grade Reward 1.0, otherwise the eval exits non-zero naming the
failing reward/raw grade.

Replaces the hud-evals#585 error path with the real implementation. No LLM calls;
timeout_seconds bounds the staging pass.
- validation calls dispatch through MCP capabilities and record ToolSteps
- empty/invalid validation entries degrade safely
- EvalConfig accepts integration_test
- the reward gate exits non-zero below 1.0 and on grading errors
@ayushnangia
ayushnangia force-pushed the fix/integration-test-agent branch from 5508c1c to d13314d Compare August 15, 2026 20:06
Comment thread hud/agents/integration_test.py
Comment thread hud/agents/__init__.py
Two gaps from Bugbot review of the integration_test agent:

1. SSH-published workspaces: the agent now opens ssh/2 bindings
   alongside mcp ones and runs bash validation steps via
   'bash -lc <command>' over SSHClient.run, converting the completed
   process into a ToolStep result (exit code -> isError).

2. create_agent now rejects INTEGRATION_TEST instead of hiding the
   non-LLM agent behind the gateway cast, mirroring gateway_provider.
- bash validation over an ssh/2 workspace records a ToolStep with
  the command output and success state
- non-zero SSH exit codes surface as error results
- create_agent('integration_test') raises instead of constructing
@ayushnangia

Copy link
Copy Markdown
Contributor Author

Thanks Bugbot — three findings, addressed on the new head f7c84bd:

  1. Missing config_cls arm (6943937d) — was on the first push only; the CI-hardening commit d45100b added the INTEGRATION_TEST arm + a case _ raise (the repo's ty check --error-on-warning lint caught it). No longer applicable on the current head.
  2. SSH golden staging (1858b6e9) — real gap for SSH-published workspaces, fixed: the agent now opens ssh/2 bindings alongside mcp ones and runs bash validation steps via bash -lc <command> over SSHClient.run, with the exit code mapped to isError. Note the coding-template itself publishes MCP (env.add_tool(bash_tool.mcp)), but SSH-publishing envs were indeed unserved — now both protocols stage correctly. New tests cover both directions.
  3. create_agent gateway cast (b904078c) — real; create_agent("integration_test") now raises (mirrors gateway_provider) with a pointer to hud eval <taskset> integration_test. Test added.

Full suite 395 passed, ruff + ty clean.

Comment thread hud/agents/integration_test.py Outdated
Pass the golden bash step to SSHClient.run as one remote command
string (asyncssh shlex-splits it, preserving the command's own
quoting, and ships it to 'bash -lc' as a single argument) instead
of three argv parts, which can lose grouping on space-join.
@ayushnangia

Copy link
Copy Markdown
Contributor Author

Fixed on c9601f2: _run_over_ssh now passes a single remote command string (bash -lc <command>), letting asyncssh shlex-split it while preserving the command's own quoting — the multi-arg form could lose grouping on space-join. Test updated to pin the single-string form.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c9601f2. Configure here.

# Single remote command string: asyncssh shlex-splits it, preserving
# the command's own quoting, and ships `command` to `bash -lc` as one
# argument (the codebase idiom; avoids multi-arg space-join hazards).
completed = await client.run(f"bash -lc {command}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SSH staging command misquoted

High Severity

Building the remote string as bash -lc {command} without shlex.quote does not pass the golden script as one -c argument. On ssh/2 workspaces, shell_argv already wraps the exec string in bash -lc, and working SSH tools just run the raw command. Typical validation steps with spaces or redirects therefore stage the wrong remote command, so the authoring gate can fail (or pass) for the wrong reason.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9601f2. Configure here.

@ayushnangia

Copy link
Copy Markdown
Contributor Author

Review-readiness summary, since the PR went through several CI rounds:

No rush — flagging only because the diff is now stable.

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