Make agent-swarm domain-neutral and adaptive

This commit is contained in:
Emil Shanaty
2026-10-27 19:27:11 +03:00
parent 464b610bf1
commit 20497d9c0c
11 changed files with 191 additions and 58 deletions
+8 -3
View File
@@ -5,6 +5,11 @@ modals, dialogs that do not close, wrong DPI, a viewport that renders a blank ba
screenshot that captures a different agent's window. Treat visual verification as a separate test
tier with its own infrastructure.
The commands below use Linux Xvfb + ImageMagick as one concrete provider. On macOS/Windows use a
container or the platform's virtual-display tooling; the invariant is **isolation and deterministic
capture**, not Xvfb itself. If the app can capture its own framebuffer, that is preferred on every
platform.
## Rule zero: never share one desktop
Do not run several visual agents against the same X11/Wayland session. They steal focus, overlap
@@ -17,7 +22,7 @@ Each visual agent gets:
- its own display (`DISPLAY=:N` / Wayland socket),
- its own `HOME`, `XDG_CONFIG_HOME`, `XDG_RUNTIME_DIR`, `TMPDIR`,
- its own project copy/worktree and artifact directory,
- its own `CARGO_TARGET_DIR` (or a read-only prebuilt cache + writable per-agent target),
- its own build target/cache directory (or a read-only prebuilt cache + writable per-agent target),
- its own service port (BRP, dev server, websocket),
- a cleanup trap that kills the app, the X server and any helper processes.
@@ -66,7 +71,7 @@ export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json
# Start the app *after* the X socket exists. A small WM helps focus/IME.
sleep 0.5
# openbox & # optional
timeout 120s cargo run -p app -- --screenshot-mode "$ART/app.png" &
timeout 120s <run command> --screenshot-mode "$ART/app.png" &
APP_PID=$!
# Prefer an in-app deterministic screenshot. Fallback: capture the root window.
@@ -84,7 +89,7 @@ Containers are useful for reproducibility and cleanup, not as a default for ever
- Build one pinned image with Rust, Xvfb, Mesa/lavapipe, ImageMagick, xdotool and a minimal WM.
- Run one container per visual agent: `--rm --network=none --userns=keep-id`, no host `$HOME`, a
read-only repo mount plus a writable worktree/artifact mount.
- Keep cargo registry/cache in a named read-only volume; use a per-container target dir.
- Keep package-manager/build caches in a named read-only volume; use a per-container target dir.
- GPU: `--device /dev/dri` for Intel/AMD; NVIDIA needs the container toolkit/CDI. Prefer software
rendering for UI tests and reserve GPU containers for one final Tier 3 run.
- Limit visual containers to 2–4 concurrently; llvmpipe uses CPU aggressively.