36 Commits
Author SHA1 Message Date
germondai 693d81b84e chore(deps): refresh release dependencies 2026-08-10 19:21:02 +02:00
germondai ff5756ca46 fix(browser): update pinned runtime assets 2026-08-10 19:20:57 +02:00
germondai ac79af388f perf(api): accelerate cold starts 2026-08-09 23:34:47 +02:00
germondai c0769af181 fix(browser): bound memory with rolling recycling 2026-08-09 18:15:48 +02:00
germondai 2547daa41b fix(browser): clarify Gluetun startup failures 2026-08-08 22:58:10 +02:00
germondai 097565a19f chore(release): prepare v1.3.1 2026-08-02 15:51:35 +02:00
germondai 8b54abd4a1 fix(browser): keep persistent contexts pool-owned 2026-08-02 15:37:47 +02:00
germondai 3a3226ed20 chore(release): prepare v1.3.0 dependencies 2026-08-02 03:07:04 +02:00
germondai 78836d6ed7 fix(proxy): support authenticated browser proxies 2026-07-27 03:08:16 +02:00
germondai 3a4d7491b3 Merge pull request #37 from funkypenguin/fix/bound-restart-and-reclaim-stalled 2026-07-27 02:40:41 +02:00
germondai f08f5a2b44 chore(release): prepare v1.2.0 2026-07-26 16:18:47 +02:00
germondai defade4324 refactor(browser): simplify optional pool state 2026-07-24 12:08:55 +02:00
germondai 3e26a7e990 feat(browser): add persistent context cache 2026-07-24 10:43:18 +02:00
germondai 2840af1d13 chore(release): bump all packages to v1.1.0 2026-07-22 23:13:17 +02:00
germondai 6223a4e593 perf: release v1.0.1 - slimmer image, faster boot, firefox telemetry/dead-feature prefs 2026-07-21 18:31:26 +02:00
David Young 7dae357103 fix(browser): bound every await in restartEntry; reclaim stalled checkouts
`BrowserPool.restartEntry` awaited `context.close()`, `browser.close()` and the
Camoufox launch with no timeout on any of them. Camoufox hangs on close when a
content process is wedged — tiers/3.ts and tiers/4.ts already guard their
*temporary* contexts against exactly this with a 5s `Promise.race` — but the
persistent context and browser the pool owns had no such guard, and launches can
hang too.

When any one of those hangs, the entry is pinned at `restarting = true` forever.
From then on the health check hits its own `if (entry.restarting) return` guard,
so every 30s tick logs "browser N disconnected, restarting" and does nothing.
The pool silently loses that slot permanently: `restartCount` never increments,
so the restart counter sits frozen while the log implies furious activity. With
enough uptime every entry ends up in this state and the pool is inert.

Changes:

  * every await in `restartEntry`, `init()` and `shutdown()` is bounded. On
    timeout the entry is left unhealthy with `restarting` cleared, so the next
    health-check tick retries it from scratch instead of wedging.
  * `runHealthCheck` reclaims checkouts past their deadline. Previously busy
    entries were skipped entirely, so an entry whose request wedged was never
    examined again.
  * a per-checkout `lease`, returned on the handle and passed back to
    `release()`, so a request that outlives its checkout cannot free — or
    recycle, via `noteTemporaryContext` — a browser the pool has since handed to
    someone else.
  * `release()` hands its in-flight page closes to `restartEntry` rather than
    racing them, since closing a context underneath in-flight `page.close()`
    calls is one way to wedge the transport in the first place.
  * abandoned launches are counted and capped. A timeout can only stop *waiting*
    for a launch, not cancel it, so retrying without a cap could pile up hung
    Firefox processes; past the cap the entry stays down and `live` reflects it.

Timeouts are configurable (`closeTimeoutMs`, `launchTimeoutMs`, `stallAfterMs`,
`healthIntervalMs`) with the API exposing them as BROWSER_*_MS env vars.

Adds regression tests for the hung close, the hung launch, stall accounting,
budget-aware stall deadlines, disconnected-but-busy entries, and stale releases.
The hung-close and hung-launch tests both fail against the unpatched pool.
2026-07-21 14:47:53 +12:00
David Young 961579724a fix(api): gate /health on real pool capacity, not available + busy
`/health` returns 200 as soon as `pool` is non-null, which happens before
`await pool.init()` has warmed any browser — so a readiness probe on /health
passes before the process can solve anything.

The obvious fix, `available + busy > 0`, is also wrong, and fails in a much
worse way. A request that hangs mid-solve never reaches the orchestrator's
`finally`, so it never calls `release()` and its entry stays `busy` for the life
of the process. `busy` therefore counts dead entries as capacity, and /health
can report 200/"ok" indefinitely on a pool with zero usable browsers — the
failure is completely invisible to any external check.

Adds `stalled` and `live` to PoolStats:

  * an entry is `stalled` once its checkout outlives the caller's own budget
    (req.maxTimeout, threaded through acquire()) plus a grace period, so a slow
    but genuinely live request is never miscounted
  * `live` counts entries that can serve work now or are genuinely mid-request:
    idle-and-connected, plus busy-and-connected-and-not-stalled

/health now gates on `live > 0`. A fully utilised pool still reports ready, so
this does not flap under load, but a wedged one cannot report ready at all.

`isUsable()` also checks `browser.isConnected()` rather than trusting the
`healthy` flag, which is only refreshed on the 30s health-check tick and is
never refreshed at all for busy entries.
2026-07-21 14:47:53 +12:00
germondai 6f96285544 chore(release): bump to 1.0.0 and backfill versioned changelog history
Splits the single [Unreleased] CHANGELOG block into dated 0.1.0-1.0.0
sections matching the milestone commits being tagged for issue #24
(numeric release tags), and bumps every package.json to 1.0.0.
2026-07-10 21:11:04 +02:00
germondai 040c7352fb chore(deps): bump typescript to v7 and update workspace dependencies 2026-07-10 19:19:35 +02:00
germondai 25fe9d739a feat(types): centralize BrowserHandle, BrowserFingerprint, SupportedMethod 2026-07-08 20:06:24 +02:00
germondai 973505b7f3 chore(browser): suppress noExplicitAny lint in pool.ts 2026-07-08 03:49:12 +02:00
germondai d7476274a2 feat(browser): randomize OS/screen/window per browser and match HTTP UA to platform 2026-07-07 02:32:12 +02:00
germondai bb062c6bd8 test(browser): cover recycle-on-blocked and contentProcesses options 2026-07-06 20:10:19 +02:00
germondai a307fe835d feat(browser): cap Firefox content processes via dom.ipc.processCount 2026-07-06 20:08:56 +02:00
CoolDotty 68ad2e0f1a Recycle browsers after temporary contexts 2026-07-06 00:47:32 -07:00
germondai df1cf47d08 fix(browser): support per-context proxy override in fresh contexts 2026-07-05 16:39:18 +02:00
germondai efaf0c96a0 feat(browser): make acquire timeout configurable, default 15s 2026-06-29 23:59:05 +02:00
germondai 6dd0a5867f chore: add .gitignore files for api, docs, web, and browser packages 2026-06-26 15:04:59 +02:00
germondai 1e6ca16dd0 test: add Cloudflare challenge bypass tests 2026-06-02 15:10:00 +02:00
germondai cc17320017 test: add camoufox stealth mode integration tests 2026-06-02 11:55:00 +02:00
germondai b235862fc2 test: add browser pool smoke tests 2026-06-02 09:20:00 +02:00
germondai 75dc6207ee feat: export browser package public API 2026-06-01 16:33:00 +02:00
germondai e84b274277 feat: add TLS and user-agent fingerprint randomization 2026-06-01 14:50:00 +02:00
germondai fd77a7de51 feat: implement browser pool with concurrency control 2026-06-01 12:05:00 +02:00
germondai eb9d626e70 feat: implement browser session lifecycle management 2026-06-01 10:18:00 +02:00
germondai 4c507a752c feat: initialize browser automation package 2026-06-01 08:35:00 +02:00