Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): start a session whose QR status has no engine

Yudhi Armyndharis814fdbc62cfd
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 153e1f047..2450ea418 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The webhook docs state that at the default limits media above about 768 KiB reaches webhooks as the omitted marker, and how to raise both limits ([#1569](https://github.com/rmyndharis/OpenWA/issues/1569)). Thanks @Magnarks for the report.
- The takeover sweep marks as disconnected any session left `ready`, `initializing`, `authenticating` or `action_required` by a node that never returned, regardless of `AUTO_START_SESSIONS`.
- The takeover sweep also marks a lapsed `qr_ready` session with no phone as disconnected; one with a phone keeps its status.
+- Reconnect on a dashboard session card that reads `initializing` or `qr_ready` with no engine loaded starts the session, instead of opening a QR modal that never receives a code.
- Branch Docker images (`:main`, sha tags) rebuild the production stage without the build cache, so they cannot serve stale OS packages.
- The Docker image upgrades the Debian packages inherited from the digest-pinned `node:22-slim` base at build time, so security fixes published after the base snapshot reach them; this clears CVE-2026-86145 and CVE-2026-89161 in `libpcre2-8-0`.
- The Message Tester's bulk-recipients file picker refuses files over 2 MB before reading them.
diff --git a/dashboard/src/pages/Sessions.test.ts b/dashboard/src/pages/Sessions.test.ts
index 22124f04d..a3431c0e3 100644
--- a/dashboard/src/pages/Sessions.test.ts
+++ b/dashboard/src/pages/Sessions.test.ts
@@ -456,6 +456,28 @@ test('stopping a session dismisses its own open QR modal', async () => {
});
});
+// A node that died mid-pairing leaves a row reading `qr_ready` with no engine behind it. Reconnect on
+// that card has to start the session: the QR modal alone polls GET /qr, which answers 400 until one
+// is started.
+test('Reconnect on a qr_ready card with no engine loaded starts the session', async () => {
+ const { screen, fireEvent, within, waitFor } = rtl;
+ resetFetchCalls();
+ SESSIONS.push({ ...SESSION_QR, id: 'sess-orphan-1', name: 'orphan-qr', engineLoaded: false });
+ try {
+ renderSessions();
+
+ await screen.findByText('orphan-qr');
+ const card = screen.getByText('orphan-qr').closest('.session-card') as HTMLElement;
+ fireEvent.click(within(card).getByRole('button', { name: 'Reconnect' }));
+
+ await waitFor(() => {
+ assert.ok(findFetchCall('POST', '/api/sessions/sess-orphan-1/start'), 'expected a POST to the start endpoint');
+ });
+ } finally {
+ SESSIONS.pop();
+ }
+});
+
test('a restricted session shows the restriction on its card, even while it is ready', async () => {
const { screen, within } = rtl;
resetFetchCalls();
diff --git a/dashboard/src/pages/Sessions.tsx b/dashboard/src/pages/Sessions.tsx
index 3eeda8b10..5914f3149 100644
--- a/dashboard/src/pages/Sessions.tsx
+++ b/dashboard/src/pages/Sessions.tsx
@@ -279,13 +279,10 @@ export function Sessions() {
}
};
+ // Start and Reconnect only render for a card with no engine behind it, so they always call the
+ // gateway. A leftover `initializing` or `qr_ready` status (a node that died mid-pairing) is no reason
+ // to open the QR modal instead: GET /qr answers 400 until something starts the session.
const handleStart = async (id: string) => {
- const session = sessions.find(s => s.id === id);
- if (session && ['initializing', 'qr_ready'].includes(session.status)) {
- handleShowQR(id);
- return;
- }
-
try {
// Use the authoritative response instead of fabricating a status. The old code wrote a local
// `status: 'connecting'` — a value the gateway never emits — while keeping every other field