Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(engine): stop promising onReconnecting restarts at attempt 1

Yudhi Armyndharis6f4a0c5534c2
diff --git a/src/engine/interfaces/whatsapp-engine.interface.ts b/src/engine/interfaces/whatsapp-engine.interface.ts
index 18f8ec37b..38307cc2f 100644
--- a/src/engine/interfaces/whatsapp-engine.interface.ts
+++ b/src/engine/interfaces/whatsapp-engine.interface.ts
@@ -822,10 +822,13 @@ export interface EngineEventCallbacks {
* the credentials are still good. Purely informational, so a consumer must not tear anything down on
* it; the engine keeps owning the retry.
*
- * `attempt` is the 1-based number of the attempt being scheduled, and it resets once the connection
- * is back, a QR is scanned or a QR window runs out (or after a long enough healthy stretch), so
- * attempt 1 always opens a fresh episode. The close that ends an unscanned QR window is not a reconnect
- * and is never reported; any other close while a QR waits is.
+ * `attempt` is the 1-based number of the attempt being scheduled. An engine may carry it across a
+ * short-lived connection, so a link that drops right after opening keeps climbing the backoff; it
+ * resets on a scan, when a QR window runs out, or once the connection has stayed healthy for the
+ * engine's stability window. An episode can therefore start at attempt > 1 after a brief READY, so a
+ * consumer should treat the first attempt after a READY, not only attempt 1, as a new episode.
+ * The close that ends an unscanned QR window is not a reconnect and is never reported; any other
+ * close while a QR waits is.
* `nextDelayMs` is how long the engine waits before making it. Together they are what a consumer
* needs to tell a one-second blip from a session that has been down for an hour, which the status
* alone cannot: the engine reports INITIALIZING for the whole episode, exactly as it does for a