Repository navigation
Tests overhaul - #700
Tests overhaul#700
Conversation
The fake modal, daytona and asyncssh modules record every SDK call as plain data and connect each sandbox to an environment served in-process, so each acquisition row also runs a graded rollout. Tables cover image resolution, sizing, timeouts, secrets, Compose in a Docker VM with its uploaded archive, session transfer for images and Compose, snapshot builds that follow their image, the refusals each provider makes before creating a sandbox (the fake modal is always installed, so they never import the real SDK), and output streaming. test_docker_provider.py's rows now live in test_docker.py and test_cloud.py; the Harbor-only Compose relocation rows are left to the Harbor area.
One taskset carrying every row shape (template rows, metadata, full resources, TPU, a verifier with an explicit null, a local Compose project) is written to JSON and JSONL, snapshotted, and read back row for row. Every malformed row, runtime config, Compose project, bind mount and file is a row of one rejection table. Taskset.from_api runs against the fake platform by name, by id and for a vanished export, without patching make_request_sync. test_task.py's placement rows moved to the scheduler and tunnel files; test_sync.py's upload and diff rows belong to the CLI area's hud sync.
Rows run a rollout on env.workspace(track_files=True), a server predating setup diffs, an oversized deliverable, a large workspace, an untracked workspace, an unreachable tracker and telemetry off, then read the filetracking spans back from the local span file: their order, their schema and run id, and what each reports. The patched observer internals, settings and private frame constants go.
One scripted conversation sends text, a list of blocks, a turn with citations and a failing turn, asserting the replies, the snapshotted history, the prompt the environment saw and one job across every turn; a chat without a runtime keeps its user turn and says how to place it. The private content helpers and the child-process environment go. The multi-block turn fails: Chat stores it as a list of blocks, which the run's prompt normalization cannot read.
Chat keeps a user turn of several content blocks as a list, and chat environments yield it back as the prompt, but Run.prompt_messages validated the turn as one PromptMessage, which holds a single block, so every multi-block chat turn failed at task start. A turn now becomes one message per block, in order and with its role.
…ce row ty now passes over the rebuilt scenarios: rows minted by a live environment come from a typed template, SDK stand-ins are typed as what they stand in for, and identity rows pass their ids explicitly. The row asserting that an agent deadline kills a running workspace command depended on the workspace starting the command within a fixed budget and failed under coverage; the kill belongs to the workspace and agent areas, and the deadline itself stays pinned by the rollout table.
…holds stdout SubprocessRuntime learned that the child died only from stdout reaching EOF. A daemon started from @env.initialize inherits stdout, so a child that crashed after starting one left the runtime waiting out its 120 s ready timeout and raising a bare TimeoutError. Linux passed only because asyncio kills the daemon while the dying interpreter finalizes its transport. The port read now races the child's exit, and an exit without a port reports the exit code and output at once.
…narios REVIEW.md pointed reviewers at sandbox scenario rows the suite does not have.
Help, version, hud set, the text and --json error contract, platform error mapping, deprecation warnings and the upgrade notice now run the real hud CLI in a subprocess against the fake platform. The harness Hud gains start() for commands that run until signalled and a terminal width, so CLI snapshots fit the line limit.
Typer turns every failure into a bare sys.exit(code) before the invocation recorder sees it, so every event posted error_class null: a missing key, a usage error, an unknown command, a platform 403 and Ctrl-C alike. The recorder now walks the cause and context chain under the exits to the original exception. The analytics scenarios run real failing commands and a SIGINT against the fake telemetry service; the tests that fed the recorder hand-built exceptions are removed.
The jobs scenarios run the real CLI: table and quiet output, option placement around a bare job id, canonical links, malformed ids, and the cancel requests the platform receives. Cancelling without --yes in a non-interactive terminal and dry runs post nothing.
The local span reader looked for chat messages with role "tool" on tool steps, which a step never holds: a tool step carries the originating call and its MCP result. Local traces therefore listed agent turns only. The reader now emits one tool_call event per tool step with the tool name, arguments and result text, marking results flagged isError as errors. The scenario runs a rollout whose scripted model writes a file through a tool and reads the trace back with hud trace get.
QA scenarios run the real CLI: the checks table and its quiet and JSON forms, usage errors that post nothing, the run request body, waiting with real polling until every requested check settles, the exit status when any check fails, a real timeout, and how each result shape renders. The helper tests on presentation_for_result become rows of the results table.
The catalog table and its quiet and JSON forms, checkpoint and head commands addressing the model the catalog resolves (by id, name or slug), the PUT that promotes a head, forks with and without --if-not-exists, dry runs, and unknown models all run the real CLI against the fake platform.
hud project, project list, create and use, and hud sync env run against a fake platform whose Project search matches substrings the way the platform's does (the old fake ignored the search, so name resolution was never tested). Scenarios pin .hud/config.json after each step, refusal of a link made under other credentials or another origin, migration of the camelCase config, untouched corrupt and legacy files, and which Project a directory selects from its link, HUD_DEFAULT_PROJECT, or the team default. test_project.py's helper-level tests are replaced.
Deploy scenarios run the real CLI against a fake platform that hands out a presigned upload URL pointing back at the fake services, accepts the build trigger, streams build-log frames over a WebSocket, and reports the build status. They pin the trigger body (runtime provider and config, build args and secrets, environment variables, project, no-cache), the uploaded tarball for each .dockerignore pattern class with secrets never included, removal of the temporary tarball, the directory link across redeploys, the error document for every refusal before upload (including the non-interactive first deploy with a .env), rejected build requests, and a failed build, a refused or closed log stream.
The sync scenarios run the real CLI against a fake platform that keeps tasksets: lookup by name or id, export, and upload. One round trip plans, uploads, finds nothing to do, uploads an edit, follows a remote rename through the stored id with a bare hud sync, filters by --task, syncs to another taskset with and without --link, and never recreates a deleted stored taskset. Further tables pin exports to csv, json and jsonl, every refusal that uploads nothing, rejected uploads, Project placement without pinning the directory, the linked-environment mismatch warning, and hud sync env by name, id and search.
The eval scenarios run real rollouts: the CLI spawns each environment from files in a temporary project and the agent reaches a scripted model behind the fake gateway. Tables cover every project layout (hooks prove each rollout ran in a fresh process that shut down), environment selection by name, nested verifiers, attaching to a served environment over tcp://, task selection and grouping, and how the agent reaches its model: the key, model, max_tokens and temperature each request carries for gateway, provider-key, catalog-alias, TOML and custom-endpoint configurations. Dry-run plans and every invalid configuration are error documents that run nothing. The old tests replaced Taskset.run and asserted runtime types and mock identities.
hud eval --json counted error_count from job.errors (which includes runs whose grade is an error) but read runs[].is_error from the trace alone, so a run the environment graded as an error showed error_count 1 with every run is_error false, and the command exited 0. Each run's is_error now reports membership in job.errors, and hud eval exits 1 when any run errored while a low reward still exits 0. The CLI reference documents the exit status.
Task scenarios list a Python and a JSON source (text, quiet, JSON), start and grade tasks spawned from their source with --answer, --answer-file and stdin, attach with --url to an environment served in the test (a source resolving a slug to its template and args, or a raw id with --args), resume or refuse parked sessions, and pin each error document. The old tests called the private _resolve helper directly.
hud serve had no tests. The scenarios start it as a subprocess for a file, the default env.py, a module attribute and a factory with --arg, read the announced port, start and grade a task over the control channel, stop it with SIGINT and check the banner and the clean Stopped exit. A malformed --arg and a missing target are error documents.
Init scenarios copy each example from this checkout into a new directory and check the renamed Environment declaration and that caches are not copied; the blank example then runs under hud eval with a scripted model and earns its reward. Refusals (a non-empty directory, symlinks inside or as the target, an unknown example, nothing to create) leave every existing file untouched. The old tests called init_command directly and patched the module's __file__ and copytree.
Every contract these pinned now runs through the real hud CLI in the scenario files: the shell contract, analytics and notices in test_shell, jobs, trace, qa and models in their own files, init in test_init. What is dropped pinned private structure or mocks: main() calling a patched app, existence and help-prose checks, and a uv-tool install layout faked by patching sys.prefix.
test_workspace.py and test_capability_backing.py still patch hud internals; their counts may only fall from here.
The event reports sys.platform, so the row only held on Linux.
pydantic's message links to docs under its own version, which differs between locks.
The loader names a missing .py source as missing; the row predated that fix.
The uv image tagged python3.12-bookworm ships uv 0.9, below the project's required-version floor, so uv refused to run.
…e coding scenario in the Sandbox job Codex runs shell commands in its own bubblewrap sandbox, which Ubuntu 24.04 runners block until the userns sysctl is lifted; Live lifted it only after the agent scenarios, so Codex's commands failed and the workspace scenario graded 0. The coding template's live scenario now runs in the Sandbox job, which gets the HUD key, instead of a second copy of that job's container in Live.
The coding template's live scenario times itself out at 30 minutes, the whole Sandbox job's limit, so a stuck rollout would cancel the job before pytest reported it. The job now has the 45 minutes Live gave that scenario.
An eval with a few errored runs among graded ones still measured something, and exiting 1 for it would stop any script that chains on hud eval. hud eval now exits 1 only when every run errored; error_count and each run's is_error still mark the errored runs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33efa6a9c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Modal, Harbor and LeRobot ran only nightly, so a release could ship a commit they never ran on, and a red nightly blocked nothing. Pre-release now calls live.yml, so the gate runs the real-model, Modal, Harbor and LeRobot lanes on the commit it validates.
Repository secrets reach any branch's workflow; the pre-release environment serves its secrets only to main.
…e model The secret fixture's file was secret.txt in a hud-fixture-secret directory, and gpt-6-luna refused to read a file labeled secret in about half its runs, so the cell graded 0 although the shell worked. The file is now note.txt in a hud-fixture-note directory; eight sequential runs all scored 1.
Modal reads its config file once, when first imported, and a scenario imported modal while HOME was the test's empty home, so MODAL_CONFIG_PATH set afterwards went unread and a developer with only ~/.modal.toml got Token missing. The fixture now passes the file's active profile as MODAL_TOKEN_ID and MODAL_TOKEN_SECRET, which Modal reads on every call.
uv run --with adds lerobot to an overlay interpreter, but the pytest script runs the project's own, so every LeRobot scenario skipped and the nightly job passed with nothing run. python -m pytest runs under the overlay; all ten scenarios pass.
The fixture took only a profile marked active, so a file whose profile came from MODAL_PROFILE or was named default gave no token. It now follows Modal's order: MODAL_PROFILE, else the active profile, else default.
The Modal fixture and the collection check each decided on their own where a token comes from, and neither matched Modal: one followed a copy of its profile rules, the other took any config file as an account. Both now ask Modal, in a process with the real environment, which token it resolves; the fixture passes it as variables, since Modal reads its file only once, at import.
An eval with no tasks is refused before it runs, so a job reaching the exit rule always has runs; the guard only made an impossible empty job exit 0.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff57a54692
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The shared-network case asserted that the text "\tdb" was absent from /etc/hosts, and Docker writes the container's own hostname there, a random hex id; one starting with db failed the test. Entries are now parsed into address and name pairs and compared whole.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a4d35f2. Configure here.
The skip hook ran before -m deselected, so the default unit run probed Docker and Modal for e2e tests it would never run, and a malformed Modal config crashed its collection. The hook now runs last, after deselection, and the Modal probe leaves Modal's own error on stderr when a selected run hits one.
The shared-network case looked for db at 127.0.0.2, the address it gets only when its port is reserved; without that it would land on 127.0.0.1 and pass unseen. The test now reads each name's addresses, expects an address among them, and requires an absent name to resolve to none.

Rebuilds the test suite around what a user observes, runs it in lanes that match what each test needs, and fixes the product defects the new tests found.
Breaking changes
hud.agents.browser_use(BrowserUseAgent) and thehud[browseruse]extra are removed. The adapter now lives incookbooks/browser-useas an example of wrapping an agent framework over a capability; copy it into your project and installbrowser-usethere.PlatformClient.put()andPlatformClient.patch()are removed; nothing called them.get()andpost()take an optional reply type, andhud.imports.get_report()requires one.hudrequiresanthropic>=2.1,<3(andgoogle-genai>=2.30.1). anthropic 2.0 broke every Claude rollout on the old code.hud deploy,hud qa run,hud models fork,hud models head --setandhud project createnow confirm before acting. In a non-interactive terminal they refuse without--yes, ashud evalalready did; scripts calling them need--yes.hud evalexits 1 when no run was graded (every run errored); it exited 0 before. A job with some graded runs, or a low reward, still exits 0.Tests
hud/**/testsinto onetests/tree that mirrors the SDK's subsystems.SLF001now keeps tests offhudinternals.tests/fixturesholds fakes only for what CI cannot run: the HUD platform, model providers and the gateway, Docker, a DevTools endpoint, a screen, a scripted control-channel peer.tests/fixtures/envseach take every agent family to a known reward.hud inittemplate runs fromhud initto a graded rollout: scripted on every PR, on a real model in the live lane, and deployed to HUD in the release gate.tests/cli/test_every_command.pyholds every mutating CLI command to the--dry-run/--yescontract.CI
ci.yml(path-filtered): unit tests on 3.11 and 3.12, ruff, ty, Docker scenarios, the bubblewrap sandbox scenarios in a container with HUD's seccomp profile, and cookbooks.live.yml: real-model scenarios on PRs and main. Modal, Harbor and LeRobot run nightly and on dispatch. The live and Modal jobs fail without their credentials instead of skipping every scenario.live.yml, so every Live lane (real models, Modal, Harbor, LeRobot) runs on the commit being released.Fixes
Agents
computer_toolset_20260801toolset, which they require; older models keep the single computer tool.excluded_predefined_functionsthrough.ClaudeToolSearchTool.thresholddefers custom tools.AgentTool.from_config), replacing an untyped options dict.create_agent,hud evalandhud models listrequest a catalog model by itsmodel_name, the only name the gateway routes.Environments
hud servestops cleanly on SIGTERM and promptly when a session is still open..pysource, a template's ownKeyError, falsy non-objecttasks.startargs, a non-UTF-8task.toml, Composeinclude/extends.Eval
CLI and platform client
HudReplyError(exit 1) instead of surfacing as a usage error.hud eval --jsonreports errored runs consistently; a dry run reports the model from the toml section.hud traceoutput shows tool calls.Harbor and robot
hud harbor exportchecks every task before writing any.Docs
AGENTS.md,CONTRIBUTING.mdand the newREVIEW.mdset the test and review policy. The runtime, task, job, CLI and verifier references are updated to match the code.Note
High Risk
Large breaking surface (CLI confirmations, eval exit codes, removed browser-use extra, dependency floors) plus security-sensitive Docker/sandbox CI and widespread agent/runtime behavior changes.
Overview
Rebuilds validation around user-visible behavior: tests consolidate under
tests/(withtests/fixturesfakes), environment examples driveSubprocessRuntime+ the control channel instead of in-process mocks, and CI splits into path-filtered unit/lint (ci.yml: parallel pytest, Docker/sandbox/cookbook e2e lanes) plus a newlive.ymlfor gateway/Modal/Harbor/LeRobot and credential-gated scenarios. The pre-release gate deploys eachhud inittemplate via pytest hosted scenarios and reuseslive.ymlinstead of the old lifecycle shell script.Breaking / contract changes: removes
hud.agents.browser_useand thehud[browseruse]extra (adapter moves tocookbooks/browser-use); bumpsanthropic>=2.1and tightens gateway model resolution; mutating CLI commands (deploy,qa run,models fork/head,project create, etc.) now confirm or require--yes;hud evalexits 1 when no run received a valid grade.Product fixes bundled with the new tests: Claude computer toolset + deferred tool search; Gemini 3 desktop computer-use actions/coordinates; eval/job reporting (
Job.errors, evaluation subscore shaping); environment serving/cancel/teardown; Harbor/verifier docs and robot dataset frame limits; docs/policy updates inAGENTS.md,CONTRIBUTING.md,REVIEW.md.Reviewed by Cursor Bugbot for commit ba38aad. Bugbot is set up for automated code reviews on this repo. Configure here.