Skip to content

test: always-on hub test VM (clean PC for remote-hub testing)#257

Merged
madarco merged 2 commits into
nightlyfrom
feat/hub-test-vm
Jul 26, 2026
Merged

test: always-on hub test VM (clean PC for remote-hub testing)#257
madarco merged 2 commits into
nightlyfrom
feat/hub-test-vm

Conversation

@madarco

@madarco madarco commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Why

Testing the remote hub (control box) needs a machine that is not this laptop: virgin ~/.agentbox, the published CLI, a real gh login that isn't mine. This adds that machine and its runbook.

What

  • scripts/hub-test-vm.sh — provisions and drives a persistent clean Ubuntu VPS on Hetzner (cx33/nbg1, node 20 + docker + git + gh + tmux, non-root dev). Subcommands: up · creds · install [nightly|latest|<ver>] · deploy · testrepo · reset · run · log · ssh · info · down.
    • The vault (/home/dev/testkit: provider keys, the test account's PAT, agent logins) lives outside ~/.agentbox, so reset wipes AgentBox state completely and re-seeds credentials in a second.
    • reset also destroys the boxes the VM created and the control box it deployed — identified by the ids in the VM's own control-plane/deploy.json, because the agentbox.role=control-plane label is also worn by a control box deployed from the laptop.
    • Provider keys copied are exactly PROVIDER_SECRET_KEYS from control-plane-deploy.ts, never the whole secrets.env.
  • docs/hub-test-vm.md — setup, the per-run reset, and the test matrix (A docker baseline, B e2b, C hub deploy, D hub-routed create + host-off push), plus gotchas. Linked from the CLAUDE.md doc map.

Verified live (nightly 0.28.0-nightly.202607260716, from virgin state)

Docker box on a clean Linux host (GHCR pull, web service, in-box push, destroy) · e2b bake · hub setup --deploy hetzner (healthz 200, CLI repointed) · custody + project push · hub-routed e2b create · adopt · agentbox-ctl git push with the VM's own relay stopped · reset back to virgin. Findings are recorded in the doc (hub create needs a base bake on one side; hub boxes <action> takes the id, not the name; agentbox url can't open a browser on Linux).

Docs-and-scripts only — no runtime code touched.

https://claude.ai/code/session_01Csib9o41p5RRUpmrPgPked


Note

Low Risk
Documentation and internal test automation only; no product runtime paths change. Operators should still treat reset/down and shared cloud accounts carefully to avoid accidental resource deletion.

Overview
Adds end-to-end remote-hub testing on a dedicated Hetzner Ubuntu VPS that simulates a clean user PC, without relying on laptop state.

scripts/hub-test-vm.sh provisions and drives that VM (up, creds, install/deploy, testrepo, reset, run via tmux, ssh, log, info, down). A credential vault at /home/dev/testkit survives reset’s rm -rf ~/.agentbox, so each run starts from virgin AgentBox state while provider keys (filtered to match PROVIDER_SECRET_KEYS), a separate test-account GitHub PAT, and agent login backups are re-seeded. reset tears down boxes by name (explicitly not prune, which could orphan-delete laptop sandboxes), removes the control box recorded in the VM’s own deploy.json, and optionally keeps the hub with --keep-hub.

docs/hub-test-vm.md documents setup, the per-run reset workflow, a test matrix (docker baseline, e2b, hub deploy, hub-routed create and relay-off push), first-pass results, and gotchas. CLAUDE.md links the new doc in the documentation map.

Docs and scripts only — no CLI, hub, or provider runtime changes.

Reviewed by Cursor Bugbot for commit 9c36830. Configure here.

madarco added 2 commits July 26, 2026 09:01
scripts/hub-test-vm.sh provisions a persistent clean Ubuntu VPS that plays a
user's PC: published CLI from npm, gh logged in as the test account, and a
credential vault outside ~/.agentbox so every run can start from virgin state.
docs/hub-test-vm.md is the runbook + test matrix.
…rst live pass

- pkill -f agentbox-relay matched the ssh command line running it, so reset
  killed its own session and stopped before the wipe; bracket the pattern.
- Retry the control box's firewall delete (it stays attached to the dying
  server) and treat 404 as gone.
- run/log subcommands: a long command needs tmux, an ssh nohup dies mid-pull.
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentbox-web Ready Ready Preview, Comment Jul 26, 2026 8:23am

Request Review

@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 default effort and found 3 potential issues.

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 9c36830. Configure here.

Comment thread scripts/hub-test-vm.sh

cmd_ssh() {
require_vm
if [[ "${1:-}" == "--" ]]; then shift; ssh_dev_tty "$@"; else ssh_dev_tty "$@"; fi

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 subcommand always allocates TTY

Medium Severity

cmd_ssh always calls ssh_dev_tty (ssh -tt), including for hub-test-vm.sh ssh -- &lt;cmd&gt;. That gives the remote command a pseudo-TTY, so it does not match the doc’s “no TTY” path for auto-skipping the first-run wizard.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c36830. Configure here.

Comment thread scripts/hub-test-vm.sh
[[ $# -gt 0 ]] || die "usage: $0 run '<command>'"
local session="${AGENTBOX_TESTVM_SESSION:-work}"
local proj="${AGENTBOX_TESTVM_PROJECT:-agentbox-hubtest}"
ssh_dev "tmux kill-session -t $session 2>/dev/null; tmux new -d -s $session 'cd ~/projects/$proj && $*'"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Run command breaks on quotes

Medium Severity

cmd_run embeds the user command inside single quotes in the remote tmux new shell line. Any single quote in the command terminates that quoting early and yields a broken or truncated remote command.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c36830. Configure here.

Comment thread scripts/hub-test-vm.sh
[[ -n "$sid" ]] && api DELETE "/servers/$sid" >/dev/null 2>&1 || true
[[ -n "$kid" ]] && api DELETE "/ssh_keys/$kid" >/dev/null 2>&1 || true
rm -rf "$STATE_DIR"
echo ">> done"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Down skips cloud box cleanup

Medium Severity

cmd_down deletes the test VM and local state after optionally tearing down the VM’s control box, but it never destroys AgentBox boxes on the VM first (unlike reset). Leftover docker/e2b/Hetzner resources can keep billing in the shared provider accounts.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c36830. Configure here.

@madarco
madarco merged commit 2f15d33 into nightly Jul 26, 2026
5 checks passed
@madarco
madarco deleted the feat/hub-test-vm branch July 26, 2026 08:27
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant