v1.3.9 — data-loss & stability fixes
A stability-focused release driven by a performance/reliability code review, plus two community contributor PRs.
🐛 Fixes
- Silent persistence data loss when ClickHouse degrades — when ClickHouse was healthy the SQLite write was skipped, but the in-memory batch was cleared before the async ClickHouse write was confirmed, so a failed write (queue full / partial-table / timeout) lost the data. The collector now writes the batch to SQLite as a durable fallback on ClickHouse failure; a full queue counts toward "unhealthy"; and health resets only after a complete detail+agg batch so a persistently-failing table can't mask the outage.
- Agent under-counted traffic on counter resets — the Go agent dropped traffic to zero when a flow counter went backwards (gateway restart / id reuse); it now counts the current value as new traffic, matching the direct collector.
- Deleting a backend left orphaned data —
PRAGMA foreign_keysis OFF so the declaredON DELETE CASCADEnever fired;deleteBackendnow explicitly removes all associated data. - #65 — Collector didn't recover after a backend password change — the socket is now torn down synchronously before flushing, so it can't reconnect with the stale token.
- #61 — WebSocket port env vars had no effect —
runtime-config.jsis now loadedbeforeInteractive, servedno-store, and excluded from the PWA precache, soWS_EXTERNAL_PORTtakes effect instead of falling back to the build-time default. - #67 — Mihomo proxy groups parsed as rules (PR #68, thanks @cesaryuan) — rule names now use the real matched rule via a shared helper.
- #74 — Collector silently hangs, stops syncing (PR #76, thanks @zj1123581321) — adds a WebSocket heartbeat watchdog that detects silently-dropped TCP connections and reconnects.
⚡ Improvements
- WebSocket reconnect now uses exponential backoff with jitter (reset on connect) to avoid reconnect storms; the Surge collector's backoff also gains jitter. Tunable via
WS_MAX_RECONNECT_INTERVAL_MS(default 60s).
Full changelog: CHANGELOG.en.md · Agent binaries: agent-v1.4.4
🤖 Generated with Claude Code