Repository navigation
Description
Parent: #17
Goal
Add a first-class browser session that launches real headed Chrome inside a private PickLab Xvfb display and exposes a safe, stable lifecycle contract for visual control and the later DevTools relay.
Shared session contract
Add SessionType = "browser" with ID prefix brow. One browser record owns both legs:
desktop: display, PID, width, height, optional VNC metadatabrowser:browserPid,browserStartTimeTicks,binaryPath,profileMode: "ephemeral",profileDir,cdpPort
Do not persist the DevTools websocket path/GUID or a separate desktop session ID. Existing session status remains lifecycle-only; human control is not stored there.
Session resolution becomes capability-based:
- desktop tools accept records with a desktop leg, including browser sessions
- browser relay requires a browser leg
- Android tools require an Android leg
- implicit resolution is project-local and succeeds only for exactly one live candidate
- missing, dead, wrong-capability, and ambiguous selection fail closed
Browser lifecycle
- Detect supported Chrome/Chromium binaries with actionable errors.
- Create a private Xvfb and ephemeral profile under the session directory.
- Launch with argv arrays and
shell:false. - Use explicit loopback binding,
--remote-debugging-port=0, and read<profile>/DevToolsActivePort. - Never borrow a personal browser profile.
- Use
cleanEnv:truewith a small allowlist: display, isolated HOME/XDG paths, PATH, locale, and required runtime variables. - Track process identity using PID plus
/procstart ticks. - Terminate the whole verified process group, confirm it is dead, then delete the profile.
- Partial startup failure and stale-session reaping perform the same cleanup.
Security posture
Chrome and CDP still run as the invoking user. This is accepted for v1 only with explicit SECURITY.md documentation: loopback is not isolation from local processes and PickLab is not a hostile-web sandbox. Track uid isolation and --remote-debugging-pipe separately.
Checklist
- PR 2 — session/process contracts
- Browser binary detection and package
- Ephemeral profile confinement
- Port
0+ DevToolsActivePort discovery - Scrubbed launch environment
- Create/status/destroy/reaper lifecycle
- Existing session CLI/MCP wiring for type
browser - Concurrent-session and partial-failure tests
- SECURITY.md, README, and
docs/releases/UNRELEASED.md - PR/review
Validation
bun run typecheck- focused core/browser/CLI/MCP tests
bun run testbun run test:coveragebun run build- headed Chrome under Xvfb in CI
- two sessions get distinct displays, ports, and profiles
- CDP listens only on loopback
- planted environment secrets are absent from the browser process
- destroy/reap leaves no process-group members and removes the profile
- cancellation and every partial-failure point clean up
No feature flag: the new session type is independently releasable and current defaults remain unchanged.
Current status: In progress
Next: land the shared browser/session/process contract PR.
Activity
ElbertePlinio commentedon Jul 12, 2026
Implementation started:
Branch:
feat/browser-session-contractsCurrent status: In progress
ElbertePlinio commentedon Jul 12, 2026
PR 2 opened: #24
Current status: In review
ElbertePlinio commentedon Jul 12, 2026
PR 2 review status (#24):
Per review policy, no fifth round will run and #24 will not merge. The ordering fix is required in the active browser lifecycle branch before #18 can proceed.
Current status: Blocked / PR left open
ElbertePlinio commentedon Jul 12, 2026
Recovery started:
#24 remains open and unmerged until the replacement is ready.
Current status: In progress
Next: open the replacement contract PR.
ElbertePlinio commentedon Jul 12, 2026
Progress update:
PR #24 was closed as superseded.
Current status: In progress
Next: rebase and ship the completed Chrome lifecycle slice.
ElbertePlinio commentedon Jul 12, 2026
Chrome lifecycle PR opened: #28
Current status: In review
ElbertePlinio commentedon Jul 13, 2026
Current lifecycle HEAD pushed to PR #28:
104db9d.Current status: CI queued
Next: merge only after current-head CI is green.
ElbertePlinio commentedon Jul 13, 2026
CI follow-up: PR #28 is now at
02c444b.The previous current-head run exposed two deterministic-test issues; both were root-caused, fixed, stress-tested, and independently reviewed. Full local suite is green again: 63 files, 705 passed / 2 skipped.
Current status: waiting for required CI on
02c444bNext: merge only after that run is green.
ElbertePlinio commentedon Jul 13, 2026
PR #28 merged at
eddf853after current-head CI passed.Current status: Done