You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1][bug] auto-reconnect on launch is a single-shot try/catch; no backoff, no surface, no HealthChecker (FR-1.2.4 / ARCHITECTURE §3.1 HealthChecker) #276
DESIGN_REQUIREMENTS §FR-1.2.4 mandates exponential backoff (1s/2s/4s/8s/16s/30s capped) and user notification. ARCHITECTURE §3.1 describes a HealthChecker background task emitting connection_lost events.
Problem
ConnectionTabs.tsx:41-77 calls connect() once per open profile on mount and the error path is catch {} (no surface). Tabs are left in profileId-only state — execute_query later fails with CoreError::NotFound instead of "reconnect attempt failed at startup". ARCHITECTURE's HealthChecker and connection_lost event are never emitted from anywhere.
src-tauri/src/commands/mod.rs (no health-check command)
docs/design/ARCHITECTURE.md:226-229, §5.7 (planned but unimplemented)
Repro
Open SQLPilot with a query tab active against MySQL on 13306.
docker stop mysql-test-container for >30s.
The query tab stays in normal-looking state; any query yields "Connection not found" only when run.
Expected
Within 5s of MySQL going down, the tab turns yellow with "Reconnecting…". Within 30s of MySQL returning, the tab is green and a follow-up query runs cleanly. A toast/info banner explains if reconnect ultimately fails.
Proposed fix
Scope L. Backend: tokio interval task per active connection running SELECT 1, tracking consecutive failure count, emitting a Tauri connection_lost event past a threshold. Frontend: subscribe via listen(), surface "Reconnecting…" per tab badge, run exponential-backoff reconnect loop until success or user abort.
Acceptance
Kill DB-side connection mid-session; within 5s UI shows reconnecting state; DB-up recovery happens within 30s without user action; the named integration test test_auto_reconnect from TESTING_STRATEGY §4 lands.
Closed by #660 — recording what was added beyond the surfacing that was already in.
The HealthChecker exists now. One task per connection pinging SELECT 1 every 15 seconds, backing off to FR-1.2.4's schedule — 1s, 2s, 4s, 8s, 16s, then 30s — from the first failure until one succeeds. The status bar turns its dot red, says "Lost — retrying (3)", and carries the server's own words in the title. Your repro now shows the tab as lost within fifteen seconds of docker stop, instead of at the next query.
The task ends when the connection is removed from the manager, because the stop channel is owned by the entry — no second registry to fall out of step with reality.
Two departures from what the docs promised, both now written down:
No explicit reconnect step. sqlx opens a fresh pooled connection when one is next asked for, so a server that comes back is usable without anything being torn down or re-established. "Triggers reconnection on failure" would have been a second mechanism racing the pool's own.
No jitter, despite ARCHITECTURE's + jitter(0–500ms). Jitter stops a thousand clients retrying in lockstep; a desktop client with a handful of connections has no herd to disperse.
connection-health-event is in §5.10's event table now — which had listed nine events, six of which did not exist.
Activity
fix(connection): say which server failed, and what ran out (#528)
EVWorth commentedon Sep 12, 2026
Closed by #660 — recording what was added beyond the surfacing that was already in.
The HealthChecker exists now. One task per connection pinging
SELECT 1every 15 seconds, backing off to FR-1.2.4's schedule — 1s, 2s, 4s, 8s, 16s, then 30s — from the first failure until one succeeds. The status bar turns its dot red, says "Lost — retrying (3)", and carries the server's own words in the title. Your repro now shows the tab as lost within fifteen seconds ofdocker stop, instead of at the next query.The task ends when the connection is removed from the manager, because the stop channel is owned by the entry — no second registry to fall out of step with reality.
Two departures from what the docs promised, both now written down:
No explicit reconnect step. sqlx opens a fresh pooled connection when one is next asked for, so a server that comes back is usable without anything being torn down or re-established. "Triggers reconnection on failure" would have been a second mechanism racing the pool's own.
No jitter, despite ARCHITECTURE's
+ jitter(0–500ms). Jitter stops a thousand clients retrying in lockstep; a desktop client with a handful of connections has no herd to disperse.connection-health-eventis in §5.10's event table now — which had listed nine events, six of which did not exist.