A ViteHub Agent that repairs pull requests, waits for checks and merges the ready ones. It extends ViteHub's Babysitter preset, which owns webhook intake, the durable PR queue, checkouts, CI evidence, repair tools, budgets and merge checks. This repository only configures it:
| File | What it sets |
|---|---|
server/agents/babysitter/agent.ts |
Repositories, authors, merge policy, budgets and model |
server/agents/babysitter/instructions.md |
Our house rules, added to the preset's repair prompt |
server/agents/babysitter/config.ts |
The environment variables that agent.ts reads |
vite.config.ts |
Node host, Agent State, observability |
Who and what to trust comes from the environment:
BABYSITTER_MAINTAINERS: logins whose PRs get repaired and squash-merged. Without it, the worker takes PRs from the repositories' owners, members and collaborators, and ignores the two lists below.BABYSITTER_CONTRIBUTORS: outside contributors. Their PRs get the same repairs, but merge only after someone with write access approves the current head.BABYSITTER_BOT_AUTHORS(defaultrenovate,dependabot): bots whose PRs get worked. Add your GitHub App's name if it opens PRs.BABYSITTER_REVIEW_CHECKS(default none): the check names an automated reviewer posts.
.env.example lists the rest.
Fork this repository and edit instructions.md for your reviewer. Then:
-
Create a GitHub App under Settings → Developer settings → GitHub Apps.
- Webhook URL:
https://<your-host>/api/webhooks/github, with a random webhook secret. - Repository permissions: Contents, Pull requests, Issues and Checks read and write; Actions,
Commit statuses and Metadata read. Add Workflows write if repairs may touch
.github/workflows. - Events: Pull request, Pull request review, Pull request review comment, Pull request review thread, Issue comment, Check run, Check suite, Status, Push and Workflow run.
- Generate a private key and install the App on the repositories to watch.
- Webhook URL:
-
cp .env.example .envand fill in the required values. -
Start it and log Codex in once. The login lands in the
/datavolume.docker compose up -d --build docker compose exec babysitter codex login --device-auth curl -fsS localhost:3000/api/_vitehub/host/health
Expose only /api/webhooks/github to the internet, through a reverse proxy or tunnel. To read the
queue and sessions in the ViteHub Console, link the
app there and set the VITEHUB_CONSOLE_KEY_<NAME> line it shows.
To restart without interrupting running passes, drain first:
docker compose kill -s SIGUSR2 babysitter
until curl -s localhost:3000/api/_vitehub/host/drain | grep -q drained; do sleep 10; done
docker compose up -d --build --force-recreatevite-hub's own Babysitter runs as the babysitter-vitehub systemd service on Slimbook. Its settings
live in drop-ins under /etc/systemd/system/babysitter-vitehub.service.d/. Deploy a merged commit with
scripts/deploy.sh from a clean origin/main checkout: it builds, stages a release directory, drains
the service and restarts it. Before you run it, check that no other deploy is draining
(pgrep -af '^bash scripts/deploy.sh').
On any host, Agent State goes to .vitehub/agent-state.db under the working directory. Set
VITEHUB_AGENT_INVOCATIONS_DATABASE_URL too, such as file:/srv/babysitter/.vitehub/invocations.sqlite:
without it, the Console journal lands in the build checkout. Run one process per data directory.
Set BABYSITTER_REMOTE_HOSTS to user@host:slots entries, such as svc-fleet@servarica:2, and a
pass that this host's memory admission cannot take runs on that host. Without it, every pass runs here.
The worker reaches the host over SSH (Tailscale SSH needs no key) and keeps the queue, the checkout and
the GitHub credentials. The host gets git objects through a mirror under ~/.vitehub-fleet, installs
from its own pnpm store, and runs Codex there. Codex reaches the worker's tool endpoint and a model relay
on this host through SSH reverse tunnels bound to the host's loopback. The relay accepts a random token
per pass, swaps it for the key of the provider that the worker's Codex config selects, and refuses it once
the pass ends, so the real key never leaves this host. The remote Codex config holds only that
provider's allowlisted settings, and commands Codex runs see the token empty.
The host needs git, codex and pnpm (in ~/.local/bin or on PATH), setsid, flock and tar.
Before each remote pass the worker checks its free disk (4 GiB), memory pressure (10%) and memory,
admitting (available - 2 GiB) / 2.5 GiB passes, where available is the smaller of MemAvailable
and the user's cgroup memory.high headroom. The same check removes Boxes, and kills their processes,
that no running pass owns. BABYSITTER_REMOTE_MIN_FREE_BYTES, BABYSITTER_REMOTE_MAX_MEMORY_PRESSURE,
BABYSITTER_REMOTE_RESERVE_BYTES and BABYSITTER_REMOTE_PASS_BYTES change those limits.
PR checks run the fast suites and main runs the full ones, so PRs that each pass can break main
together. Set BABYSITTER_MAIN_REPAIR_REPOS and, when a workflow in BABYSITTER_MAIN_REPAIR_WORKFLOWS
(default ci) fails on one of those repositories' default branch, the worker opens a
babysitter/repair-main-* PR and repairs it first. This is the preset's
mainRepair; the App needs
the Workflow run event and Actions write access.
package.json pins a pkg.pr.new build of ViteHub main, and the overrides in pnpm-workspace.yaml
keep every @vite-hub/* package on that commit. To upgrade, pick a main commit whose ci and
pkg.pr.new runs passed, replace the SHA in both files and run pnpm install.
Fix ViteHub bugs in ViteHub and upgrade to the commit that has the fix. Don't patch the installed packages here.