Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

chore: change default tag policy to lru

Luigi Agosti4b3a61dfa9b0
diff --git a/dashboard/src/types/index.ts b/dashboard/src/types/index.ts
index 4ccda04f..6945bbff 100644
--- a/dashboard/src/types/index.ts
+++ b/dashboard/src/types/index.ts
@@ -167,7 +167,7 @@ export const defaultBackendConfig: BackendConfig = {
userAgent: "",
noAnimations: false,
stealthLevel: "light",
- tabEvictionPolicy: "reject",
+ tabEvictionPolicy: "close_lru",
},
security: {
allowEvaluate: false,
diff --git a/docs/implementations/parallel-tab-execution.md b/docs/implementations/parallel-tab-execution.md
index b2995481..cc7e299c 100644
--- a/docs/implementations/parallel-tab-execution.md
+++ b/docs/implementations/parallel-tab-execution.md
@@ -253,9 +253,9 @@ Key functions introduced:
**Tab eviction policies** — PR #145 introduced configurable eviction when the
maximum tab count (`MaxTabs`) is reached:
-1. `reject` (default) — Return HTTP 429 when the limit is reached
+1. `reject` — Return HTTP 429 when the limit is reached
2. `close_oldest` — Automatically close the oldest tab (by `CreatedAt`)
-3. `close_lru` — Automatically close the least recently used tab (by `LastUsed`)
+3. `close_lru` (default) — Automatically close the least recently used tab (by `LastUsed`)
This is implemented through a `TabLimitError` type with HTTP 429 status and
timestamp tracking on each `TabEntry`.
diff --git a/docs/reference/config.md b/docs/reference/config.md
index 77c57ee9..697bae2c 100644
--- a/docs/reference/config.md
+++ b/docs/reference/config.md
@@ -137,7 +137,7 @@ Current nested config shape:
"maxTabs": 20,
"maxParallelTabs": 0,
"stealthLevel": "light",
- "tabEvictionPolicy": "reject",
+ "tabEvictionPolicy": "close_lru",
"blockAds": false,
"blockImages": false,
"blockMedia": false,
@@ -310,7 +310,7 @@ Valid enum values:
| --- | --- |
| `instanceDefaults.mode` | `headless`, `headed` |
| `instanceDefaults.stealthLevel` | `light`, `medium`, `full` |
-| `instanceDefaults.tabEvictionPolicy` | `reject`, `close_oldest`, `close_lru` |
+| `instanceDefaults.tabEvictionPolicy` | `reject`, `close_oldest`, `close_lru` (default) |
| `multiInstance.strategy` | `simple`, `explicit`, `simple-autorestart` |
| `multiInstance.allocationPolicy` | `fcfs`, `round_robin`, `random` |
| `security.attach.allowSchemes` | `ws`, `wss` |
diff --git a/internal/bridge/tab_manager.go b/internal/bridge/tab_manager.go
index 8276d1b1..f7fef892 100644
--- a/internal/bridge/tab_manager.go
+++ b/internal/bridge/tab_manager.go
@@ -227,12 +227,12 @@ func (tm *TabManager) CreateTab(url string) (string, context.Context, context.Ca
if evictErr := tm.closeOldestTab(); evictErr != nil {
return "", nil, nil, fmt.Errorf("eviction failed: %w", evictErr)
}
- case "close_lru":
+ case "reject":
+ return "", nil, nil, &TabLimitError{Current: len(targets), Max: tm.config.MaxTabs}
+ default: // "close_lru" (default)
if evictErr := tm.closeLRUTab(); evictErr != nil {
return "", nil, nil, fmt.Errorf("eviction failed: %w", evictErr)
}
- default: // "reject"
- return "", nil, nil, &TabLimitError{Current: len(targets), Max: tm.config.MaxTabs}
}
}
}
diff --git a/internal/config/config.go b/internal/config/config.go
index 5ef53c37..69cd3736 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -51,7 +51,7 @@ type RuntimeConfig struct {
UserAgent string
NoAnimations bool
StealthLevel string
- TabEvictionPolicy string // "reject" (default), "close_oldest", "close_lru"
+ TabEvictionPolicy string // "close_lru" (default), "reject", "close_oldest"
// Timeout settings
ActionTimeout time.Duration
@@ -520,7 +520,7 @@ func Load() *RuntimeConfig {
UserAgent: "",
NoAnimations: false,
StealthLevel: "light",
- TabEvictionPolicy: "reject",
+ TabEvictionPolicy: "close_lru",
// Timeout defaults
ActionTimeout: 30 * time.Second,
@@ -800,7 +800,7 @@ func DefaultFileConfig() FileConfig {
Mode: "headless",
MaxTabs: &maxTabs,
StealthLevel: "light",
- TabEvictionPolicy: "reject",
+ TabEvictionPolicy: "close_lru",
},
Security: SecurityConfig{
AllowEvaluate: &allowEvaluate,
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 52914d7b..0811f50a 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -102,8 +102,8 @@ func TestLoadConfigDefaults(t *testing.T) {
if cfg.AllocationPolicy != "fcfs" {
t.Errorf("default AllocationPolicy = %v, want fcfs", cfg.AllocationPolicy)
}
- if cfg.TabEvictionPolicy != "reject" {
- t.Errorf("default TabEvictionPolicy = %v, want reject", cfg.TabEvictionPolicy)
+ if cfg.TabEvictionPolicy != "close_lru" {
+ t.Errorf("default TabEvictionPolicy = %v, want close_lru", cfg.TabEvictionPolicy)
}
if cfg.AttachEnabled {
t.Errorf("default AttachEnabled = %v, want false", cfg.AttachEnabled)
diff --git a/pdev b/pdev
index 2811d5e6..6df2cbe3 100755
--- a/pdev
+++ b/pdev
@@ -17,7 +17,8 @@ NC=$'\033[0m'
# ── Commands ─────────────────────────────────────────────────────────
# name:emoji:description
COMMANDS=(
- "build:🚀:Build & run"
+ "dev:🚀:Build & run"
+ "build:🔨:Build the application"
"run:🏃:Run the application"
"check:🧪:All checks"
"test:🔬:All tests"
@@ -122,7 +123,8 @@ run_command() {
echo ""
exec docker compose -f tests/e2e/docker-compose.yml up --build --abort-on-container-exit
;;
- "build") exec bash scripts/dev.sh ;;
+ "dev") exec bash scripts/dev.sh ;;
+ "build") exec bash scripts/build.sh ;;
"run") exec bash scripts/run.sh ;;
"doctor") exec bash scripts/doctor.sh ;;
"hooks") exec bash scripts/install-hooks.sh ;;
diff --git a/scripts/README.md b/scripts/README.md
index b793a293..ea6352dc 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -19,6 +19,7 @@ Development and CI scripts for PinchTab.
| Script | Purpose |
|--------|---------|
+| `build.sh` | Full build (dashboard + Go) without starting the server |
| `build-dashboard.sh` | Generate TS types (tygo) + build React dashboard + copy to Go embed |
| `dev.sh` | Full build (dashboard + Go) and run |
| `run.sh` | Run the existing `./pinchtab` binary |
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100644
index 00000000..0536b374
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# Build Pinchtab and the embedded dashboard without starting the server.
+set -euo pipefail
+
+cd "$(dirname "$0")/.."
+
+./scripts/build-dashboard.sh
+
+echo "🔨 Building Go..."
+go build -o pinchtab ./cmd/pinchtab
+
+echo "✅ Build complete: ./pinchtab"
diff --git a/tests/testutil/server.go b/tests/testutil/server.go
index f71f1e83..cbd813d5 100644
--- a/tests/testutil/server.go
+++ b/tests/testutil/server.go
@@ -35,7 +35,7 @@ type ServerConfig struct {
Headless bool // default: true
Stealth string // default: "light"
MaxTabs int // default: 0 (uses config default: 20)
- TabEvictionPolicy string // default: "" (uses config default: "reject")
+ TabEvictionPolicy string // default: "" (uses config default: "close_lru")
// Security - all default to true for tests (unlike production defaults)
AllowEvaluate bool // default: true (tests need this)