# End-to-end: bot mode on a throwaway workspace ```bash cargo build --release --target x86_64-unknown-linux-musl tests/e2e/run.sh # or: tests/e2e/run.sh path/to/midas ``` A workspace of one, on this machine, that touches nothing of the real one: - **a hub**, `midas hub serve`, unprivileged on a free loopback port, with its own state directory (`MIDAS_STATE`) and caller file (`MIDAS_CALLERS`); - **a node**, `midas-e2e-node`, built from `node/Containerfile` by rootless podman with this midas in it, its sshd published on another loopback port, its fence (`entrypoint.sh`) up as on a real node; pasta forwards the hub's port from the container's loopback, so the hub sees the node at 127.0.0.1, the address it is defined with; - **an agent**: its own `HOME`, `MIDAS_HUB` and key, a worktree `wt-e2e` holding a toy bot (`fakebot.py`, MCP on a Unix socket after a few seconds of "building") and its relay (`relay.py`), and ssh through a wrapper that adds `-F` with the config `midas ssh-config --flush` wrote — `Match` hooks included. What it drives: a build lease refusing a bot; `midas bot start` (the flush carries the toy bot to the node, readiness is retried until it answers); `status`, `mine` and `status --json` showing a bot lease; `midas bot mcp` under `client.py`, an MCP client that initializes, lists and calls tools through ssh and fails on anything but JSON-RPC on stdout, and checks the owner's secret (`bot.env`, 0600, the container's `build` user) reached the bot; `midas bot stop` releasing the node and leaving no bot process or record; the heartbeat reporting a bot and stopping one whose lease was released at the hub; a new holder's handover clearing a bot left behind; and that the secret's value appears in no event. Not covered, because they need root: the machine's firewall (`sudo midas setup`) and `sudo midas bot setup` itself (its file is written the way it writes it, with `podman unshare chown`). Everything is named `midas-e2e-*` and removed on exit, the temporary directory too. The image is kept, so the next run builds in seconds; `E2E_REMOVE_IMAGE=1` removes it. Where rootless podman also runs a distrobox, `E2E_DISTROBOX` (default `arch`) names it so its root is mounted back after each build and removal. A run takes about three minutes, most of it waiting for heartbeats (one a minute).