v1.2.0

jo-inc/camofox-browserv1.2.0Feb 17, 2026by skyfallsin

AI Summary

Implements a lazy browser lifecycle to reduce memory usage and adds reliability features like concurrency limits and auto-reconnect.

Key Highlights

  • Lazy Browser Lifecycle launches on the first request and shuts down after 5 minutes of idle time.
  • Per-user concurrency limits and handler timeouts prevent single sessions from starving the server.
  • Browser auto-reconnect detects dead sessions and relaunches automatically.
  • New configuration environment variables for timeouts and heap size management.

New Features

  • Lazy browser lifecycle
  • Reliability improvements
  • New configuration variables

Full Release Notes

Before 1.2.0, camofox-browser kept Firefox alive 24/7 — ~550MB resident even with zero users. That's fine on a dedicated server, not so much on a Raspberry Pi, a $5 VPS, or Railway's shared infra.

Now the browser sleeps. It launches on the first real request, shuts down after 5 minutes idle, and relaunches instantly when needed. Health checks won't wake it. Combined with the V8 heap cap (default 128MB), idle memory drops to ~40MB.

If a page hangs, it gets killed — not the server. Per-user concurrency limits mean one heavy session can't starve everyone else. The server stays responsive even when individual pages don't.

Designed to share a box with the rest of your stack.

### Lazy Browser Lifecycle
- Browser launches on first request, not at startup
- Idle shutdown kills the browser after 5 minutes with no active sessions. Next request relaunches automatically.
- Health checks are passive — `/health` reports state without waking the browser
- Launch mutex prevents double-launching on concurrent requests
- 30s launch timeout prevents a hung process from blocking the server

### Reliability
- **Handler timeouts** — 30s cap on navigate, snapshot, click, back, forward, refresh, act
- **Per-user concurrency** — max 3 concurrent requests per user with queuing
- **Safe page close** — 5s timeout cap on `page.close()`
- **Browser auto-reconnect** — detects dead browser, clears stale sessions, relaunches
- **ariaSnapshot hardening** — 5s timeout, returns empty refs on failure instead of propagating
- **Navigate auto-creates tabs** — unknown tabId creates a session+tab instead of 404

### New Configuration

**Environment variables:**

| Variable | Default | Description |
|----------|---------|-------------|
| `HANDLER_TIMEOUT_MS` | `30000` | Max time for any handler |
| `MAX_CONCURRENT_PER_USER` | `3` | Concurrent request cap per user |
| `BROWSER_IDLE_TIMEOUT_MS` | `300000` | Kill browser when idle (5min) |
| `MAX_OLD_SPACE_SIZE` | `128` | Node.js V8 heap limit (MB) |

**OpenClaw plugin config:**
```json
{
  "browserIdleTimeoutMs": 300000,
  "maxOldSpaceSize": 128
}
```

### Thanks
- [@daijro](https://camoufox.com) for Camoufox