9c573f1e3c
Decisions, environment quirks and pitfalls learned while working on AgentHub (docs/claude-memory/, indexed by MEMORY.md). Notes holding personal account details are left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
name, description, metadata
| name | description | metadata | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| agenthub-sandbox-browser-repro | How to reproduce an AgentHub UI bug in a real browser without the user's login or tmux — isolated server + build + playwright-core |
|
Both live dashboards (:4820, :4830) need a login, and the user's tmux must never be touched (see never-tmux-kill-server). Recipe used 2026-10-10:
~/.cache/agenthub-repro/env.sh: HOME, DASHBOARD_DATA_DIR, TMUX_TMPDIR, AGENTHUB_SETTINGS_FILE, XDG_* all under that dir, DASHBOARD_PORT=4899,DISABLE_AUTOUPDATER=1(a sandboxedclaudemust not update the real install), unset TMUX/TMUX_PANE/AGENTHUB_MODE/AGENTHUB_*/CLAUDECODE. Local mode = no login.mkdir -pthe TMUX_TMPDIR first. A missing TMUX_TMPDIR makes tmux silently fall back to the REAL default socket (2026-10-13: sandbox panes landed beside the user'sagenthub-lane-2/3, slot numbers interleaved with theirs). After the first start, verify<TMUX_TMPDIR>/tmux-<uid>/defaultexists andtmux -S /private/tmp/tmux-501/default lsgained nothing. Keep it SHORT (mktemp -d /tmp/ahp.XXXX): a socket path over ~104 chars (the session scratchpad is) fails everynew-session.- macOS (this Mac): playwright-core installed in the session scratchpad; Chrome at
~/Library/Caches/ms-playwright/chromium-1228/chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing. Route/api/lanes/pick-pathto 403 EREMOTE in the page, or a loopback browser opens a real osascript dialog. - Log redirects need ABSOLUTE paths (after
source env.sh,~is the sandbox HOME). - vite dev hits EMFILE (inotify) here: build instead,
vite build --outDir ~/.cache/agenthub-repro/dist, serve withDASHBOARD_CLIENT_DIST. - Workspace:
POST /api/lanes/ensure {cwd}; panes:POST /api/lanes/1/start {slot:"auto"}(needsOriginheader) → bare unauthenticatedclaudewith a real--session-id, so Chat UI works and no quota is spent. - Browser:
require("~/.npm/_npx/e41f203b7505f1fb/node_modules/playwright-core")+executablePath~/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome; HTML5 drag works withlocator.dragTo. - A production-mode sandbox server spawns a TRAY ICON (
scripts/tray.js) that outlives the server by design → extra icons in the macOS menu bar (2026-10-13: user saw 3). Start the sandbox with<data dir>/runtime/tray-offcreated first, or on teardown kill tray.js pids whose environ hasDASHBOARD_PORT=4899. - Teardown:
tmux -S <sandbox socket> kill-session -t =nameper session (list first), kill the 4899 pid only after checking its environ's DASHBOARD_DATA_DIR. Neverpkill -fa string your own command line contains.